Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
90821a24
Commit
90821a24
authored
Feb 01, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
1d8b1e10
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
17 deletions
+12
-17
go/zodb/impexp_test.go
go/zodb/impexp_test.go
+1
-1
go/zodb/persistent.go
go/zodb/persistent.go
+8
-3
go/zodb/persistent_api.go
go/zodb/persistent_api.go
+2
-11
go/zodb/pydata.go
go/zodb/pydata.go
+1
-2
No files found.
go/zodb/impexp_test.go
View file @
90821a24
...
@@ -30,5 +30,5 @@ var ZPyCommit func(string, Tid, ...IPersistent) (Tid, error)
...
@@ -30,5 +30,5 @@ var ZPyCommit func(string, Tid, ...IPersistent) (Tid, error)
// exported for zodb_test package:
// exported for zodb_test package:
func
PSerialize
(
obj
IPersistent
)
*
mem
.
Buf
{
func
PSerialize
(
obj
IPersistent
)
*
mem
.
Buf
{
return
obj
.
pSerialize
()
return
obj
.
p
ersistent
()
.
p
Serialize
()
}
}
go/zodb/persistent.go
View file @
90821a24
...
@@ -76,6 +76,8 @@ type Persistent struct {
...
@@ -76,6 +76,8 @@ type Persistent struct {
loading
*
loadState
loading
*
loadState
}
}
func
(
obj
*
Persistent
)
persistent
()
*
Persistent
{
return
obj
}
func
(
obj
*
Persistent
)
PJar
()
*
Connection
{
return
obj
.
jar
}
func
(
obj
*
Persistent
)
PJar
()
*
Connection
{
return
obj
.
jar
}
func
(
obj
*
Persistent
)
POid
()
Oid
{
return
obj
.
oid
}
func
(
obj
*
Persistent
)
POid
()
Oid
{
return
obj
.
oid
}
...
@@ -130,9 +132,12 @@ type Stateful interface {
...
@@ -130,9 +132,12 @@ type Stateful interface {
SetState
(
state
*
mem
.
Buf
)
error
SetState
(
state
*
mem
.
Buf
)
error
}
}
// ---- serialize ----
// ----
RAM -> DB:
serialize ----
// pSerialize implements IPersistent.
// pSerialize returns object in serialized form to be saved in the database.
//
// pSerialize is non-public method that is exposed and used only by ZODB internally.
// pSerialize is called only on non-ghost objects.
func
(
obj
*
Persistent
)
pSerialize
()
*
mem
.
Buf
{
func
(
obj
*
Persistent
)
pSerialize
()
*
mem
.
Buf
{
obj
.
mu
.
Lock
()
obj
.
mu
.
Lock
()
defer
obj
.
mu
.
Unlock
()
defer
obj
.
mu
.
Unlock
()
...
@@ -152,7 +157,7 @@ func (obj *Persistent) pSerialize() *mem.Buf {
...
@@ -152,7 +157,7 @@ func (obj *Persistent) pSerialize() *mem.Buf {
}
}
}
}
// ---- activate/deactivate/invalidate ----
// ----
RAM <- DB:
activate/deactivate/invalidate ----
// PActivate implements IPersistent.
// PActivate implements IPersistent.
func
(
obj
*
Persistent
)
PActivate
(
ctx
context
.
Context
)
(
err
error
)
{
func
(
obj
*
Persistent
)
PActivate
(
ctx
context
.
Context
)
(
err
error
)
{
...
...
go/zodb/persistent_api.go
View file @
90821a24
...
@@ -16,8 +16,6 @@ package zodb
...
@@ -16,8 +16,6 @@ package zodb
import
(
import
(
"context"
"context"
"lab.nexedi.com/kirr/go123/mem"
)
)
// IPersistent is the interface that every in-RAM object representing any database object implements.
// IPersistent is the interface that every in-RAM object representing any database object implements.
...
@@ -100,16 +98,9 @@ type IPersistent interface {
...
@@ -100,16 +98,9 @@ type IPersistent interface {
// XXX probably don't need this.
// XXX probably don't need this.
//PState() ObjectState // in-RAM object state.
//PState() ObjectState // in-RAM object state.
// XXX move vvv -> iPersistent? (-> into persistent.go)
// XXX do we need to put vvv into IPersistent at all?
// pSerialize returns object in serialized form to be saved in the database.
// IPersistent can be implemented only by objects that embed Persistent.
//
persistent
()
*
Persistent
// pSerialize is non-public method that is exposed and used only by ZODB internally.
// pSerialize is called only on non-ghost objects.
//
// XXX more text.
pSerialize
()
*
mem
.
Buf
}
}
// ObjectState describes state of in-RAM object.
// ObjectState describes state of in-RAM object.
...
...
go/zodb/pydata.go
View file @
90821a24
...
@@ -61,9 +61,8 @@ func (d PyData) ClassName() string {
...
@@ -61,9 +61,8 @@ func (d PyData) ClassName() string {
}
}
// encodePyData encodes Python class and state into raw ZODB python data.
// encodePyData encodes Python class and state into raw ZODB python data.
//
// XXX -> pySerialize?
func
encodePyData
(
pyclass
pickle
.
Class
,
pystate
interface
{})
PyData
{
func
encodePyData
(
pyclass
pickle
.
Class
,
pystate
interface
{})
PyData
{
// XXX better return mem.Buf instead of PyData?
buf
:=
&
bytes
.
Buffer
{}
buf
:=
&
bytes
.
Buffer
{}
p
:=
pickle
.
NewEncoderWithConfig
(
buf
,
&
pickle
.
EncoderConfig
{
p
:=
pickle
.
NewEncoderWithConfig
(
buf
,
&
pickle
.
EncoderConfig
{
...
...
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