Documentation ¶
Index ¶
- Variables
- func OpenPebbleDB(cfg *PebbleDBConfig, dir string, logger pebble.Logger) (*pebble.DB, error)
- type PebbleDBConfig
- type PebbleStore
- func (ps *PebbleStore) Close() error
- func (ps *PebbleStore) DeleteRange(min, max uint64) error
- func (ps *PebbleStore) FirstIndex() (uint64, error)
- func (ps *PebbleStore) Get(key []byte) ([]byte, error)
- func (ps *PebbleStore) GetLog(index uint64, log *raft.Log) error
- func (ps *PebbleStore) GetUint64(key []byte) (uint64, error)
- func (ps *PebbleStore) LastIndex() (uint64, error)
- func (ps *PebbleStore) Set(key, val []byte) error
- func (ps *PebbleStore) SetUint64(key []byte, val uint64) error
- func (ps *PebbleStore) StoreLog(log *raft.Log) error
- func (ps *PebbleStore) StoreLogs(logs []*raft.Log) error
- func (ps *PebbleStore) Sync() error
Constants ¶
This section is empty.
Variables ¶
var ( // An error indicating a given key does not exist ErrKeyNotFound = errors.New("not found") )
Functions ¶
func OpenPebbleDB ¶
Types ¶
type PebbleDBConfig ¶
type PebbleDBConfig struct { KVLRUCacheSize int64 KVWriteBufferSize uint64 KVMaxWriteBufferNumber int KVLevel0FileNumCompactionTrigger int KVLevel0StopWritesTrigger int KVMaxBytesForLevelBase int64 KVTargetFileSizeBase int64 KVTargetFileSizeMultiplier int64 KVNumOfLevels int KVMaxOpenFiles int KVMaxConcurrentCompactions int KVBlockSize int KVMaxManifestFileSize int64 KVBytesPerSync int KVWALBytesPerSync int }
func DefaultPebbleDBConfig ¶
func DefaultPebbleDBConfig() *PebbleDBConfig
type PebbleStore ¶
type PebbleStore struct {
// contains filtered or unexported fields
}
func NewPebbleStore ¶
func NewPebbleStore(path string, logger pebble.Logger, cfg *PebbleDBConfig) (*PebbleStore, error)
func (*PebbleStore) Close ¶
func (ps *PebbleStore) Close() error
func (*PebbleStore) DeleteRange ¶
func (ps *PebbleStore) DeleteRange(min, max uint64) error
DeleteRange deletes a range of log entries, [min, max]. The range is inclusive.
func (*PebbleStore) FirstIndex ¶
func (ps *PebbleStore) FirstIndex() (uint64, error)
FirstIndex returns the first index written. 0 for no entries.
func (*PebbleStore) Get ¶
func (ps *PebbleStore) Get(key []byte) ([]byte, error)
Get is used to retrieve a value from the k/v store by key
func (*PebbleStore) GetLog ¶
func (ps *PebbleStore) GetLog(index uint64, log *raft.Log) error
GetLog gets a log entry at a given index.
func (*PebbleStore) GetUint64 ¶
func (ps *PebbleStore) GetUint64(key []byte) (uint64, error)
GetUint64 is like Get, but handles uint64 values
func (*PebbleStore) LastIndex ¶
func (ps *PebbleStore) LastIndex() (uint64, error)
LastIndex returns the last index written. 0 for no entries.
func (*PebbleStore) Set ¶
func (ps *PebbleStore) Set(key, val []byte) error
Set is used to set a key/value set outside of the raft log
func (*PebbleStore) SetUint64 ¶
func (ps *PebbleStore) SetUint64(key []byte, val uint64) error
SetUint64 is like Set, but handles uint64 values
func (*PebbleStore) StoreLog ¶
func (ps *PebbleStore) StoreLog(log *raft.Log) error
StoreLog stores a log entry.
func (*PebbleStore) StoreLogs ¶
func (ps *PebbleStore) StoreLogs(logs []*raft.Log) error
StoreLogs stores multiple log entries. By default the logs stored may not be contiguous with previous logs (i.e. may have a gap in Index since the last log written). If an implementation can't tolerate this it may optionally implement `MonotonicLogStore` to indicate that this is not allowed. This changes Raft's behaviour after restoring a user snapshot to remove all previous logs instead of relying on a "gap" to signal the discontinuity between logs before the snapshot and logs after.
func (*PebbleStore) Sync ¶
func (ps *PebbleStore) Sync() error