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
7b0de48a
Commit
7b0de48a
authored
Aug 08, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
f96736a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
go/zodb/persistent.go
go/zodb/persistent.go
+14
-8
No files found.
go/zodb/persistent.go
View file @
7b0de48a
...
...
@@ -149,8 +149,7 @@ func (obj *Persistent) PActivate(ctx context.Context) (err error) {
if
obj
.
loading
!=
nil
{
obj
.
mu
.
Unlock
()
panic
(
fmt
.
Sprintf
(
"%s(%s): activate: need to load, but .loading != nil"
,
obj
.
zclass
.
class
,
obj
.
oid
))
panic
(
obj
.
badf
(
"activate: need to load, but .loading != nil"
))
}
// we become responsible for loading the object
...
...
@@ -166,9 +165,8 @@ func (obj *Persistent) PActivate(ctx context.Context) (err error) {
if
l
,
s
:=
obj
.
loading
,
obj
.
state
;
!
(
l
==
loading
&&
s
==
GHOST
)
{
obj
.
mu
.
Unlock
()
panic
(
fmt
.
Sprintf
(
"%s(%s): activate: after load: object state unexpected: "
+
"%v (want %v); .loading = %p (want %p)"
,
obj
.
zclass
.
class
,
obj
.
oid
,
s
,
GHOST
,
l
,
loading
))
panic
(
obj
.
badf
(
"activate: after load: object state unexpected: "
+
"%v (want %v); .loading = %p (want %p)"
,
s
,
GHOST
,
l
,
loading
))
}
obj
.
serial
=
serial
...
...
@@ -185,7 +183,7 @@ func (obj *Persistent) PActivate(ctx context.Context) (err error) {
xerr
.
Context
(
&
err
,
"pysetstate"
)
default
:
panic
(
"!stateful instance"
)
panic
(
obj
.
badf
(
"activate: !stateful instance"
)
)
}
state
.
Release
()
...
...
@@ -194,6 +192,7 @@ func (obj *Persistent) PActivate(ctx context.Context) (err error) {
}
}
// XXX set state to load error?
loading
.
err
=
err
obj
.
mu
.
Unlock
()
...
...
@@ -209,7 +208,7 @@ func (obj *Persistent) PDeactivate() {
obj
.
refcnt
--
if
obj
.
refcnt
<
0
{
panic
(
"deactivate: refcnt < 0"
)
panic
(
obj
.
badf
(
"deactivate: refcnt < 0"
)
)
}
if
obj
.
refcnt
>
0
{
return
// users still left
...
...
@@ -243,7 +242,7 @@ func (obj *Persistent) PInvalidate() {
if
obj
.
refcnt
!=
0
{
// object is currently in use
panic
(
"invalidate: refcnt != 0"
)
panic
(
obj
.
badf
(
"invalidate: refcnt != 0"
))
// XXX
}
obj
.
serial
=
InvalidTid
...
...
@@ -261,6 +260,13 @@ func (obj *Persistent) istate() Ghostable {
return
xstateful
.
Interface
()
.
(
Ghostable
)
}
// badf returns formatted error prefixed with obj's class and oid.
func
(
obj
*
Persistent
)
badf
(
format
string
,
argv
...
interface
{})
error
{
return
fmt
.
Errorf
(
"%s(%s): "
+
format
,
append
([]
interface
{}{
obj
.
zclass
.
class
,
obj
.
oid
},
argv
...
))
}
// ---- class <-> type; new ghost ----
// zclass describes one ZODB class in relation to a Go type.
...
...
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