Documentation ¶
Index ¶
- type ConsulKVStore
- type HashKVStore
- func (hkvs *HashKVStore) ClearFaults()
- func (hkvs *HashKVStore) DumpToFile() error
- func (hkvs *HashKVStore) Flush() error
- func (hkvs *HashKVStore) Get(key string) ([]byte, error)
- func (hkvs *HashKVStore) InjectFaults()
- func (hkvs *HashKVStore) List(key string) ([]*KVPair, error)
- func (hkvs *HashKVStore) LoadFromFile() error
- func (hkvs *HashKVStore) Put(key string, value []byte) error
- type KVPair
- type KVStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsulKVStore ¶
ConsulKVStore is an implementation of KVStore using Consul.
func NewConsulKVStore ¶
func NewConsulKVStore(u *url.URL) (*ConsulKVStore, error)
NewConsulKVStore creates a new instance of the ConsulKVStore
func (*ConsulKVStore) Flush ¶
func (kvs *ConsulKVStore) Flush() error
Flush is a no-op for consul backed KVStores
func (*ConsulKVStore) Get ¶
func (kvs *ConsulKVStore) Get(key string) ([]byte, error)
Get returns the value, if any, stored under the given key. A nil value is returned if not present in the KVS
type HashKVStore ¶
HashKVStore implements the KVStore interface using a hashmap
func NewHashKVStore ¶
func NewHashKVStore(backingFile string) (*HashKVStore, error)
NewHashKVStore creates a new HashKVStore
func (*HashKVStore) ClearFaults ¶
func (hkvs *HashKVStore) ClearFaults()
ClearFaults resets store to non-fault state
func (*HashKVStore) DumpToFile ¶
func (hkvs *HashKVStore) DumpToFile() error
DumpToFile writes the content of the kv store to the backing file configured for the store.
func (*HashKVStore) Flush ¶
func (hkvs *HashKVStore) Flush() error
Flush writes the KVStore in memory representation to disk.
func (*HashKVStore) Get ¶
func (hkvs *HashKVStore) Get(key string) ([]byte, error)
Get returns the value (if any) under the given key
func (*HashKVStore) InjectFaults ¶
func (hkvs *HashKVStore) InjectFaults()
InjectFaults forces Gets and Puts to return errors
func (*HashKVStore) List ¶
func (hkvs *HashKVStore) List(key string) ([]*KVPair, error)
List returns all the values (if any) stored under the given key
func (*HashKVStore) LoadFromFile ¶
func (hkvs *HashKVStore) LoadFromFile() error
LoadFromFile loads the flushed KVStore representation from file into memory
type KVStore ¶
type KVStore interface { Put(string, []byte) error Get(string) ([]byte, error) List(string) ([]*KVPair, error) Flush() error }
KVStore is implemented by all key value store providers
func NewKVStore ¶
NewKVStore instantiates a KV store implementation based on the url scheme associated with the given url