Documentation ¶
Index ¶
- Variables
- type SqliteStore
- func (s *SqliteStore) Close() error
- func (s *SqliteStore) DeleteRange(min, max uint64) error
- func (s *SqliteStore) FirstIndex() (uint64, error)
- func (s *SqliteStore) Get(k []byte) ([]byte, error)
- func (s *SqliteStore) GetLog(idx uint64, log *raft.Log) error
- func (s *SqliteStore) GetUint64(key []byte) (uint64, error)
- func (s *SqliteStore) LastIndex() (uint64, error)
- func (s *SqliteStore) Set(k, v []byte) error
- func (s *SqliteStore) SetUint64(key []byte, val uint64) error
- func (s *SqliteStore) StoreLog(log *raft.Log) error
- func (s *SqliteStore) StoreLogs(logs []*raft.Log) error
Constants ¶
This section is empty.
Variables ¶
var ( // An error indicating a given key does not exist ErrKeyNotFound = errors.New("not found") )
Functions ¶
This section is empty.
Types ¶
type SqliteStore ¶
type SqliteStore struct {
// contains filtered or unexported fields
}
SqliteStore provides a raft.LogStore to store and retrieve Raft log entries from a sqlite database. It also provides a raft.StableStore for storage of key/value pairs.
func NewStore ¶
func NewStore(path string) (*SqliteStore, error)
NewStore takes a file path and returns a connected Raft backend.
func (*SqliteStore) Close ¶
func (s *SqliteStore) Close() error
Close is used to gracefully close the DB connection.
func (*SqliteStore) DeleteRange ¶
func (s *SqliteStore) DeleteRange(min, max uint64) error
DeleteRange is used to delete logs within a given range inclusively.
func (*SqliteStore) FirstIndex ¶
func (s *SqliteStore) FirstIndex() (uint64, error)
FirstIndex returns the first known index from the Raft log.
func (*SqliteStore) Get ¶
func (s *SqliteStore) Get(k []byte) ([]byte, error)
Get is used to retrieve a value from the k/v store by key
func (*SqliteStore) GetLog ¶
func (s *SqliteStore) GetLog(idx uint64, log *raft.Log) error
GetLog is used to retrieve a log at a given index.
func (*SqliteStore) GetUint64 ¶
func (s *SqliteStore) GetUint64(key []byte) (uint64, error)
GetUint64 is like Get, but handles uint64 values
func (*SqliteStore) LastIndex ¶
func (s *SqliteStore) LastIndex() (uint64, error)
LastIndex returns the last known index from the Raft log.
func (*SqliteStore) Set ¶
func (s *SqliteStore) Set(k, v []byte) error
Set is used to set a key/value set outside of the raft log
func (*SqliteStore) SetUint64 ¶
func (s *SqliteStore) SetUint64(key []byte, val uint64) error
SetUint64 is like Set, but handles uint64 values