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
7a8cebf5
Commit
7a8cebf5
authored
Jul 19, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ae2044cd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
16 deletions
+13
-16
wcfs/wcfs.go
wcfs/wcfs.go
+1
-1
wcfs/zodb.go
wcfs/zodb.go
+10
-13
wcfs/zodbpy.go
wcfs/zodbpy.go
+2
-2
No files found.
wcfs/wcfs.go
View file @
7a8cebf5
...
...
@@ -478,7 +478,7 @@ func (bf *BigFile) Read(_ nodefs.File, dest []byte, off int64, _ fuse.Context) (
// TODO set it to Connection.CacheControl
type
zodbCacheControl
struct
{}
func
(
cc
*
zodbCacheControl
)
WantEvict
(
obj
Objec
t
)
bool
{
func
(
cc
*
zodbCacheControl
)
WantEvict
(
obj
IPersisten
t
)
bool
{
switch
obj
.
(
type
)
{
default
:
return
true
...
...
wcfs/zodb.go
View file @
7a8cebf5
...
...
@@ -22,11 +22,8 @@ import (
"lab.nexedi.com/kirr/neo/go/zodb"
)
// Object is the interface that every in-RAM object representing any ZODB object implements.
//
// It is analog to Persistent in ZODB.
// XXX rename -> Persistent?
type
Object
interface
{
// IPersistent is the interface that every in-RAM object representing any ZODB object implements.
type
IPersistent
interface
{
PJar
()
*
Connection
// Connection this in-RAM object is part of.
POid
()
zodb
.
Oid
// object ID in the database.
...
...
@@ -85,7 +82,7 @@ type Object interface {
// Object must be stateful for persistency to work
// XXX try to move out of
Objec
t?
// XXX try to move out of
IPersisten
t?
Stateful
}
...
...
@@ -108,7 +105,7 @@ type object struct {
mu
sync
.
Mutex
state
ObjectState
refcnt
int32
instance
Object
// object should be the base for the instance
instance
IPersistent
// object should be the base for the instance
loading
*
loadState
}
...
...
@@ -151,7 +148,7 @@ type Stateful interface {
//
// Connection changes are private and are isolated from changes in other Connections.
//
// XXX Connection, and
{Py}Objec
t methods that relate to it, are not safe for
// XXX Connection, and
I{Py}Persisten
t methods that relate to it, are not safe for
// modifications from multiple goroutines simultaneously.
//
// XXX ^^^ better must be safe - use case: e.g. prefetch.
...
...
@@ -207,7 +204,7 @@ type Connection struct {
// NOTE2 finalizers don't run on when they are attached to an object in cycle.
// Hopefully we don't have cycles with ZBtree/ZBucket XXX verify this
objmu
sync
.
Mutex
objtab
map
[
zodb
.
Oid
]
*
WeakRef
// oid -> WeakRef(
Objec
t)
objtab
map
[
zodb
.
Oid
]
*
WeakRef
// oid -> WeakRef(
IPersisten
t)
// hooks for application to influence live caching decisions.
cacheControl
LiveCacheControl
...
...
@@ -223,13 +220,13 @@ type LiveCacheControl interface {
//
// NOTE on invalidation invalidated objects are evicted from live cache
// unconditionally.
WantEvict
(
obj
Objec
t
)
(
ok
bool
)
WantEvict
(
obj
IPersisten
t
)
(
ok
bool
)
}
// ---- activate/deactivate/invalidate ----
// PActivate implements
Objec
t.
// PActivate implements
IPersisten
t.
func
(
obj
*
object
)
PActivate
(
ctx
context
.
Context
)
(
err
error
)
{
obj
.
mu
.
Lock
()
obj
.
refcnt
++
...
...
@@ -286,7 +283,7 @@ func (obj *object) PActivate(ctx context.Context) (err error) {
return
err
// XXX err ctx
}
// PDeactivate implements
Objec
t.
// PDeactivate implements
IPersisten
t.
func
(
obj
*
object
)
PDeactivate
()
{
obj
.
mu
.
Lock
()
defer
obj
.
mu
.
Unlock
()
...
...
@@ -316,7 +313,7 @@ func (obj *object) PDeactivate() {
obj
.
loading
=
nil
}
// PInvalidate() implements
Objec
t.
// PInvalidate() implements
IPersisten
t.
func
(
obj
*
object
)
PInvalidate
()
{
obj
.
mu
.
Lock
()
defer
obj
.
mu
.
Unlock
()
...
...
wcfs/zodbpy.go
View file @
7a8cebf5
...
...
@@ -28,7 +28,7 @@ import (
//
// XXX rename -> PyPersistent?
type
PyObject
interface
{
Objec
t
IPersisten
t
PyClass
()
pickle
.
Class
// python class of this object
// PyState() interface{} // object state. python passes this to pyclass.__new__().__setstate__()
...
...
@@ -66,7 +66,7 @@ type PyStateful interface {
// pyinstance returns .instance upcasted to PyObject.
//
// this should be always safe because we always create pyObjects via
// newGhost which passes PyObject as instance to
Objec
t.
// newGhost which passes PyObject as instance to
IPersisten
t.
func
(
pyobj
*
pyObject
)
pyinstance
()
PyObject
{
return
pyobj
.
instance
.
(
PyObject
)
}
...
...
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