Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
f1b89b31
Commit
f1b89b31
authored
Jul 19, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
41db5fd6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
wcfs/zodb.go
wcfs/zodb.go
+9
-9
wcfs/zodbpy.go
wcfs/zodbpy.go
+3
-3
No files found.
wcfs/zodb.go
View file @
f1b89b31
...
@@ -96,8 +96,8 @@ const (
...
@@ -96,8 +96,8 @@ const (
// no STICKY - we pin objects in RAM with PActivate
// no STICKY - we pin objects in RAM with PActivate
)
)
//
objec
t is common base implementation for in-RAM representation of ZODB objects.
//
Persisten
t is common base implementation for in-RAM representation of ZODB objects.
type
objec
t
struct
{
type
Persisten
t
struct
{
jar
*
Connection
jar
*
Connection
oid
zodb
.
Oid
oid
zodb
.
Oid
serial
zodb
.
Tid
serial
zodb
.
Tid
...
@@ -105,13 +105,13 @@ type object struct {
...
@@ -105,13 +105,13 @@ type object struct {
mu
sync
.
Mutex
mu
sync
.
Mutex
state
ObjectState
state
ObjectState
refcnt
int32
refcnt
int32
instance
IPersistent
//
objec
t should be the base for the instance
instance
IPersistent
//
Persisten
t should be the base for the instance
loading
*
loadState
loading
*
loadState
}
}
func
(
obj
*
objec
t
)
PJar
()
*
Connection
{
return
obj
.
jar
}
func
(
obj
*
Persisten
t
)
PJar
()
*
Connection
{
return
obj
.
jar
}
func
(
obj
*
objec
t
)
POid
()
zodb
.
Oid
{
return
obj
.
oid
}
func
(
obj
*
Persisten
t
)
POid
()
zodb
.
Oid
{
return
obj
.
oid
}
func
(
obj
*
objec
t
)
PSerial
()
zodb
.
Tid
{
return
obj
.
serial
}
func
(
obj
*
Persisten
t
)
PSerial
()
zodb
.
Tid
{
return
obj
.
serial
}
// loadState indicates object's load state/result.
// loadState indicates object's load state/result.
//
//
...
@@ -227,7 +227,7 @@ type LiveCacheControl interface {
...
@@ -227,7 +227,7 @@ type LiveCacheControl interface {
// ---- activate/deactivate/invalidate ----
// ---- activate/deactivate/invalidate ----
// PActivate implements IPersistent.
// PActivate implements IPersistent.
func
(
obj
*
objec
t
)
PActivate
(
ctx
context
.
Context
)
(
err
error
)
{
func
(
obj
*
Persisten
t
)
PActivate
(
ctx
context
.
Context
)
(
err
error
)
{
obj
.
mu
.
Lock
()
obj
.
mu
.
Lock
()
obj
.
refcnt
++
obj
.
refcnt
++
doload
:=
(
obj
.
refcnt
==
1
&&
obj
.
state
==
GHOST
)
doload
:=
(
obj
.
refcnt
==
1
&&
obj
.
state
==
GHOST
)
...
@@ -284,7 +284,7 @@ func (obj *object) PActivate(ctx context.Context) (err error) {
...
@@ -284,7 +284,7 @@ func (obj *object) PActivate(ctx context.Context) (err error) {
}
}
// PDeactivate implements IPersistent.
// PDeactivate implements IPersistent.
func
(
obj
*
objec
t
)
PDeactivate
()
{
func
(
obj
*
Persisten
t
)
PDeactivate
()
{
obj
.
mu
.
Lock
()
obj
.
mu
.
Lock
()
defer
obj
.
mu
.
Unlock
()
defer
obj
.
mu
.
Unlock
()
...
@@ -314,7 +314,7 @@ func (obj *object) PDeactivate() {
...
@@ -314,7 +314,7 @@ func (obj *object) PDeactivate() {
}
}
// PInvalidate() implements IPersistent.
// PInvalidate() implements IPersistent.
func
(
obj
*
objec
t
)
PInvalidate
()
{
func
(
obj
*
Persisten
t
)
PInvalidate
()
{
obj
.
mu
.
Lock
()
obj
.
mu
.
Lock
()
defer
obj
.
mu
.
Unlock
()
defer
obj
.
mu
.
Unlock
()
...
...
wcfs/zodbpy.go
View file @
f1b89b31
...
@@ -40,7 +40,7 @@ type IPyPersistent interface {
...
@@ -40,7 +40,7 @@ type IPyPersistent interface {
// pyObject is common base implementation for in-RAM representation of ZODB Python objects.
// pyObject is common base implementation for in-RAM representation of ZODB Python objects.
type
pyObject
struct
{
type
pyObject
struct
{
objec
t
Persisten
t
pyclass
pickle
.
Class
pyclass
pickle
.
Class
}
}
...
@@ -59,7 +59,7 @@ type PyStateful interface {
...
@@ -59,7 +59,7 @@ type PyStateful interface {
//PyGetState() interface{} TODO
//PyGetState() interface{} TODO
}
}
// ---- pyObject <->
objec
t state exchange ----
// ---- pyObject <->
Persisten
t state exchange ----
// pyinstance returns .instance upcasted to IPyPersistent.
// pyinstance returns .instance upcasted to IPyPersistent.
//
//
...
@@ -106,7 +106,7 @@ func registerPyClass(pyClassPath string, classNew pyClassNewFunc) {
...
@@ -106,7 +106,7 @@ func registerPyClass(pyClassPath string, classNew pyClassNewFunc) {
// newGhost creates new ghost object corresponding to pyclass and oid.
// newGhost creates new ghost object corresponding to pyclass and oid.
func
(
conn
*
Connection
)
newGhost
(
pyclass
pickle
.
Class
,
oid
zodb
.
Oid
)
IPyPersistent
{
func
(
conn
*
Connection
)
newGhost
(
pyclass
pickle
.
Class
,
oid
zodb
.
Oid
)
IPyPersistent
{
pyobj
:=
&
pyObject
{
pyobj
:=
&
pyObject
{
object
:
objec
t
{
jar
:
conn
,
oid
:
oid
,
serial
:
0
,
state
:
GHOST
},
Persistent
:
Persisten
t
{
jar
:
conn
,
oid
:
oid
,
serial
:
0
,
state
:
GHOST
},
pyclass
:
pyclass
,
pyclass
:
pyclass
,
}
}
...
...
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