Documentation
¶
Index ¶
- func IsStoreValueUnsetError(err error) bool
- type Iterator
- type StdIterator
- type StdStore
- func (s *StdStore) BeginTransaction() (Transaction, error)
- func (s *StdStore) Get(request string) ([]byte, error)
- func (s *StdStore) Iterator(prefix string) (Iterator, error)
- func (s *StdStore) LoadState() ([]byte, error)
- func (s *StdStore) Put(request string, requestData []byte) error
- func (s *StdStore) SetRecoveryData(recoveryData []byte)
- type Store
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsStoreValueUnsetError ¶
IsStoreValueUnsetError returns true if an error is of type storeValueUnset
Types ¶
type Iterator ¶
type Iterator interface {
// Returns the next element of the iterator
GetNext() (string, error)
// HasNext returns true if there is at least one more item after the current position
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)
Next implements the Iterator interface
func (*StdIterator) HasNext ¶
func (i *StdIterator) HasNext() bool
HasNext implements the Iterator interface
type StdStore ¶
type StdStore struct {
// contains filtered or unexported fields
}
StdStore is the standard implementation of the Store interface
func NewStdStore ¶
NewStdStore creates and initialises 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
func (*StdStore) SetRecoveryData ¶
SetRecoveryData sets the recovery data that is added to the sealed data.
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)
}
Store is the interface for persistence
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
// 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.