Documentation
¶
Index ¶
- Constants
- Variables
- type AccessMode
- type BusyTimeout
- type JournalMode
- type OptFunc
- type Pragmaer
- type SecureDeleteMode
- type Sqlite3Store
- func (b *Sqlite3Store) Close() error
- func (b *Sqlite3Store) DeleteRange(min, max uint64) error
- func (b *Sqlite3Store) FirstIndex() (uint64, error)
- func (b *Sqlite3Store) Get(k []byte) ([]byte, error)
- func (b *Sqlite3Store) GetLog(idx uint64, log *raft.Log) error
- func (b *Sqlite3Store) GetUint64(key []byte) (uint64, error)
- func (b *Sqlite3Store) LastIndex() (uint64, error)
- func (b *Sqlite3Store) Set(k, v []byte) error
- func (b *Sqlite3Store) SetUint64(key []byte, val uint64) error
- func (b *Sqlite3Store) StoreLog(log *raft.Log) error
- func (b *Sqlite3Store) StoreLogs(logs []*raft.Log) error
- func (b *Sqlite3Store) Sync() error
- type SynchronousMode
- type VacuumMode
Constants ¶
const ( AccessDefault = iota AccessRO AccessRW AccessRWC AccessMemory )
Variables ¶
var ( // An error indicating a given key does not exist ErrKeyNotFound = errors.New("not found") )
Functions ¶
This section is empty.
Types ¶
type AccessMode ¶
type AccessMode int
func (AccessMode) String ¶
func (a AccessMode) String() string
type BusyTimeout ¶
func (BusyTimeout) Pragma ¶
func (b BusyTimeout) Pragma() string
func (BusyTimeout) String ¶
func (b BusyTimeout) String() string
type JournalMode ¶
type JournalMode int
const ( JournalDelete JournalMode = iota JournalTruncate JournalPersist JournalMemory JournalWAL JournalOff )
func (JournalMode) Pragma ¶
func (s JournalMode) Pragma() string
func (JournalMode) String ¶
func (j JournalMode) String() string
type OptFunc ¶
type OptFunc func(*Sqlite3Store)
func WithMode ¶
func WithMode(m AccessMode) OptFunc
func WithPragmas ¶
type SecureDeleteMode ¶
type SecureDeleteMode int
const ( SecureDeleteOff SecureDeleteMode = iota SecureDeleteOn SecureDeleteFast )
func (SecureDeleteMode) Pragma ¶
func (s SecureDeleteMode) Pragma() string
func (SecureDeleteMode) String ¶
func (s SecureDeleteMode) String() string
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(path string, opts ...OptFunc) (*Sqlite3Store, error)
New uses the supplied options to open the Sqlite3 and prepare it for use as a raft backend.
func (*Sqlite3Store) Close ¶
func (b *Sqlite3Store) Close() error
Close is used to gracefully close the DB connection.
func (*Sqlite3Store) DeleteRange ¶
func (b *Sqlite3Store) DeleteRange(min, max uint64) error
DeleteRange is used to delete logs within a given range inclusively.
func (*Sqlite3Store) FirstIndex ¶
func (b *Sqlite3Store) FirstIndex() (uint64, error)
FirstIndex returns the first known index from the Raft log.
func (*Sqlite3Store) Get ¶
func (b *Sqlite3Store) Get(k []byte) ([]byte, error)
Get is used to retrieve a value from the k/v store by key
func (*Sqlite3Store) GetLog ¶
func (b *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 (b *Sqlite3Store) GetUint64(key []byte) (uint64, error)
GetUint64 is like Get, but handles uint64 values
func (*Sqlite3Store) LastIndex ¶
func (b *Sqlite3Store) LastIndex() (uint64, error)
LastIndex returns the last known index from the Raft log.
func (*Sqlite3Store) Set ¶
func (b *Sqlite3Store) Set(k, v []byte) error
Set is used to set a key/value set outside of the raft log
func (*Sqlite3Store) SetUint64 ¶
func (b *Sqlite3Store) SetUint64(key []byte, val uint64) error
SetUint64 is like Set, but handles uint64 values
func (*Sqlite3Store) StoreLog ¶
func (b *Sqlite3Store) StoreLog(log *raft.Log) error
StoreLog is used to store a single raft log
func (*Sqlite3Store) StoreLogs ¶
func (b *Sqlite3Store) StoreLogs(logs []*raft.Log) error
StoreLogs is used to store a set of raft logs
func (*Sqlite3Store) Sync ¶
func (b *Sqlite3Store) Sync() error
Sync performs an fsync on the database file handle. This is not necessary under normal operation unless NoSync is enabled, in which this forces the database file to sync against the disk.
type SynchronousMode ¶
type SynchronousMode int
const ( SynchronousOff SynchronousMode = iota SynchronousNormal SynchronousFull SynchronousExtra )
func (SynchronousMode) Pragma ¶
func (s SynchronousMode) Pragma() string
func (SynchronousMode) String ¶
func (s SynchronousMode) String() string
type VacuumMode ¶
type VacuumMode int
const ( VacuumNone VacuumMode = iota VacuumFull VacuumIncremental )
func (VacuumMode) Pragma ¶
func (v VacuumMode) Pragma() string
func (VacuumMode) String ¶
func (v VacuumMode) String() string