Documentation
¶
Index ¶
- Variables
- type Level
- type LevelDBStore
- func (b *LevelDBStore) Close() error
- func (b *LevelDBStore) DeleteRange(min, max uint64) error
- func (b *LevelDBStore) FirstIndex() (uint64, error)
- func (b *LevelDBStore) Get(k []byte) ([]byte, error)
- func (b *LevelDBStore) GetLog(idx uint64, log *raft.Log) error
- func (b *LevelDBStore) GetUint64(key []byte) (uint64, error)
- func (b *LevelDBStore) LastIndex() (uint64, error)
- func (b *LevelDBStore) Set(k, v []byte) error
- func (b *LevelDBStore) SetUint64(key []byte, val uint64) error
- func (b *LevelDBStore) StoreLog(log *raft.Log) error
- func (b *LevelDBStore) StoreLogs(logs []*raft.Log) error
Constants ¶
This section is empty.
Variables ¶
var ErrClosed = errors.New("closed")
ErrClosed is returned when the log is closed
var ErrCorrupt = errors.New("corrupt")
ErrCorrupt is returned when the log is corrup
var ErrKeyNotFound = errors.New("not found")
ErrKeyNotFound is returned when a given key does not exist
Functions ¶
This section is empty.
Types ¶
type LevelDBStore ¶
type LevelDBStore struct {
// contains filtered or unexported fields
}
LevelDBStore 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 NewLevelDBStore ¶
func NewLevelDBStore(path string, durability Level) (*LevelDBStore, error)
NewLevelDBStore takes a file path and returns a connected Raft backend.
func (*LevelDBStore) Close ¶
func (b *LevelDBStore) Close() error
Close is used to gracefully close the DB connection.
func (*LevelDBStore) DeleteRange ¶
func (b *LevelDBStore) DeleteRange(min, max uint64) error
DeleteRange is used to delete logs within a given range inclusively.
func (*LevelDBStore) FirstIndex ¶
func (b *LevelDBStore) FirstIndex() (uint64, error)
FirstIndex returns the first known index from the Raft log.
func (*LevelDBStore) Get ¶
func (b *LevelDBStore) Get(k []byte) ([]byte, error)
Get is used to retrieve a value from the k/v store by key
func (*LevelDBStore) GetLog ¶
func (b *LevelDBStore) GetLog(idx uint64, log *raft.Log) error
GetLog is used to retrieve a log from BoltDB at a given index.
func (*LevelDBStore) GetUint64 ¶
func (b *LevelDBStore) GetUint64(key []byte) (uint64, error)
GetUint64 is like Get, but handles uint64 values
func (*LevelDBStore) LastIndex ¶
func (b *LevelDBStore) LastIndex() (uint64, error)
LastIndex returns the last known index from the Raft log.
func (*LevelDBStore) Set ¶
func (b *LevelDBStore) Set(k, v []byte) error
Set is used to set a key/value set outside of the raft log
func (*LevelDBStore) SetUint64 ¶
func (b *LevelDBStore) SetUint64(key []byte, val uint64) error
SetUint64 is like Set, but handles uint64 values