mvcc/watcher_group.go
func (wg *watcherGroup) delete(wa *watcher) bool {
	if _, ok := wg.watchers[wa]; !ok {
		return false
	}
	wg.watchers.delete(wa)
	if wa.end == nil {
		wg.keyWatchers.delete(wa)
		return true
	}

	ivl := adt.NewStringAffineInterval(string(wa.key), string(wa.end))
	iv := wg.ranges.Find(ivl)
	if iv == nil {
		return false
	}

	ws := iv.Val.(watcherSet)
	delete(ws, wa)
	if len(ws) == 0 {
		// remove interval missing watchers
		if ok := wg.ranges.Delete(ivl); !ok {
			panic("could not remove watcher from interval tree")
		}
	}

	return true
}
func (wg *watcherGroup) delete(wa *watcher) bool {
	if _, ok := wg.watchers[wa]; !ok {
		return false
	}
	wg.watchers.delete(wa)
	if wa.end == nil {
		wg.keyWatchers.delete(wa)
		return true
	}

	ivl := adt.NewStringAffineInterval(string(wa.key), string(wa.end))
	iv := wg.ranges.Find(ivl)
	if iv == nil {
		return false
	}

	ws := iv.Val.(watcherSet)
	delete(ws, wa)
	if len(ws) == 0 {
		// remove interval missing watchers
		if ok := wg.ranges.Delete(ivl); !ok {
			panic("could not remove watcher from interval tree")
		}
	}

	return true
}
func ( wg * watcherGroup ) delete ( wa * watcher ) bool { if _ , ok := wg . watchers [ wa ] ; ! ok { return false } wg . watchers . delete ( wa ) if wa . end == nil { wg . keyWatchers . delete ( wa ) return true } ivl := adt . NewStringAffineInterval ( string ( wa . key ) , string ( wa . end ) ) iv := wg . ranges . Find ( ivl ) if iv == nil { return false } ws := iv . Val . ( watcherSet ) delete ( ws , wa ) if len ( ws ) == 0 { // remove interval missing watchers if ok := wg . ranges . Delete ( ivl ) ; ! ok { panic ( " " ) } } return true }
// delete removes a watcher from the group.
delete removes a watcher from the group .