metadb

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FileName is the default file name for the bolt db file.
	FileName = "wal-meta.db"

	// *Bucket are the names used for internal bolt buckets
	MetaBucket   = "wal-meta"
	StableBucket = "stable"

	// We just need one key for now so use the byte 'm' for meta arbitrarily.
	MetaKey = "m"
)

Variables

View Source
var (
	// ErrUnintialized is returned when any call is made before Load has opened
	// the DB file.
	ErrUnintialized = errors.New("uninitialized")
)

Functions

This section is empty.

Types

type BoltMetaDB

type BoltMetaDB struct {
	// contains filtered or unexported fields
}

BoltMetaDB implements types.MetaStore using BoltDB as a reliable persistent store. See repo README for reasons for this design choice and performance implications.

func (*BoltMetaDB) Close

func (db *BoltMetaDB) Close() error

Close implements io.Closer

func (*BoltMetaDB) CommitState

func (db *BoltMetaDB) CommitState(state types.PersistentState) error

CommitState must atomically replace all persisted metadata in the current store with the set provided. It must not return until the data is persisted durably and in a crash-safe way otherwise the guarantees of the WAL will be compromised. The WAL will only ever call this in a single thread at one time and it will never be called concurrently with Load however it may be called concurrently with Get/SetStable operations.

func (*BoltMetaDB) GetStable

func (db *BoltMetaDB) GetStable(key []byte) ([]byte, error)

GetStable returns a value from stable store or nil if it doesn't exist. May be called concurrently by multiple threads.

func (*BoltMetaDB) Load

func (db *BoltMetaDB) Load(dir string) (types.PersistentState, error)

Load loads the existing persisted state. If there is no existing state implementations are expected to create initialize new storage and return an empty state.

func (*BoltMetaDB) SetStable

func (db *BoltMetaDB) SetStable(key []byte, value []byte) error

SetStable stores a value from stable store. May be called concurrently with GetStable.

Jump to

Keyboard shortcuts

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