Documentation ¶
Index ¶
- Variables
- type BrokerWatcher
- func (pdb *BrokerWatcher) Delete(key string, opts ...datasync.DelOption) (existed bool, err error)
- func (pdb *BrokerWatcher) GetValue(key string) (data []byte, found bool, revision int64, err error)
- func (pdb *BrokerWatcher) ListKeys(prefix string) (keyval.BytesKeyIterator, error)
- func (pdb *BrokerWatcher) ListValues(key string) (keyval.BytesKeyValIterator, error)
- func (pdb *BrokerWatcher) NewTxn() keyval.BytesTxn
- func (pdb *BrokerWatcher) Put(key string, data []byte, opts ...datasync.PutOption) error
- func (pdb *BrokerWatcher) Watch(resp func(keyval.BytesWatchResp), closeChan chan string, keys ...string) error
- type Client
- func (c *Client) Close() error
- func (c *Client) Delete(key string, opts ...datasync.DelOption) (existed bool, err error)
- func (c *Client) GetDataForFile(path string) []*decoder.FileDataEntry
- func (c *Client) GetDataForKey(key string) (*decoder.FileDataEntry, bool)
- func (c *Client) GetPaths() []string
- func (c *Client) GetValue(key string) (data []byte, found bool, revision int64, err error)
- func (c *Client) ListKeys(prefix string) (keyval.BytesKeyIterator, error)
- func (c *Client) ListValues(prefix string) (keyval.BytesKeyValIterator, error)
- func (c *Client) NewBroker(prefix string) keyval.BytesBroker
- func (c *Client) NewTxn() keyval.BytesTxn
- func (c *Client) NewWatcher(prefix string) keyval.BytesWatcher
- func (c *Client) Put(key string, data []byte, opts ...datasync.PutOption) error
- func (c *Client) Watch(resp func(response keyval.BytesWatchResp), closeChan chan string, ...) error
- type Config
- type Deps
- type Option
- type Plugin
- func (p *Plugin) AfterInit() error
- func (p *Plugin) Close() error
- func (p *Plugin) Disabled() bool
- func (p *Plugin) Init() error
- func (p *Plugin) NewBroker(keyPrefix string) keyval.ProtoBroker
- func (p *Plugin) NewWatcher(keyPrefix string) keyval.ProtoWatcher
- func (p *Plugin) OnConnect(callback func() error)
- func (p *Plugin) String() string
Constants ¶
This section is empty.
Variables ¶
var DefaultPlugin = *NewPlugin()
DefaultPlugin is a default instance of Plugin.
Functions ¶
This section is empty.
Types ¶
type BrokerWatcher ¶
type BrokerWatcher struct { *Client // contains filtered or unexported fields }
BrokerWatcher implements CoreBrokerWatcher and provides broker/watcher constructors with client
func (*BrokerWatcher) Delete ¶
Delete calls client's 'Delete' method
func (*BrokerWatcher) GetValue ¶
GetValue calls client's 'GetValue' method
func (*BrokerWatcher) ListKeys ¶
func (pdb *BrokerWatcher) ListKeys(prefix string) (keyval.BytesKeyIterator, error)
ListKeys returns a list of all database keys for given prefix
func (*BrokerWatcher) ListValues ¶
func (pdb *BrokerWatcher) ListValues(key string) (keyval.BytesKeyValIterator, error)
ListValues returns a list of all database values for given key
func (*BrokerWatcher) NewTxn ¶
func (pdb *BrokerWatcher) NewTxn() keyval.BytesTxn
NewTxn calls client's 'NewTxn' method
func (*BrokerWatcher) Put ¶
Put calls client's 'Put' method
func (*BrokerWatcher) Watch ¶
func (pdb *BrokerWatcher) Watch(resp func(keyval.BytesWatchResp), closeChan chan string, keys ...string) error
Watch augments watcher's response and removes prefix from it
type Client ¶
Client arranges communication between file system and internal database, and is also responsible for upstream events.
func NewClient ¶
func NewClient(cfgPaths []string, statusPath string, dcs []decoder.API, fsh filesystem.API, log logging.Logger) (*Client, error)
NewClient initializes file watcher, database and registers paths provided via plugin configuration file
func (*Client) Delete ¶
Delete is not allowed for fileDB, configuration file is read-only
func (*Client) GetDataForFile ¶
func (c *Client) GetDataForFile(path string) []*decoder.FileDataEntry
GetDataForFile returns data gor given file
func (*Client) GetDataForKey ¶
func (c *Client) GetDataForKey(key string) (*decoder.FileDataEntry, bool)
GetDataForKey returns data gor given file
func (*Client) GetValue ¶
GetValue returns a value for given key
func (*Client) ListKeys ¶
func (c *Client) ListKeys(prefix string) (keyval.BytesKeyIterator, error)
ListKeys returns a set of keys for given prefix
func (*Client) ListValues ¶
func (c *Client) ListValues(prefix string) (keyval.BytesKeyValIterator, error)
ListValues returns a list of values for given prefix
func (*Client) NewBroker ¶
func (c *Client) NewBroker(prefix string) keyval.BytesBroker
NewBroker provides BytesBroker object with client and given prefix
func (*Client) NewTxn ¶
NewTxn is not supported, filesystem plugin does not allow to do changes to the configuration
func (*Client) NewWatcher ¶
func (c *Client) NewWatcher(prefix string) keyval.BytesWatcher
NewWatcher provides BytesWatcher object with client and given prefix
func (*Client) Put ¶
Put reads status file, add data to it and performs write
type Config ¶
type Config struct { ConfigPaths []string `json:"configuration-paths"` StatusPath string `json:"status-path"` }
Config is fileDB configuration file structure
type Option ¶
type Option func(*Plugin)
Option is a function that can be used in NewPlugin to customize Plugin.
type Plugin ¶
type Plugin struct { Deps // contains filtered or unexported fields }
Plugin filesystem uses host os file system as database to store configuration.
func NewPlugin ¶
NewPlugin creates a new Plugin with the provided Options.
func (*Plugin) AfterInit ¶
AfterInit starts file system event watcher
func (*Plugin) Disabled ¶
Disabled returns flag whether plugin is disabled
func (*Plugin) Init ¶
Init reads file config and creates new client to communicate with file system
func (*Plugin) NewBroker ¶
func (p *Plugin) NewBroker(keyPrefix string) keyval.ProtoBroker
NewBroker returns new broker created by proto wrapper
func (*Plugin) NewWatcher ¶
func (p *Plugin) NewWatcher(keyPrefix string) keyval.ProtoWatcher
NewWatcher returns new watcher created by proto wrapper
func (*Plugin) OnConnect ¶
OnConnect executes datasync callback