Commit ee0a56f5 authored by Kirill Smelkov's avatar Kirill Smelkov

.

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