Documentation ¶
Index ¶
- Variables
- type Sqlite3Store
- func (s *Sqlite3Store) Close() error
- func (s *Sqlite3Store) DeleteRange(min, max uint64) error
- func (s *Sqlite3Store) FirstIndex() (uint64, error)
- func (s *Sqlite3Store) Get(k []byte) ([]byte, error)
- func (s *Sqlite3Store) GetLog(idx uint64, log *raft.Log) error
- func (s *Sqlite3Store) GetUint64(key []byte) (uint64, error)
- func (s *Sqlite3Store) LastIndex() (uint64, error)
- func (s *Sqlite3Store) Set(k, v []byte) error
- func (s *Sqlite3Store) SetUint64(key []byte, val uint64) error
- func (s *Sqlite3Store) StoreLog(log *raft.Log) error
- func (s *Sqlite3Store) StoreLogs(logs []*raft.Log) (err 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 Sqlite3Store ¶
type Sqlite3Store struct {
// contains filtered or unexported fields
}
Sqlite3Store provides access to sqlite3 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(dataSourceName string) (*Sqlite3Store, error)
New uses the supplied dataSourceName to open the sqlite3 and prepare it for use as a raft backend.
func NewSqlite3Store ¶
func NewSqlite3Store(dataSourceName string) (*Sqlite3Store, error)
func (*Sqlite3Store) Close ¶
func (s *Sqlite3Store) Close() error
Close is used to gracefully close the DB connection.
func (*Sqlite3Store) DeleteRange ¶
func (s *Sqlite3Store) DeleteRange(min, max uint64) error
DeleteRange is used to delete logs within a given range inclusively.
func (*Sqlite3Store) FirstIndex ¶
func (s *Sqlite3Store) FirstIndex() (uint64, error)
FirstIndex returns the first known index from the Raft log.
func (*Sqlite3Store) Get ¶
func (s *Sqlite3Store) Get(k []byte) ([]byte, error)
Get is used to retrieve a value from the k/v store by key
func (*Sqlite3Store) GetLog ¶
func (s *Sqlite3Store) GetLog(idx uint64, log *raft.Log) error
GetLog is used to retrieve a log from sqlite3 at a given index.
func (*Sqlite3Store) GetUint64 ¶
func (s *Sqlite3Store) GetUint64(key []byte) (uint64, error)
GetUint64 is like Get, but handles uint64 values
func (*Sqlite3Store) LastIndex ¶
func (s *Sqlite3Store) LastIndex() (uint64, error)
LastIndex returns the last known index from the Raft log.
func (*Sqlite3Store) Set ¶
func (s *Sqlite3Store) Set(k, v []byte) error
Set is used to set a key/value set outside of the raft log
func (*Sqlite3Store) SetUint64 ¶
func (s *Sqlite3Store) SetUint64(key []byte, val uint64) error
SetUint64 is like Set, but handles uint64 values