store

package
v0.0.0-...-a5b6b36 Latest Latest
Warning

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

Go to latest
Published: May 11, 2017 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KVStorage

type KVStorage interface {
	Put(key, value string)
	Get(key string) (string, bool)
	Close()
}

KVStorage storage interface

type LogStorage

type LogStorage struct {
	// contains filtered or unexported fields
}

LogStorage A naive log storage, based on RocksDB. Support append and random read

func MakeLogStorage

func MakeLogStorage(column *TableColumn) (*LogStorage, error)

func (*LogStorage) Append

func (l *LogStorage) Append(entry *pb.KVCommand) int

func (*LogStorage) AppendAt

func (l *LogStorage) AppendAt(pos int, entries []*pb.KVCommand)

func (*LogStorage) At

func (l *LogStorage) At(index int) *pb.KVCommand

func (*LogStorage) Close

func (l *LogStorage) Close()

func (*LogStorage) CommitTo

func (l *LogStorage) CommitTo(idx int)

CommitTo uncache until idx

func (*LogStorage) Dump

func (l *LogStorage) Dump(writer io.Writer)

func (*LogStorage) Last

func (l *LogStorage) Last() *pb.KVCommand

func (*LogStorage) LastIndex

func (l *LogStorage) LastIndex() int

func (*LogStorage) Slice

func (l *LogStorage) Slice(start, end int) []*pb.KVCommand

func (*LogStorage) String

func (l *LogStorage) String() string

type MemKVStore

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

func MakeMemKVStore

func MakeMemKVStore() *MemKVStore

func (*MemKVStore) Close

func (s *MemKVStore) Close()

func (*MemKVStore) Get

func (s *MemKVStore) Get(key string) (string, bool)

func (*MemKVStore) Put

func (s *MemKVStore) Put(key, value string)

type Persister

type Persister interface {
	LoadInt32(key string) (int32, bool)
	StoreInt32(key string, value int32)
	LoadInt64(key string) (int64, bool)
	StoreInt64(key string, value int64)
}

Persister store persistent state in raft

type RocksBasedPersister

type RocksBasedPersister struct {
	// contains filtered or unexported fields
}

RocksBasedPersister a naive implementation, store key/value directly

func MakeRocksBasedPersister

func MakeRocksBasedPersister(column *TableColumn) *RocksBasedPersister

func (*RocksBasedPersister) LoadInt32

func (p *RocksBasedPersister) LoadInt32(key string) (int32, bool)

func (*RocksBasedPersister) LoadInt64

func (p *RocksBasedPersister) LoadInt64(key string) (int64, bool)

func (*RocksBasedPersister) StoreInt32

func (p *RocksBasedPersister) StoreInt32(key string, value int32)

func (*RocksBasedPersister) StoreInt64

func (p *RocksBasedPersister) StoreInt64(key string, value int64)

type RocksDBStore

type RocksDBStore struct {
	// contains filtered or unexported fields
}

func MakeRocksDBStore

func MakeRocksDBStore(column *TableColumn) (*RocksDBStore, error)

func (*RocksDBStore) Close

func (s *RocksDBStore) Close()

func (*RocksDBStore) Get

func (s *RocksDBStore) Get(key string) (string, bool)

func (*RocksDBStore) Put

func (s *RocksDBStore) Put(key, value string)

type TableColumn

type TableColumn struct {
	// contains filtered or unexported fields
}

func MakeDBColumn

func MakeDBColumn(db *gorocksdb.DB, cf *gorocksdb.ColumnFamilyHandle, column string) *TableColumn

func OpenTable

func OpenTable(name string, columns []string) (*gorocksdb.DB, []*TableColumn, error)

func (*TableColumn) Get

func (c *TableColumn) Get(key string) (string, bool)

func (*TableColumn) GetBytes

func (c *TableColumn) GetBytes(key []byte) ([]byte, bool)

func (*TableColumn) Put

func (c *TableColumn) Put(key, value string)

func (*TableColumn) PutBytes

func (c *TableColumn) PutBytes(key, value []byte)

func (*TableColumn) String

func (c *TableColumn) String() string

Jump to

Keyboard shortcuts

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