vault: github.com/hashicorp/vault/physical/raft/logstore Index | Files

package logstore

import "github.com/hashicorp/vault/physical/raft/logstore"

Index

Package Files

bolt_store.go util.go

Variables

var (

    // An error indicating a given key does not exist
    ErrKeyNotFound = errors.New("not found")
)

type BoltStore Uses

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

BoltStore provides access to BoltDB for Raft to store and retrieve log entries. It also provides key/value storage, and can be used as a LogStore and StableStore.

func New Uses

func New(options Options) (*BoltStore, error)

New uses the supplied options to open the BoltDB and prepare it for use as a raft backend.

func NewBoltStore Uses

func NewBoltStore(path string) (*BoltStore, error)

NewBoltStore takes a file path and returns a connected Raft backend.

func (*BoltStore) Close Uses

func (b *BoltStore) Close() error

Close is used to gracefully close the DB connection.

func (*BoltStore) DeleteRange Uses

func (b *BoltStore) DeleteRange(min, max uint64) error

DeleteRange is used to delete logs within a given range inclusively.

func (*BoltStore) FirstIndex Uses

func (b *BoltStore) FirstIndex() (uint64, error)

FirstIndex returns the first known index from the Raft log.

func (*BoltStore) Get Uses

func (b *BoltStore) Get(k []byte) ([]byte, error)

Get is used to retrieve a value from the k/v store by key

func (*BoltStore) GetLog Uses

func (b *BoltStore) GetLog(idx uint64, log *raft.Log) error

GetLog is used to retrieve a log from BoltDB at a given index.

func (*BoltStore) GetUint64 Uses

func (b *BoltStore) GetUint64(key []byte) (uint64, error)

GetUint64 is like Get, but handles uint64 values

func (*BoltStore) LastIndex Uses

func (b *BoltStore) LastIndex() (uint64, error)

LastIndex returns the last known index from the Raft log.

func (*BoltStore) Set Uses

func (b *BoltStore) Set(k, v []byte) error

Set is used to set a key/value set outside of the raft log

func (*BoltStore) SetUint64 Uses

func (b *BoltStore) SetUint64(key []byte, val uint64) error

SetUint64 is like Set, but handles uint64 values

func (*BoltStore) StoreLog Uses

func (b *BoltStore) StoreLog(log *raft.Log) error

StoreLog is used to store a single raft log

func (*BoltStore) StoreLogs Uses

func (b *BoltStore) StoreLogs(logs []*raft.Log) error

StoreLogs is used to store a set of raft logs

func (*BoltStore) Sync Uses

func (b *BoltStore) Sync() error

Sync performs an fsync on the database file handle. This is not necessary under normal operation unless NoSync is enabled, in which this forces the database file to sync against the disk.

type Options Uses

type Options struct {
    // Path is the file path to the BoltDB to use
    Path string

    // BoltOptions contains any specific BoltDB options you might
    // want to specify [e.g. open timeout]
    BoltOptions *bolt.Options

    // NoSync causes the database to skip fsync calls after each
    // write to the log. This is unsafe, so it should be used
    // with caution.
    NoSync bool
}

Options contains all the configuration used to open the BoltDB

Package logstore imports 6 packages (graph) and is imported by 2 packages. Updated 2019-08-12. Refresh now. Tools for package owners.