MCPcopy Index your code
hub / github.com/ZenNotes/zennotes / Subscribe

Method Subscribe

apps/server/internal/watcher/watcher.go:116–129  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

114}
115
116func (w *Watcher) Subscribe() (<-chan vault.ChangeEvent, func()) {
117 ch := make(chan vault.ChangeEvent, 64)
118 w.mu.Lock()
119 w.subs[ch] = struct{}{}
120 w.mu.Unlock()
121 return ch, func() {
122 w.mu.Lock()
123 if _, ok := w.subs[ch]; ok {
124 delete(w.subs, ch)
125 close(ch)
126 }
127 w.mu.Unlock()
128 }
129}
130
131func (w *Watcher) Close() {
132 w.mu.Lock()

Calls 1

closeFunction · 0.50