persistent

package
v0.2011.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 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

This section is empty.

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