Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RetryFunc ¶
RetryFunc is a function that defines the retry for a given watcher. The function parameter is the current retry (which might be nil), and the return value is the new retry. In this way, you can build complex retry functions that are based off the previous values.
type View ¶
type View struct { Dependency dependency.Dependency Data interface{} // contains filtered or unexported fields }
View is a representation of a Dependency and the most recent data it has received from Consul.
func NewView ¶
func NewView(client *api.Client, dep dependency.Dependency) (*View, error)
NewView creates a new view object from the given Consul API client and Dependency. If an error occurs, it will be returned.
type Wait ¶
type Wait struct {
// Min and Max are the minimum and maximum time, respectively, to wait for
// data changes before rendering a new template to disk.
Min, Max time.Duration
}
Wait is the Min/Max duration used by the Watcher
type Watcher ¶
type Watcher struct { sync.Mutex // DataCh is the chan where Views will be published DataCh chan *View // ErrCh is the chan where any errors will be published ErrCh chan error // FinishCh is the chan where the watcher reports it is "done" FinishCh chan struct{} // contains filtered or unexported fields }
func NewWatcher ¶
func NewWatcher(client *api.Client, dependencies []dependency.Dependency) (*Watcher, error)
func (*Watcher) SetRetry ¶
SetRetry is used to set the retry to a static value. See SetRetryFunc for more informatoin.
func (*Watcher) SetRetryFunc ¶
SetRetryFunc is used to set a dynamic retry function. Only new views created after this function has been set will inherit the new retry functionality. Existing views will use the retry functionality with which they were created.
func (*Watcher) Stop ¶
func (w *Watcher) Stop()
Stop halts this watcher and any currently polling views immediately. If a view was in the middle of a poll, no data will be returned.
func (*Watcher) Watch ¶
Watch creates a series of Consul views which poll for data in parallel. If the `once` flag is true, each view will return data (or an error) exactly once and terminate. If the `once` flag is false, views will continue to poll indefinitely unless they encounter an irrecoverable error.