Commit 9233294f authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 3af1ed43
......@@ -692,17 +692,11 @@ func traceZWatch(format string, argv ...interface{}) {
// zwatcher watches for ZODB changes.
//
// see "4) when we receive an invalidation message from ZODB ..."
func (root *Root) zwatcher(ctx context.Context) (err error) {
defer xerr.Contextf(&err, "zwatch") // XXX more in context?
// XXX unmount on error? -> always EIO?
func (root *Root) zwatcher(ctx context.Context, zwatchq chan zodb.Event) (err error) {
defer xerr.Contextf(&err, "zwatch %s", root.zstor.URL())
// XXX error -> always EIO for data operations
traceZWatch(">>>")
zwatchq := make(chan zodb.Event)
at0 := root.zstor.AddWatch(zwatchq) // XXX -> to main thread to avoid race
defer root.zstor.DelWatch(zwatchq)
_ = at0 // XXX XXX
var zevent zodb.Event
var ok bool
......@@ -2176,7 +2170,7 @@ func main() {
stdlog.SetFlags(stdlog.Lmicroseconds)
}
// open zodb storage/db/connection
// open zodb storage/watch/db/connection
ctx := context.Background() // XXX + timeout?
zstor, err := zodb.Open(ctx, zurl, &zodb.OpenOptions{
ReadOnly: true,
......@@ -2186,9 +2180,15 @@ func main() {
}
defer zstor.Close()
zwatchq := make(chan zodb.Event)
at0 := zstor.AddWatch(zwatchq)
defer zstor.DelWatch(zwatchq)
zdb := zodb.NewDB(zstor)
defer zdb.Close() // XXX err
zhead, err := zopen(ctx, zdb, &zodb.ConnOptions{
At: at0,
// we need zhead.cache to be maintained across several transactions.
// see "3) for head/bigfile/* the following invariant is maintained ..."
NoPool: true,
......@@ -2299,8 +2299,8 @@ func main() {
// XXX place = ok?
// XXX ctx = ok?
// XXX wait for zwatcher shutdown.
go root.zwatcher(ctx)
// XXX wait for zwatcher shutdown + log from it error
go root.zwatcher(ctx, zwatchq)
// TODO handle autoexit
// (exit when kernel forgets all our inodes - wcfs.py keeps .wcfs/zurl
......
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