Documentation ¶
Overview ¶
Package kvdbsync implements the key-value data store client and server that satisfythe datasync API. The datasync API contains the Data Broker & KeyValProtoWatcher APIs, which are basically facades in front of different key-value or SQL stores.
A key-value store is used as a transport channel between a remote client and the agent(server). It stores data/configuration for multiple agents (servers). Therefore, a client only needs to know the address of the key-value store but not the addresses of individual agents. The client can write data/configuration independently of the agent's (server's) lifecycle.
The Data KeyValProtoWatcher is used during regular operation to efficiently propagate data/configuration changes from the key & value store to the agents (servers). Upon receiving a data change event, the watcher makes an incremental update to its data. When data resynchronization (RESYNC) is triggered, then the Data Broker is used to read all particular keys & values from the key-value store. Reading all particular keys & values is a more reliable but less efficient data synchronization method.
Index ¶
- type ChangeWatchResp
- func (ev *ChangeWatchResp) GetChangeType() datasync.PutDel
- func (ev *ChangeWatchResp) GetKey() string
- func (ev *ChangeWatchResp) GetPrevValue(prevVal proto.Message) (exists bool, err error)
- func (ev *ChangeWatchResp) GetRevision() (rev int64)
- func (ev *ChangeWatchResp) GetValue(val proto.Message) (err error)
- type Deps
- type Iterator
- type Plugin
- func (plugin *Plugin) AfterInit() error
- func (plugin *Plugin) Close() error
- func (plugin *Plugin) Init() error
- func (plugin *Plugin) Put(key string, data proto.Message, opts ...datasync.PutOption) error
- func (plugin *Plugin) String() string
- func (plugin *Plugin) Watch(resyncName string, changeChan chan datasync.ChangeEvent, ...) (datasync.WatchRegistration, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangeWatchResp ¶
type ChangeWatchResp struct { *syncbase.DoneChannel // contains filtered or unexported fields }
ChangeWatchResp is a structure that adapts the BytesWatchResp to the datasync api.
func NewChangeWatchResp ¶
func NewChangeWatchResp(delegate keyval.ProtoWatchResp, prevVal datasync.LazyValue) *ChangeWatchResp
NewChangeWatchResp creates a new instance of ChangeWatchResp.
func (*ChangeWatchResp) GetChangeType ¶
func (ev *ChangeWatchResp) GetChangeType() datasync.PutDel
GetChangeType - see the comment in implemented interface datasync.ChangeEvent
func (*ChangeWatchResp) GetKey ¶
func (ev *ChangeWatchResp) GetKey() string
GetKey returns the key associated with the change
func (*ChangeWatchResp) GetPrevValue ¶
func (ev *ChangeWatchResp) GetPrevValue(prevVal proto.Message) (exists bool, err error)
GetPrevValue delegates to WatchResp. For description of parameter and output values see the comment in implemented interface datasync.ChangeEvent
func (*ChangeWatchResp) GetRevision ¶
func (ev *ChangeWatchResp) GetRevision() (rev int64)
GetRevision returns revision associated with the change.
type Deps ¶
type Deps struct { localdeps.PluginInfraDeps // inject ResyncOrch resync.Subscriber // inject KvPlugin keyval.KvProtoPlugin // inject }
Deps is here to group injected dependencies of plugin to not mix with other plugin fields.
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator adapts the db_proto.KeyValIterator to the datasync.KeyValIterator
func NewIterator ¶
func NewIterator(delegate keyval.ProtoKeyValIterator) *Iterator
NewIterator creates a new instance of Iterator.
type Plugin ¶
type Plugin struct { Deps // inject // contains filtered or unexported fields }
Plugin dbsync implements Plugin interface
func (*Plugin) Watch ¶
func (plugin *Plugin) Watch(resyncName string, changeChan chan datasync.ChangeEvent, resyncChan chan datasync.ResyncEvent, keyPrefixes ...string) (datasync.WatchRegistration, error)
Watch using ETCD or any other Key Val data store.