kvdbsync

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2017 License: Apache-2.0 Imports: 9 Imported by: 84

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

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.

func (*ChangeWatchResp) GetValue

func (ev *ChangeWatchResp) GetValue(val proto.Message) (err error)

GetValue delegates to WatchResp. For description of parameter and output values see the comment in implemented interface datasync.ChangeEvent

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.

func (*Iterator) GetNext

func (it *Iterator) GetNext() (kv datasync.KeyVal, stop bool)

GetNext just delegate GetNext

type Plugin

type Plugin struct {
	Deps // inject
	// contains filtered or unexported fields
}

Plugin dbsync implements Plugin interface

func (*Plugin) AfterInit

func (plugin *Plugin) AfterInit() error

AfterInit uses provided connection to build new transport watcher

func (*Plugin) Close

func (plugin *Plugin) Close() error

Close resources

func (*Plugin) Init

func (plugin *Plugin) Init() error

Init does nothing

func (*Plugin) Put

func (plugin *Plugin) Put(key string, data proto.Message, opts ...datasync.PutOption) error

Put to ETCD or any other data transport (from other Agent Plugins)

func (*Plugin) String

func (plugin *Plugin) String() string

String returns if set Deps.PluginName or "kvdbsync" otherwise

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.

Directories

Path Synopsis
Package local implements DB Transactions for the local "in memory" transport.
Package local implements DB Transactions for the local "in memory" transport.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL