Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfEvent ¶
type ConfEvent struct {
Key string
Content []byte
Type ConfEventType
}
ConfEvent describes a conf change event
type ConfEventType ¶
type ConfEventType int
ConfEventType discriminates config update event types (PUT and DELETE)
const ( ConfPut ConfEventType = iota ConfDelete )
Conf update event types
type ConfStore ¶
type ConfStore interface {
List() (data []ConfItem, err error)
Close() error
Updates() <-chan ConfEvent
Put(key string, value []byte) error
Delete(key string) error
SkipNext(key string)
}
ConfStore abstracts a config store (etcd, local disk...)
type DiskStore ¶
DiskStore implements a disk backed config store
func NewDiskStore ¶
NewDiskStore instantiates a new disk ConfigStore
type Etcd3Store ¶
Etcd3Store implements an etcd3-backed config store
func NewEtcd3Store ¶
func NewEtcd3Store(endpoint, prefix string) (cs *Etcd3Store, err error)
NewEtcd3Store creates a new etcd3 config store
func (*Etcd3Store) Delete ¶
func (cs *Etcd3Store) Delete(key string) error
Delete deletes a given key
func (*Etcd3Store) List ¶
func (cs *Etcd3Store) List() (data []ConfItem, err error)
List all conf from Etcd3
func (*Etcd3Store) Put ¶
func (cs *Etcd3Store) Put(key string, value []byte) error
Put puts a given value under a given key
func (*Etcd3Store) Updates ¶
func (cs *Etcd3Store) Updates() <-chan ConfEvent
Updates returns the ConfStore update channel
type Syncer ¶
type Syncer struct {
LocalStore ConfStore
RemoteStore ConfStore
// contains filtered or unexported fields
}
Syncer keeps a local config store in sync with a remote config stores
func (*Syncer) AddLocalConfToRemoteStore ¶
AddLocalConfToRemoteStore puts on the remote all the local config files that aren't already in there
func (*Syncer) KeepInSync ¶
func (s *Syncer) KeepInSync()
KeepInSync makes sure all config stores are kept in sync
func (*Syncer) PullFromRemote ¶
PullFromRemote pulls the config from the remote store without triggering any event. It's useful to initialize the config from the remote single source of truth.