Documentation ¶
Overview ¶
Package legacy contains state-watcher-tuned worker harnesses; the canonical implementations are in the watcher package, but aren't type-compatible with original-style watchers -- such as those returned from state methods -- which we still have a couple of uses for (and the certupdater use might even be legitimate).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNotifyWorker ¶
func NewNotifyWorker(handler NotifyWatchHandler) worker.Worker
NewNotifyWorker starts a new worker running the business logic from the handler. The worker loop is started in another goroutine as a side effect of calling this.
func NewStringsWorker ¶
func NewStringsWorker(handler StringsWatchHandler) worker.Worker
NewStringsWorker starts a new worker running the business logic from the handler. The worker loop is started in another goroutine as a side effect of calling this.
Types ¶
type NotifyWatchHandler ¶
type NotifyWatchHandler interface { // SetUp will be called once, and should return the watcher that will // be used to trigger subsequent Handle()s. SetUp can return a watcher // even if there is an error, and the notify worker will make sure // to stop the watcher. SetUp() (state.NotifyWatcher, error) // TearDown should cleanup any resources that are left around. TearDown() error // Handle is called whenever the watcher returned from SetUp sends a value // on its Changes() channel. The done channel will be closed if and when // the worker is being interrupted to finish. Any worker should avoid any // bare channel reads or writes, but instead use a select with the done // channel. Handle(done <-chan struct{}) error }
NotifyWatchHandler implements the business logic that is triggered as part of watching a NotifyWatcher.
type StringsWatchHandler ¶
type StringsWatchHandler interface { // SetUp will be called once, and should return the watcher that will // be used to trigger subsequent Handle()s. SetUp can return a watcher // even if there is an error, and the notify worker will make sure // to stop the watcher. SetUp() (state.StringsWatcher, error) // TearDown should cleanup any resources that are left around. TearDown() error // Handle is called whenever the watcher returned from SetUp sends a value // on its Changes() channel. Handle(changes []string) error }
StringsWatchHandler implements the business logic triggered as part of watching a StringsWatcher.