Documentation ¶
Index ¶
- type EtcdIterator
- type EtcdStore
- func (s *EtcdStore) BeginTransaction() (Transaction, error)
- func (s *EtcdStore) Close() error
- func (s *EtcdStore) Delete(key string) error
- func (s *EtcdStore) Get(request string) ([]byte, error)
- func (s *EtcdStore) Iterator(prefix string) (Iterator, error)
- func (s *EtcdStore) Put(request string, requestData []byte) error
- func (s *EtcdStore) Transfer(_ Store) error
- type EtcdStoreFactory
- type EtcdTransaction
- func (t *EtcdTransaction) Commit() error
- func (t *EtcdTransaction) Delete(key string) error
- func (t *EtcdTransaction) Get(request string) ([]byte, error)
- func (t *EtcdTransaction) Iterator(prefix string) (Iterator, error)
- func (t *EtcdTransaction) Put(request string, requestData []byte) error
- func (t *EtcdTransaction) Rollback()
- type Iterator
- type StdIterator
- type StdStore
- func (s *StdStore) BeginTransaction() (Transaction, error)
- func (s *StdStore) Delete(key string) error
- func (s *StdStore) Get(request string) ([]byte, error)
- func (s *StdStore) Iterator(prefix string) (Iterator, error)
- func (s *StdStore) Put(request string, requestData []byte) error
- func (s *StdStore) Transfer(newstore Store) error
- type Store
- type Transaction
- type ValueUnsetError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EtcdIterator ¶
type EtcdIterator struct {
// contains filtered or unexported fields
}
EtcdIterator is an iterator for etcdstore.
func (*EtcdIterator) GetNext ¶
func (i *EtcdIterator) GetNext() (string, error)
GetNext gets the next element.
func (*EtcdIterator) HasNext ¶
func (i *EtcdIterator) HasNext() bool
HasNext returns true if there are elements left to get with GetNext().
type EtcdStore ¶
type EtcdStore struct {
// contains filtered or unexported fields
}
EtcdStore is a store that uses etcd as a backend.
func NewEtcdStore ¶
func NewEtcdStore(endpoints []string, logger *zap.Logger, caCert, cert, key []byte) (*EtcdStore, error)
NewEtcdStore creates a new EtcdStore.
func (*EtcdStore) BeginTransaction ¶
func (s *EtcdStore) BeginTransaction() (Transaction, error)
BeginTransaction starts a new transaction.
type EtcdStoreFactory ¶
type EtcdStoreFactory struct { Endpoint string ForceTLS bool Logger *zap.Logger // contains filtered or unexported fields }
EtcdStoreFactory is a factory to create EtcdStores.
func (*EtcdStoreFactory) New ¶
func (f *EtcdStoreFactory) New() (Store, error)
New creates a new EtcdStore.
type EtcdTransaction ¶
type EtcdTransaction struct {
// contains filtered or unexported fields
}
EtcdTransaction is a transaction that uses etcd as a backend.
func (*EtcdTransaction) Commit ¶
func (t *EtcdTransaction) Commit() error
Commit ends a transaction and persists the changes.
func (*EtcdTransaction) Delete ¶
func (t *EtcdTransaction) Delete(key string) error
Delete deletes the key if it exists. Only errors if there is no ongoing Transaction.
func (*EtcdTransaction) Get ¶
func (t *EtcdTransaction) Get(request string) ([]byte, error)
Get retrieves a value from EtcdTransaction by Name.
func (*EtcdTransaction) Iterator ¶
func (t *EtcdTransaction) Iterator(prefix string) (Iterator, error)
Iterator returns an iterator for all keys in the transaction with a given prefix.
func (*EtcdTransaction) Put ¶
func (t *EtcdTransaction) Put(request string, requestData []byte) error
Put saves a value.
func (*EtcdTransaction) Rollback ¶
func (t *EtcdTransaction) Rollback()
Rollback aborts a transaction.
type Iterator ¶
type Iterator interface { // GetNext returns the next element of the iterator. GetNext() (string, error) // HasNext returns true if there are elements left to get with GetNext(). HasNext() bool }
Iterator is an iterator for the store.
type StdIterator ¶
type StdIterator struct {
// contains filtered or unexported fields
}
StdIterator is the standard Iterator implementation.
func (*StdIterator) GetNext ¶
func (i *StdIterator) GetNext() (string, error)
GetNext returns the next element of the iterator.
func (*StdIterator) HasNext ¶
func (i *StdIterator) HasNext() bool
HasNext returns true if there are elements left to get with GetNext().
type StdStore ¶
type StdStore struct {
// contains filtered or unexported fields
}
StdStore is the standard implementation of the Store interface.
func NewStdStore ¶
func NewStdStore() *StdStore
NewStdStore creates and initializes a new StdStore object.
func (*StdStore) BeginTransaction ¶
func (s *StdStore) BeginTransaction() (Transaction, error)
BeginTransaction starts a new transaction.
func (*StdStore) Iterator ¶
Iterator returns an iterator for keys saved in StdStore with a given prefix. For an empty prefix this is an iterator for all keys in StdStore.
type Store ¶
type Store interface { // BeginTransaction starts a new transaction. BeginTransaction() (Transaction, error) // Get returns a value from store by key. Get(string) ([]byte, error) // Put saves a value to store by key. Put(string, []byte) error // Iterator returns an Iterator for a given prefix. Iterator(string) (Iterator, error) // Transfer copies the whole store Database. Transfer(Store) error // Delete deletes the key. Delete(string) error }
Store is the interface for persistent store. Currently two backends are supported, stdstore (mainly for testing) and etcd for production.
type Transaction ¶
type Transaction interface { // Get returns a value from store by key. Get(string) ([]byte, error) // Put saves a value to store by key. Put(string, []byte) error // Delete deletes the key. Delete(string) error // Iterator returns an Iterator for a given prefix. Iterator(string) (Iterator, error) // Commit ends a transaction and persists the changes. Commit() error // Rollback aborts a transaction. Noop if already committed. Rollback() }
Transaction is a Store transaction.
type ValueUnsetError ¶
type ValueUnsetError struct {
// contains filtered or unexported fields
}
ValueUnsetError is an error raised by unset values in the store.
func (*ValueUnsetError) Error ¶
func (s *ValueUnsetError) Error() string
Error implements the Error interface.