persistent

package
v0.2103.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

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

View Source
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

func GetPersistentStoreDBDir(dataDir string) string

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) Close

func (cs *CommonStore) Close()

Close closes the database handle.

func (*CommonStore) GetServiceStore

func (cs *CommonStore) GetServiceStore(name string) (*ServiceStore, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL