store

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MPL-2.0 Imports: 2 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(context.Context) (Transaction, 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(context.Context) 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.
testutil
Package testutil provides utility functions to access store values in unit tests.
Package testutil provides utility functions to access store values in unit tests.

Jump to

Keyboard shortcuts

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