Commit 6c0aa796 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 4b71bba0
...@@ -457,7 +457,7 @@ func (bf *BigFile) Read(_ nodefs.File, dest []byte, off int64, _ fuse.Context) ( ...@@ -457,7 +457,7 @@ func (bf *BigFile) Read(_ nodefs.File, dest []byte, off int64, _ fuse.Context) (
*/ */
// zodbCacheControl implements ConnCacheControl to tune ZODB to never evict // zodbCacheControl implements LiveCacheControl to tune ZODB to never evict
// ZBTree/ZBucket from live cache. We want to keep ZBTree/ZBucket always alive // ZBTree/ZBucket from live cache. We want to keep ZBTree/ZBucket always alive
// becuse it is essentially the index where to find ZBigFile data. // becuse it is essentially the index where to find ZBigFile data.
// //
......
...@@ -43,7 +43,7 @@ type Object interface { ...@@ -43,7 +43,7 @@ type Object interface {
// //
// Object data must be accessed only after corresponding PActivate // Object data must be accessed only after corresponding PActivate
// call, which marks that object's data as being in use. // call, which marks that object's data as being in use.
PActivate(ctx context.Context) (activated bool, _ error) // XXX + -> nuse ? PActivate(ctx context.Context) (activated bool, _ error) // XXX ret semantics?
// PDeactivate indicates that corresponding PActivate caller finished access to object's data. // PDeactivate indicates that corresponding PActivate caller finished access to object's data.
// //
...@@ -106,9 +106,9 @@ func (pyobj *pyObject) PyClass() pickle.Class { return pyobj.pyclass } ...@@ -106,9 +106,9 @@ func (pyobj *pyObject) PyClass() pickle.Class { return pyobj.pyclass }
func (pyobj *pyObject) PyState() interface{} { return pyobj.pystate } func (pyobj *pyObject) PyState() interface{} { return pyobj.pystate }
// ConnCacheControl is the interface that allows applications to influence // LiveCacheControl is the interface that allows applications to influence
// Connection's decisions with respect to its live cache. // Connection's decisions with respect to its live cache.
type ConnCacheControl interface { type LiveCacheControl interface {
// WantEvict is called when object is going to be evicted from live cache and made ghost. // WantEvict is called when object is going to be evicted from live cache and made ghost.
// If !ok the object will remain live. // If !ok the object will remain live.
WantEvict(obj Object) (ok bool) WantEvict(obj Object) (ok bool)
...@@ -501,7 +501,7 @@ func (obj *object) pactivate(ctx context.Context) error { ...@@ -501,7 +501,7 @@ func (obj *object) pactivate(ctx context.Context) error {
} }
} }
func (obj *object) pdeactivate() { func (obj *object) pdeactivate() (drop bool) {
nuse := atomic.AddInt32(&obj.refcnt, -1) nuse := atomic.AddInt32(&obj.refcnt, -1)
if nuse < 0 { if nuse < 0 {
panic("pdeactivate: nuse < 0") panic("pdeactivate: nuse < 0")
...@@ -512,6 +512,7 @@ func (obj *object) pdeactivate() { ...@@ -512,6 +512,7 @@ func (obj *object) pdeactivate() {
// no users left. Let's see whether we should transition this object to ghost. // no users left. Let's see whether we should transition this object to ghost.
// TODO state=modified -> don't drop. // TODO state=modified -> don't drop.
drop = true
if drop { if drop {
if cc := obj.jar.cacheControl; cc != nil { if cc := obj.jar.cacheControl; cc != nil {
...@@ -522,6 +523,8 @@ func (obj *object) pdeactivate() { ...@@ -522,6 +523,8 @@ func (obj *object) pdeactivate() {
if drop { if drop {
obj.serial = 0 obj.serial = 0
} }
return drop
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment