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(keyPrefix string) (keyval.BytesKeyIterator, error)
- func (pdb *BrokerWatcher) ListValues(keyPrefix 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 (client *Client) Close() error
- func (client *Client) Delete(key string, opts ...datasync.DelOption) (existed bool, err error)
- func (client *Client) GetValue(key string) (data []byte, found bool, revision int64, err error)
- func (client *Client) ListKeys(keyPrefix string) (keyval.BytesKeyIterator, error)
- func (client *Client) ListValues(keyPrefix string) (keyval.BytesKeyValIterator, error)
- func (client *Client) NewBroker(prefix string) keyval.BytesBroker
- func (client *Client) NewTxn() keyval.BytesTxn
- func (client *Client) NewWatcher(prefix string) keyval.BytesWatcher
- func (client *Client) Put(key string, data []byte, opts ...datasync.PutOption) error
- func (client *Client) Watch(resp func(keyval.BytesWatchResp), closeChan chan string, keys ...string) error
- type Config
- type Deps
- type Option
- type Plugin
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 uses Client to access the datastore. The connection can be shared among multiple BrokerWatcher. In case of accessing a particular subtree in Bolt only, BrokerWatcher allows defining a keyPrefix that is prepended to all keys in its methods in order to shorten keys used in arguments.
func (*BrokerWatcher) Delete ¶
Delete calls 'Delete' function of the underlying Client. KeyPrefix defined in constructor is prepended to the key argument.
func (*BrokerWatcher) GetValue ¶
GetValue calls 'GetValue' function of the underlying Client. KeyPrefix defined in constructor is prepended to the key argument.
func (*BrokerWatcher) ListKeys ¶
func (pdb *BrokerWatcher) ListKeys(keyPrefix string) (keyval.BytesKeyIterator, error)
ListKeys calls 'ListKeys' function of the underlying Client. KeyPrefix defined in constructor is prepended to the argument.
func (*BrokerWatcher) ListValues ¶
func (pdb *BrokerWatcher) ListValues(keyPrefix string) (keyval.BytesKeyValIterator, error)
ListValues calls 'ListValues' function of the underlying Client. KeyPrefix defined in constructor is prepended to the key argument. The prefix is removed from the keys of the returned values.
func (*BrokerWatcher) NewTxn ¶
func (pdb *BrokerWatcher) NewTxn() keyval.BytesTxn
NewTxn creates a new transaction. KeyPrefix defined in constructor will be prepended to all key arguments in the transaction.
func (*BrokerWatcher) Put ¶
Put calls 'Put' function of the underlying Client. KeyPrefix defined in constructor is prepended to the key argument.
func (*BrokerWatcher) Watch ¶
func (pdb *BrokerWatcher) Watch(resp func(keyval.BytesWatchResp), closeChan chan string, keys ...string) error
Watch starts subscription for changes associated with the selected <keys>. KeyPrefix defined in constructor is prepended to all <keys> in the argument list. The prefix is removed from the keys returned in watch events. Watch events will be delivered to <resp> callback.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client serves as a client for Bolt KV storage and implements keyval.CoreBrokerWatcher interface.
func NewClient ¶
NewClient creates new client for Bolt using given config.
func (*Client) Delete ¶
Delete deletes given key
func (*Client) GetValue ¶
GetValue returns data for the given key
func (*Client) ListKeys ¶
func (client *Client) ListKeys(keyPrefix string) (keyval.BytesKeyIterator, error)
ListKeys returns iterator with keys for given key prefix
func (*Client) ListValues ¶
func (client *Client) ListValues(keyPrefix string) (keyval.BytesKeyValIterator, error)
ListValues returns iterator with key-value pairs for given key prefix
func (*Client) NewBroker ¶
func (client *Client) NewBroker(prefix string) keyval.BytesBroker
NewBroker creates a new instance of a proxy that provides access to Bolt. The proxy will reuse the connection from Client. <prefix> will be prepended to the key argument in all calls from the created BrokerWatcher. To avoid using a prefix, pass keyval. Root constant as an argument.
func (*Client) NewTxn ¶
NewTxn creates new transaction
func (*Client) NewWatcher ¶
func (client *Client) NewWatcher(prefix string) keyval.BytesWatcher
NewWatcher creates a new instance of a proxy that provides access to Bolt. The proxy will reuse the connection from Client. <prefix> will be prepended to the key argument in all calls on created BrokerWatcher. To avoid using a prefix, pass keyval. Root constant as an argument.
func (*Client) Put ¶
Put stores given data for the key
type Config ¶
type Config struct { DbPath string `json:"db-path"` FileMode os.FileMode `json:"file-mode"` LockTimeout time.Duration `json:"lock-timeout"` }
Config represents configuration for Bolt plugin.
type Deps ¶
type Deps struct {
infra.PluginDeps
}
Deps lists dependencies of the Bolt plugin. If injected, Bolt plugin will use StatusCheck to signal the connection status.
type Option ¶
type Option func(*Plugin)
Option is a function that can be used in NewPlugin to customize Plugin.
type Plugin ¶
Plugin implements bolt plugin.
func NewPlugin ¶
NewPlugin creates a new Plugin with the provided Options.
func (*Plugin) Disabled ¶
Disabled returns *true* if the plugin is not in use due to missing configuration.
func (*Plugin) NewBroker ¶
func (p *Plugin) NewBroker(keyPrefix string) keyval.ProtoBroker
NewBroker creates new instance of prefixed broker that provides API with arguments of type proto.Message.
func (*Plugin) NewWatcher ¶
func (p *Plugin) NewWatcher(keyPrefix string) keyval.ProtoWatcher
NewWatcher creates new instance of prefixed broker that provides API with arguments of type proto.Message.