Documentation ¶
Index ¶
- Variables
- type Options
- type PebbleStore
- func (b *PebbleStore) Close() error
- func (b *PebbleStore) DeleteRange(min, max uint64) error
- func (b *PebbleStore) FirstIndex() (uint64, error)
- func (b *PebbleStore) Get(k []byte) ([]byte, error)
- func (b *PebbleStore) GetLog(idx uint64, log *raft.Log) error
- func (b *PebbleStore) GetUint64(key []byte) (uint64, error)
- func (b *PebbleStore) LastIndex() (uint64, error)
- func (b *PebbleStore) Metrics() *pebble.Metrics
- func (b *PebbleStore) Set(k, v []byte) error
- func (b *PebbleStore) SetUint64(key []byte, val uint64) error
- func (b *PebbleStore) StoreLog(log *raft.Log) error
- func (b *PebbleStore) StoreLogs(logs []*raft.Log) error
- func (b *PebbleStore) Sync() error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrKeyNotFound indicates a given key does not exist ErrKeyNotFound = errors.New("not found") )
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { // Path is the file path Path string // PebbleOptions contains any specific pebble options you might // want to specify [e.g. open timeout] PebbleOptions *pebble.Options }
Options contains all the configuration used to open the database
type PebbleStore ¶
type PebbleStore struct {
// contains filtered or unexported fields
}
PebbleStore provides access to pebble 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 ¶
func New(options Options) (*PebbleStore, error)
New uses the supplied options to open the pebble db and prepare it for use as a raft backend.
func NewPebbleStore ¶
func NewPebbleStore(path string) (*PebbleStore, error)
NewPebbleStore takes a path and returns a connected Raft backend.
func (*PebbleStore) Close ¶
func (b *PebbleStore) Close() error
Close is used to gracefully close the DB connection.
func (*PebbleStore) DeleteRange ¶
func (b *PebbleStore) DeleteRange(min, max uint64) error
DeleteRange is used to delete logs within a given range inclusively.
func (*PebbleStore) FirstIndex ¶
func (b *PebbleStore) FirstIndex() (uint64, error)
FirstIndex returns the first known index from the Raft log.
func (*PebbleStore) Get ¶
func (b *PebbleStore) Get(k []byte) ([]byte, error)
Get is used to retrieve a value from the k/v store by key
func (*PebbleStore) GetLog ¶
func (b *PebbleStore) GetLog(idx uint64, log *raft.Log) error
GetLog is used to retrieve a log from pebble at a given index.
func (*PebbleStore) GetUint64 ¶
func (b *PebbleStore) GetUint64(key []byte) (uint64, error)
GetUint64 is like Get, but handles uint64 values
func (*PebbleStore) LastIndex ¶
func (b *PebbleStore) LastIndex() (uint64, error)
LastIndex returns the last known index from the Raft log.
func (*PebbleStore) Metrics ¶
func (b *PebbleStore) Metrics() *pebble.Metrics
func (*PebbleStore) Set ¶
func (b *PebbleStore) Set(k, v []byte) error
Set is used to set a key/value outside of the raft log
func (*PebbleStore) SetUint64 ¶
func (b *PebbleStore) SetUint64(key []byte, val uint64) error
SetUint64 is like Set, but handles uint64 values
func (*PebbleStore) StoreLog ¶
func (b *PebbleStore) StoreLog(log *raft.Log) error
StoreLog is used to store a single raft log
func (*PebbleStore) StoreLogs ¶
func (b *PebbleStore) StoreLogs(logs []*raft.Log) error
StoreLogs is used to store a set of raft logs
func (*PebbleStore) Sync ¶
func (b *PebbleStore) 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.