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
4b71bba0
Commit
4b71bba0
authored
Jul 16, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
5683c3ca
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
7 deletions
+21
-7
wcfs/wcfs.go
wcfs/wcfs.go
+9
-5
wcfs/zodb.go
wcfs/zodb.go
+12
-2
No files found.
wcfs/wcfs.go
View file @
4b71bba0
...
...
@@ -457,18 +457,22 @@ func (bf *BigFile) Read(_ nodefs.File, dest []byte, off int64, _ fuse.Context) (
*/
// zodbCacheControl tunes ZODB wrt caching XXX
// zodbCacheControl implements ConnCacheControl to tune ZODB to never evict
// ZBTree/ZBucket from live cache. We want to keep ZBTree/ZBucket always alive
// becuse it is essentially the index where to find ZBigFile data.
//
// For the data itself - we put it to kernel cache and always deactivate from
// ZODB right after that.
//
// XXX set it to Connection.CacheControl
type
zodbCacheControl
struct
{}
type
(
cc
*
zodbCacheControl
)
WantEvict
(
obj
Object
)
{
// we want to keep ZBTree/ZBucket always alive becuse it is essentially
// the index where to find ZBigFile data.
func
(
cc
*
zodbCacheControl
)
WantEvict
(
obj
Object
)
{
switch
obj
.
(
type
)
{
default
:
return
true
case
*
ZB
t
ree
:
case
*
ZB
T
ree
:
case
*
ZBucket
:
}
...
...
wcfs/zodb.go
View file @
4b71bba0
...
...
@@ -18,6 +18,7 @@ import (
"context"
"fmt"
"sync"
"sync/atomic"
"lab.nexedi.com/kirr/neo/go/zodb"
...
...
@@ -106,7 +107,7 @@ func (pyobj *pyObject) PyState() interface{} { return pyobj.pystate }
// ConnCacheControl is the interface that allows applications to influence
// Connection
decisions with respect to its
cache.
// Connection
's decisions with respect to its live
cache.
type
ConnCacheControl
interface
{
// WantEvict is called when object is going to be evicted from live cache and made ghost.
// If !ok the object will remain live.
...
...
@@ -178,6 +179,9 @@ type Connection struct {
objmu
sync
.
Mutex
objtab
map
[
zodb
.
Oid
]
*
WeakRef
// oid -> WeakRef(PyObject)
//objtab map[zodb.Oid]interface{} // oid -> WeakRef(pyObject) | loadInProgress
cacheControl
ConnCacheControl
}
/*
...
...
@@ -493,7 +497,7 @@ func (obj *object) pactivate(ctx context.Context) error {
nuse
:=
atomic
.
AddInt32
(
&
obj
.
refcnt
,
+
1
)
if
nuse
==
1
{
// we become responsible for loading object's data.
// XXX check
.tryToKeepInRam
// XXX check
state
}
}
...
...
@@ -509,6 +513,12 @@ func (obj *object) pdeactivate() {
// no users left. Let's see whether we should transition this object to ghost.
// TODO state=modified -> don't drop.
if
drop
{
if
cc
:=
obj
.
jar
.
cacheControl
;
cc
!=
nil
{
drop
=
cc
.
WantEvict
(
obj
)
}
}
if
drop
{
obj
.
serial
=
0
}
...
...
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