Documentation ¶
Overview ¶
Package config provides utility objects for decoupling sources of configuration and the actual configuration state. Consumers must implement the Merger interface to unify the sources of change into an object.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Accessor ¶
type Accessor interface { // MergedState returns a representation of the current merge state. // Must be reentrant when more than one source is defined. MergedState() interface{} }
Accessor is an interface for retrieving the current merge state.
type AccessorFunc ¶
type AccessorFunc func() interface{}
AccessorFunc implements the Accessor interface.
func (AccessorFunc) MergedState ¶
func (f AccessorFunc) MergedState() interface{}
type Listener ¶
type Listener interface {
// OnUpdate is invoked when a change is made to an object.
OnUpdate(instance interface{})
}
type ListenerFunc ¶
type ListenerFunc func(instance interface{})
ListenerFunc receives a representation of the change or object.
func (ListenerFunc) OnUpdate ¶
func (f ListenerFunc) OnUpdate(instance interface{})
type Mux ¶
type Mux struct {
// contains filtered or unexported fields
}
Mux is a class for merging configuration from multiple sources. Changes are pushed via channels and sent to the merge function.
func (*Mux) Channel ¶
Channel returns a channel where a configuration source can send updates of new configurations. Multiple calls with the same source will return the same channel. This allows change and state based sources to use the same channel. Different source names however will be treated as a union.
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
func NewWatcher ¶
func NewWatcher() *Watcher
NewWatcher registers a set of listeners that support the Listener interface and notify them on changes.