Rename util.config.Watcher -> util.config.Broadcaster.

Watch is a widely used term in the codebase, which doesn't capture
the key feature of this type: broadcasting a change to several
listeners.
This commit is contained in:
Eric Tune
2014-12-03 23:54:40 -08:00
parent c31b3f04de
commit 64f1084c1a
3 changed files with 32 additions and 32 deletions

View File

@@ -97,24 +97,24 @@ func TestSimultaneousMerge(t *testing.T) {
<-ch
}
func TestWatcher(t *testing.T) {
watch := NewWatcher()
watch.Notify(struct{}{})
func TestBroadcaster(t *testing.T) {
b := NewBroadcaster()
b.Notify(struct{}{})
ch := make(chan bool, 2)
watch.Add(ListenerFunc(func(object interface{}) {
b.Add(ListenerFunc(func(object interface{}) {
if object != "test" {
t.Errorf("Expected %s, Got %s", "test", object)
}
ch <- true
}))
watch.Add(ListenerFunc(func(object interface{}) {
b.Add(ListenerFunc(func(object interface{}) {
if object != "test" {
t.Errorf("Expected %s, Got %s", "test", object)
}
ch <- true
}))
watch.Notify("test")
b.Notify("test")
<-ch
<-ch
}