store

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: MPL-2.0 Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrValueUnset = errors.New("requested value not set")

ErrValueUnset is returned when a requested value is not set in the store.

Functions

This section is empty.

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 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)
	// SetEncryptionKey sets the encryption key for the store.
	SetEncryptionKey([]byte) error
	// SetRecoveryData sets recovery data for the store.
	SetRecoveryData([]byte)
	// LoadState loads the sealed state of a store.
	LoadState() ([]byte, 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
	// Delete removes a value from store by 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.

Directories

Path Synopsis
request defines constants used to access the store.
request defines constants used to access the store.

Jump to

Keyboard shortcuts

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