Documentation ¶
Index ¶
- Variables
- type BoltStore
- func (b *BoltStore) Add(k, v []byte) error
- func (b *BoltStore) Close() error
- func (b *BoltStore) DeleteRange(min, max uint64) error
- func (b *BoltStore) FirstIndex() (uint64, error)
- func (b *BoltStore) Get(k []byte) ([]byte, error)
- func (b *BoltStore) GetLog(idx uint64, log *raft.Log) error
- func (b *BoltStore) GetUint64(key []byte) (uint64, error)
- func (b *BoltStore) LastIndex() (uint64, error)
- func (b *BoltStore) Set(k, v []byte) error
- func (b *BoltStore) SetUint64(key []byte, val uint64) error
- func (b *BoltStore) StoreLog(log *raft.Log) error
- func (b *BoltStore) StoreLogs(logs []*raft.Log) error
- type Options
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrKeyNotFound error indicating a given key does not exist ErrKeyNotFound = errors.New("not found") // ErrKeyDuplicated error for duplicated set ErrKeyDuplicated = errors.New("key duplicated") )
Functions ¶
This section is empty.
Types ¶
type BoltStore ¶
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 ¶
New uses the supplied options to open the BoltDB and prepare it for use as a raft backend.
func NewBoltStore ¶
NewBoltStore takes a file path and returns a connected Raft backend.
func (*BoltStore) Add ¶
Add is used to set a key/value set. Return ErrKeyDuplicated error if k has been set.
func (*BoltStore) DeleteRange ¶
DeleteRange is used to delete logs within a given range inclusively.
func (*BoltStore) FirstIndex ¶
FirstIndex returns the first known index from the Raft log.
Click to show internal directories.
Click to hide internal directories.