badgerraftcache

package
v0.0.0-...-7e31768 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 31, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PluginConfig = &badgerRaftCacheConfig{
		done: make(chan struct{}),
	}
)

Config ...

Functions

This section is empty.

Types

type Cache

type Cache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Cache stores and retrieves data using Badger KV.

func Mount

func Mount(client *badger.DB) *Cache

func New

func New(config *Config) (*Cache, error)

func (*Cache) Close

func (c *Cache) Close() error

Close closes the underlying boltdb database.

func (*Cache) Delete

func (c *Cache) Delete(key string)

func (*Cache) DeleteRange

func (c *Cache) DeleteRange(min, max uint64) error

func (*Cache) FirstIndex

func (c *Cache) FirstIndex() (uint64, error)

func (*Cache) Get

func (c *Cache) Get(key string) (resp []byte, ok bool)

func (*Cache) GetLog

func (c *Cache) GetLog(idx uint64, log *raft.Log) error

func (*Cache) GetUint64

func (c *Cache) GetUint64(key []byte) (uint64, error)

func (*Cache) LastIndex

func (c *Cache) LastIndex() (uint64, error)

func (*Cache) Set

func (c *Cache) Set(key string, resp []byte)

Set stores a response to the cache at the given key.

func (*Cache) SetUint64

func (c *Cache) SetUint64(key []byte, val uint64) error

func (*Cache) StoreLog

func (c *Cache) StoreLog(log *raft.Log) error

func (*Cache) StoreLogs

func (c *Cache) StoreLogs(logs []*raft.Log) error

type Config

type Config struct {
	StoragePath string
	ValueDir    string
	// SyncWrites  bool
	Logger        bool
	LogsForwarder bool
	AccessLogs    string
	ErrorLogs     string
	Debug         bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL