Documentation ¶
Overview ¶
Package watch is a singleton registry of path -> etcd watches. It does the watching in a uniform manner, and uses provided functions to perform the specific work.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
func Create(w *Watcher)
Create a watch. Given a watcher, creates a watch and runs it in a goroutine, then registers it with the watch registry.
Types ¶
type Watch ¶
type Watch struct { Key string Config interface{} }
Watch is a struct providing a generic way of passing key/value information from etcd that is already unmarshalled.
type Watcher ¶
type Watcher struct { WatcherFunc Path string Channel chan *Watch StopChannel chan struct{} ErrorChannel chan error StopOnError bool Recursive bool }
Watcher is a struct that describes the various channels and data that comprise a successful watch on etcd.
Note in particular the Channel, which is an interface{}. The channel must be of type `chan` and it is expected that a listener exists for that channel elsewhere.
func NewWatcher ¶
func NewWatcher(channel chan *Watch, path string, fun WatcherFunc) *Watcher
NewWatcher creates a basic Watcher with the channel, path, and WatcherFunc. NewWatcher will create the other channels and set recursive.
type WatcherFunc ¶
WatcherFunc is the function that's fired anytime the watch receives an event that is not an error. It is expected that the WatcherFunc send to the channel on success.