Documentation ¶
Overview ¶
Package persistent provides a wrapper around a key-value database for use as general node-wide storage.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("persistent: key not found in database")
ErrNotFound is returned when the requested key could not be found in the database.
Functions ¶
func GetPersistentStoreDBDir ¶ added in v0.2102.0
GetPersistentStoreDBDir returns the database directory path for the node with the given data directory.
Types ¶
type CommonStore ¶
type CommonStore struct {
// contains filtered or unexported fields
}
CommonStore is the interface to the common storage for the node.
func NewCommonStore ¶
func NewCommonStore(dataDir string) (*CommonStore, error)
NewCommonStore opens the default common node storage and returns a handle.
func (*CommonStore) GetServiceStore ¶
func (cs *CommonStore) GetServiceStore(name string) *ServiceStore
GetServiceStore returns a handle to a per-service bucket for the given service.
type ServiceStore ¶
type ServiceStore struct {
// contains filtered or unexported fields
}
ServiceStore is a storage wrapper that automatically calls view callbacks with appropriate buckets.
func (*ServiceStore) Close ¶
func (ss *ServiceStore) Close()
Close invalidates the per-service database handle.
func (*ServiceStore) Delete ¶
func (ss *ServiceStore) Delete(key []byte) error
Delete removes the specified key from the service store.
func (*ServiceStore) GetCBOR ¶
func (ss *ServiceStore) GetCBOR(key []byte, value interface{}) error
GetCBOR is a helper for retrieving CBOR-serialized values.
func (*ServiceStore) PutCBOR ¶
func (ss *ServiceStore) PutCBOR(key []byte, value interface{}) error
PutCBOR is a helper for storing CBOR-serialized values.