Commit ee0a56f5 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 9a397e07
......@@ -354,12 +354,20 @@ func (f *skFile) Flush() fuse.Status {
// ---- ZODB ---
// typeOf returns ZODB type of an object.
// typeOf returns string for object's type.
//
// it differs from %T in fmt in that it supports printing zodb.Broken with
// details properly.
// - for ZODB objects, it uses zodb.ClassOf, which in particular supports
// printing zodb.Broken with details properly.
//
// - for other objects, it uses %T.
func typeOf(obj interface{}) string {
return zodb.ClassOf(obj)
switch obj := obj.(type) {
case zodb.IPersistent:
return zodb.ClassOf(obj)
default:
return fmt.Sprintf("%T", obj)
}
}
// ZConn is zodb.Connection + associated read-only transaction under which
......
......@@ -382,6 +382,7 @@ import (
"fmt"
stdlog "log"
"os"
"runtime"
"strings"
"sync"
"syscall"
......@@ -585,6 +586,7 @@ func (root *Root) zhandle1(zevent zodb.CommitEvent) {
// zevent = (tid^, []oid)
for _, oid := range zevent.Changev {
// XXX zhead.Cache() lock/unlock + comment it is not really needed
obj := zhead.Cache().Get(oid)
if obj == nil {
continue // nothing to do - see invariant
......@@ -630,6 +632,9 @@ func (root *Root) zhandle1(zevent zodb.CommitEvent) {
// XXX shutdown fs with ^^^ message.
}
// make sure obj won't be garbage-collected until we finish handling it.
runtime.KeepAlive(obj)
}
//wg = ...
......
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