store

package
v0.0.0-...-8253ce3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyNotFound = errors.New("not found")

Functions

This section is empty.

Types

type LogStore

type LogStore struct {
	Conn *badger.DB
}

func NewLogStore

func NewLogStore(path string) (*LogStore, error)

func (*LogStore) DeleteRange

func (store *LogStore) DeleteRange(min, max uint64) error

DeleteRange deletes a range of log entries. The range is inclusive.

func (*LogStore) FirstIndex

func (store *LogStore) FirstIndex() (uint64, error)

FirstIndex returns the first index written. 0 for no entries.

func (*LogStore) GetLog

func (store *LogStore) GetLog(index uint64, log *raft.Log) error

GetLog gets a log entry at a given index.

func (*LogStore) LastIndex

func (store *LogStore) LastIndex() (uint64, error)

LastIndex returns the last index written. 0 for no entries.

func (*LogStore) StoreLog

func (store *LogStore) StoreLog(log *raft.Log) error

StoreLog stores a log entry.

func (*LogStore) StoreLogs

func (store *LogStore) StoreLogs(logs []*raft.Log) error

StoreLogs stores multiple log entries.

type StableStore

type StableStore struct {
	Conn *badger.DB
}

func NewStableStore

func NewStableStore(path string) (*StableStore, error)

func (*StableStore) Get

func (store *StableStore) Get(key []byte) ([]byte, error)

Get returns the value for key, or an empty byte slice if key was not found.

func (*StableStore) GetUint64

func (store *StableStore) GetUint64(key []byte) (uint64, error)

GetUint64 returns the uint64 value for key, or 0 if key was not found.

func (*StableStore) Set

func (store *StableStore) Set(key, val []byte) error

Set is used to set a key/value set

func (*StableStore) SetUint64

func (store *StableStore) SetUint64(key []byte, val uint64) error

SetUint64 is like Set, but handles uint64 values

Jump to

Keyboard shortcuts

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