Commit 78907280 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 75953935
......@@ -472,16 +472,17 @@ type Head struct {
// XXX move zconn's current transaction to Head here?
// XXX move watchTab here?
// head/watch opens
// XXX protected by ... head.zconnMu ?
// XXX -> Head ?
watchTab map[*Watcher]struct{}
}
// /head/watch - served by Watch.
type Watch struct {
fsNode
// head/watch opens
// XXX protected by ... head.zconnMu ?
watchTab map[*Watcher]struct{}
head *Head // parent head/
}
// /head/watch handle - served by Watcher.
......@@ -1231,6 +1232,27 @@ retry:
}
// ---- Watch server ----
// Open serves /head/watch opens.
func (watch *Watch) Open(flags uint32, fctx *fuse.Context) (nodefs.File, fuse.Status) {
// XXX check flags?
w := &Watcher{
sk: NewFileSock(),
fileTab: make(map[*FileWatch]struct{}),
}
// XXX locking
watch.head.watchTab[w] = struct{}{}
go w.serve()
return w.sk.File(), fuse.OK
}
// serve serves client originated watch requests.
func (w *Watcher) serve() {
//w.recvReq()
}
// ---- Lookup ----
......@@ -1604,14 +1626,15 @@ func main() {
// mount root + head/
// XXX -> newHead()
head := &Head{
fsNode: newFSNode(fSticky),
rev: 0,
zconn: zhead,
fsNode: newFSNode(fSticky),
rev: 0,
zconn: zhead,
watchTab: make(map[*Watcher]struct{}),
}
watch := &Watch{
fsNode: newFSNode(fSticky),
watchTab: make(map[*Watcher]struct{}),
fsNode: newFSNode(fSticky),
head: head,
}
bfdir := &BigFileDir{
......
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