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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
9d44f29e
Commit
9d44f29e
authored
Jul 20, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
26b6477d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
9 deletions
+28
-9
wcfs/zodb.go
wcfs/zodb.go
+28
-9
No files found.
wcfs/zodb.go
View file @
9d44f29e
...
...
@@ -22,13 +22,19 @@ import (
"lab.nexedi.com/kirr/neo/go/zodb"
)
// IPersistent is the interface that every in-RAM object representing any ZODB object implements.
// IPersistent is the interface that every in-RAM object representing any database object implements.
//
// It is based on IPersistent from ZODB/py:
//
// https://github.com/zopefoundation/ZODB/blob/3.10.7-4-gb8d7a8567/src/persistent/interfaces.py#L22
//
// but is not exactly equal to it.
type
IPersistent
interface
{
PJar
()
*
Connection
// Connection this in-RAM object is part of.
POid
()
zodb
.
Oid
// object ID in the database.
// object serial
as of database state for particular Connection (PJar)
.
// 0 if not yet loaded (XXX ok?)
// object serial
in the database as of particular Connection (PJar) view
.
// 0
(invalid tid)
if not yet loaded (XXX ok?)
PSerial
()
zodb
.
Tid
...
...
@@ -80,8 +86,20 @@ type IPersistent interface {
// object data simultaneously.
PInvalidate
()
// PModify marks in-RAM object state as modified.
//
// It informs persistency layer that object's data was changed and so
// its state needs to be either saved back into database on transaction
// commit, or discarded on transaction abort.
//
// The object must be already activated.
//PModify() TODO
// XXX probably don't need this.
//PState() ObjectState // in-RAM object state.
// Object must be stateful for persistency to work
// Object must be stateful for persistency to work
.
// XXX try to move out of IPersistent?
Stateful
}
...
...
@@ -96,7 +114,7 @@ const (
// no STICKY - we pin objects in RAM with PActivate
)
// Persistent is common base implementation for in-RAM representation of
ZODB
objects.
// Persistent is common base implementation for in-RAM representation of
database
objects.
type
Persistent
struct
{
jar
*
Connection
oid
zodb
.
Oid
...
...
@@ -110,7 +128,7 @@ type Persistent struct {
}
func
(
obj
*
Persistent
)
PJar
()
*
Connection
{
return
obj
.
jar
}
func
(
obj
*
Persistent
)
POid
()
zodb
.
Oid
{
return
obj
.
oid
}
func
(
obj
*
Persistent
)
POid
()
zodb
.
Oid
{
return
obj
.
oid
}
func
(
obj
*
Persistent
)
PSerial
()
zodb
.
Tid
{
return
obj
.
serial
}
// loadState indicates object's load state/result.
...
...
@@ -125,7 +143,7 @@ type loadState struct {
err
error
}
// Stateful is the interface describing in-RAM object whose data stat can be
// Stateful is the interface describing in-RAM object whose data stat
e
can be
// exchanged as raw bytes.
type
Stateful
interface
{
// DropState should discard in-RAM object state.
...
...
@@ -134,7 +152,8 @@ type Stateful interface {
// SetState should set state of the in-RAM object from raw data.
//
// SetState must incref state buffer, if it needs the buffer to stay dedicated XXX
// state ownership is not passed to SetState, so if state needs to be
// retained after SetState returns it needs to be incref'ed.
SetState
(
state
*
mem
.
Buf
)
error
// GetState should return state of the in-RAM object as raw data.
...
...
@@ -202,7 +221,7 @@ type Connection struct {
// https://groups.google.com/forum/#!topic/golang-nuts/PYWxjT2v6ps
//
// NOTE2 finalizers don't run on when they are attached to an object in cycle.
// Hopefully we don't have cycles with ZB
t
ree/ZBucket XXX verify this
// Hopefully we don't have cycles with ZB
T
ree/ZBucket XXX verify this
objmu
sync
.
Mutex
objtab
map
[
zodb
.
Oid
]
*
WeakRef
// oid -> WeakRef(IPersistent)
...
...
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