Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
3ed14841
Commit
3ed14841
authored
Aug 08, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
4dc558f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
14 deletions
+8
-14
go/zodb/connection.go
go/zodb/connection.go
+8
-14
No files found.
go/zodb/connection.go
View file @
3ed14841
...
...
@@ -45,10 +45,10 @@ import (
//
// Use DB.Open to open a connection.
type
Connection
struct
{
stor
IStorage
// underlying storage
db
*
DB
// Connection is part of this DB
txn
transaction
.
Transaction
// opened under this txn; nil if idle in DB pool.
at
Tid
// current view of database; stable inside a transaction.
stor
IStorage
// underlying storage
db
*
DB
// Connection is part of this DB
txn
transaction
.
Transaction
// opened under this txn; nil if idle in DB pool.
at
Tid
// current view of database; stable inside a transaction.
// {} oid -> obj
//
...
...
@@ -123,10 +123,10 @@ type LiveCacheControl interface {
// newConnection creates new Connection associated with db.
func
newConnection
(
db
*
DB
,
at
Tid
)
*
Connection
{
return
&
Connection
{
stor
:
db
.
stor
,
db
:
db
,
at
:
at
,
objtab
:
make
(
map
[
Oid
]
*
weak
.
Ref
),
stor
:
db
.
stor
,
db
:
db
,
at
:
at
,
objtab
:
make
(
map
[
Oid
]
*
weak
.
Ref
),
}
}
...
...
@@ -139,7 +139,6 @@ func (e *wrongClassError) Error() string {
return
fmt
.
Sprintf
(
"wrong class: want %q; have %q"
,
e
.
want
,
e
.
have
)
}
// get is like Get, but used when we already know object class.
//
// Use-case: in ZODB references are (pyclass, oid), so new ghost is created
...
...
@@ -173,7 +172,6 @@ func (conn *Connection) get(class string, oid Oid) (IPersistent, error) {
return
obj
,
nil
}
// Get returns in-RAM object corresponding to specified ZODB object according to current database view.
//
// If there is already in-RAM object that corresponds to oid, that in-RAM object is returned.
...
...
@@ -221,16 +219,12 @@ func (conn *Connection) Get(ctx context.Context, oid Oid) (_ IPersistent, err er
return
obj
,
nil
}
// load loads object specified by oid.
func
(
conn
*
Connection
)
load
(
ctx
context
.
Context
,
oid
Oid
)
(
_
*
mem
.
Buf
,
serial
Tid
,
_
error
)
{
conn
.
checkTxnCtx
(
ctx
,
"load"
)
return
conn
.
stor
.
Load
(
ctx
,
Xid
{
Oid
:
oid
,
At
:
conn
.
at
})
}
// ----------------------------------------
// checkTxnCtx asserts that current transaction is the same as conn.txn .
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment