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
4dc558f1
Commit
4dc558f1
authored
Aug 08, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6826989c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
15 deletions
+8
-15
go/zodb/connection.go
go/zodb/connection.go
+8
-15
No files found.
go/zodb/connection.go
View file @
4dc558f1
...
...
@@ -145,10 +145,7 @@ func (e *wrongClassError) Error() string {
// Use-case: in ZODB references are (pyclass, oid), so new ghost is created
// without further loading anything.
func
(
conn
*
Connection
)
get
(
class
string
,
oid
Oid
)
(
IPersistent
,
error
)
{
// XXX txn check
//conn.checkTxn("get")
conn
.
objmu
.
Lock
()
// XXX -> rlock
conn
.
objmu
.
Lock
()
// XXX -> rlock?
wobj
:=
conn
.
objtab
[
oid
]
var
obj
IPersistent
checkClass
:=
false
...
...
@@ -167,12 +164,9 @@ func (conn *Connection) get(class string, oid Oid) (IPersistent, error) {
if
checkClass
{
if
cls
:=
zclassOf
(
obj
);
class
!=
cls
{
return
nil
,
&
OpError
{
URL
:
conn
.
stor
.
URL
(),
Op
:
fmt
.
Sprintf
(
"@%s: get"
,
conn
.
at
),
// XXX abuse
Args
:
oid
,
Err
:
&
wrongClassError
{
class
,
cls
},
}
var
err
error
=
&
wrongClassError
{
class
,
cls
}
xerr
.
Contextf
(
&
err
,
"get %s"
,
Xid
{
conn
.
at
,
oid
})
return
nil
,
err
}
}
...
...
@@ -193,7 +187,7 @@ func (conn *Connection) Get(ctx context.Context, oid Oid) (_ IPersistent, err er
conn
.
checkTxnCtx
(
ctx
,
"Get"
)
defer
xerr
.
Contextf
(
&
err
,
"Get %s"
,
oid
)
conn
.
objmu
.
Lock
()
// XXX -> rlock
conn
.
objmu
.
Lock
()
// XXX -> rlock?
wobj
:=
conn
.
objtab
[
oid
]
var
xobj
interface
{}
if
wobj
!=
nil
{
...
...
@@ -207,15 +201,16 @@ func (conn *Connection) Get(ctx context.Context, oid Oid) (_ IPersistent, err er
}
// object is not there in objtab - raw load it, get its class -> get(pyclass, oid)
// XXX
py
hardcoded
// XXX
"py always"
hardcoded
class
,
pystate
,
serial
,
err
:=
conn
.
loadpy
(
ctx
,
oid
)
if
err
!=
nil
{
xerr
.
Contextf
(
&
err
,
"Get %s"
,
Xid
{
conn
.
at
,
oid
})
return
nil
,
err
}
obj
,
err
:=
conn
.
get
(
class
,
oid
)
if
err
!=
nil
{
return
nil
,
err
// XXX double err ctx? (see get)
return
nil
,
err
}
// XXX we are dropping just loaded pystate. Usually Get should be used
...
...
@@ -239,8 +234,6 @@ func (conn *Connection) load(ctx context.Context, oid Oid) (_ *mem.Buf, serial T
// ----------------------------------------
// checkTxnCtx asserts that current transaction is the same as conn.txn .
//
// XXX swap naming?
func
(
conn
*
Connection
)
checkTxnCtx
(
ctx
context
.
Context
,
who
string
)
{
conn
.
checkTxn
(
transaction
.
Current
(
ctx
),
who
)
}
...
...
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