Documentation ¶
Index ¶
Constants ¶
const SettingUpdateQueueSize = 50
SettingUpdateQueueSize is the watch channel buffer size
Variables ¶
var ErrAlreadyWatchingGivenKey = errors.New("Already watching given key")
ErrAlreadyWatchingGivenKey :- Method / Function / Functionality no implemented
var ErrNotImplemented = errors.New("Method / Function / Functionality no implemented")
ErrNotImplemented :- Method / Function / Functionality no implemented
Functions ¶
This section is empty.
Types ¶
type ConfigProvider ¶
type ConfigProvider interface {
Subscribe(ctx context.Context, prefix string, tag interface{}) (<-chan *SettingUpdate, error)
}
ConfigProvider exposes a set of functionality that are expected out of a typical configuration provider
type EtcdConnDetails ¶
EtcdConnDetails represents etcd connection details
type EtcdWrapper ¶
type EtcdWrapper struct {
// contains filtered or unexported fields
}
EtcdWrapper is wrapper written over standard etcd-v3 client
func NewEtcd ¶
func NewEtcd(e EtcdConnDetails) (*EtcdWrapper, error)
NewEtcd connects and initializes new etcd client wrapper
func (*EtcdWrapper) Subscribe ¶
func (e *EtcdWrapper) Subscribe(ctx context.Context, prefix string, tag interface{}) (<-chan *SettingUpdate, error)
Subscribe takes a prefix and watches under that prefix for any change, if somethings changes it will push that settingUpdate in the returned channel along with the tag. Tag is for book keeping. Cancling the context will unsubscribe, it is necessary to do so otherwise it may cause memory leaks
type SettingUpdate ¶
type SettingUpdate struct { Key string RelativeKey string Value string Tag interface{} Kind SettingUpdateKind }
SettingUpdate represents a setting change that happened on etcd end
type SettingUpdateKind ¶
type SettingUpdateKind int
SettingUpdateKind is constant representing kind of update
const ( // SettingKindUnknown indicates that current setting update kind is not known SettingKindUnknown SettingUpdateKind = 0 + iota // SettingKindInitial indicates that setting update was part fetched as part of initial pull SettingKindInitial // SettingKindPut indicates that setting update represents a created / updated operation SettingKindPut // SettingKindDeleted indicates that current setting was part of a delete operation SettingKindDeleted )