Commit 78907280 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 75953935
...@@ -472,16 +472,17 @@ type Head struct { ...@@ -472,16 +472,17 @@ type Head struct {
// XXX move zconn's current transaction to Head here? // XXX move zconn's current transaction to Head here?
// XXX move watchTab here? // XXX move watchTab here?
// head/watch opens
// XXX protected by ... head.zconnMu ?
// XXX -> Head ?
watchTab map[*Watcher]struct{}
} }
// /head/watch - served by Watch. // /head/watch - served by Watch.
type Watch struct { type Watch struct {
fsNode fsNode
// head/watch opens head *Head // parent head/
// XXX protected by ... head.zconnMu ?
watchTab map[*Watcher]struct{}
} }
// /head/watch handle - served by Watcher. // /head/watch handle - served by Watcher.
...@@ -1231,6 +1232,27 @@ retry: ...@@ -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 ---- // ---- Lookup ----
...@@ -1604,14 +1626,15 @@ func main() { ...@@ -1604,14 +1626,15 @@ func main() {
// mount root + head/ // mount root + head/
// XXX -> newHead() // XXX -> newHead()
head := &Head{ head := &Head{
fsNode: newFSNode(fSticky), fsNode: newFSNode(fSticky),
rev: 0, rev: 0,
zconn: zhead, zconn: zhead,
watchTab: make(map[*Watcher]struct{}),
} }
watch := &Watch{ watch := &Watch{
fsNode: newFSNode(fSticky), fsNode: newFSNode(fSticky),
watchTab: make(map[*Watcher]struct{}), head: head,
} }
bfdir := &BigFileDir{ 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