boltstore

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB_BUCKET []byte = []byte("DbBucket")
View Source
var RAFT_APPLY_ID []byte = []byte("#raft_apply_id")
View Source
var RAFT_BUCKET []byte = []byte("RaftBucket")

Functions

func NewBoltStore

func NewBoltStore(path string) (model.Store, uint64, error)

Types

type BoltIterator

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

Iterator iterator

func NewBoltIterator

func NewBoltIterator(db *bolt.DB, startKey, endKey []byte) (*BoltIterator, error)

func (*BoltIterator) Error

func (iter *BoltIterator) Error() error

func (*BoltIterator) Key

func (iter *BoltIterator) Key() []byte

func (*BoltIterator) Next

func (iter *BoltIterator) Next() bool

return false if over or error

func (*BoltIterator) Release

func (iter *BoltIterator) Release()

Release iterator使用完需要释放

func (*BoltIterator) Value

func (iter *BoltIterator) Value() []byte

type BoltSnapshot

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

Snapshot snapshot

func NewBoltSnapshot

func NewBoltSnapshot(db *bolt.DB) (*BoltSnapshot, error)

func (*BoltSnapshot) ApplyIndex

func (bs *BoltSnapshot) ApplyIndex() uint64

apply index

func (*BoltSnapshot) Get

func (bs *BoltSnapshot) Get(key []byte) ([]byte, error)

func (*BoltSnapshot) NewIterator

func (bs *BoltSnapshot) NewIterator(startKey, endKey []byte) model.Iterator

func (*BoltSnapshot) Release

func (bs *BoltSnapshot) Release()

Release snapshot使用完需要释放

type BoltStore

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

Store store

func (*BoltStore) Applied

func (bs *BoltStore) Applied() uint64

Applied return current applied raft index(已持久化的)

func (*BoltStore) Close

func (bs *BoltStore) Close() error

func (*BoltStore) Delete

func (bs *BoltStore) Delete(key []byte, timestamp ts.Timestamp, raftIndex uint64) error

func (*BoltStore) Get

func (bs *BoltStore) Get(key []byte, timestamp ts.Timestamp) (value []byte, err error)

func (*BoltStore) GetSnapshot

func (bs *BoltStore) GetSnapshot() (model.Snapshot, error)

func (*BoltStore) NewIterator

func (bs *BoltStore) NewIterator(startKey, endKey []byte, timestamp ts.Timestamp) model.Iterator

func (*BoltStore) NewWriteBatch

func (bs *BoltStore) NewWriteBatch() model.WriteBatch

批量写入,提交时保证batch里的修改同时对外可见

func (*BoltStore) Put

func (bs *BoltStore) Put(key []byte, value []byte, expireAt int64, timestamp ts.Timestamp, raftIndex uint64) error

type BoltWriteBatch

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

WriteBatch write batch

func NewBoltWriteBatch

func NewBoltWriteBatch(db *bolt.DB) (*BoltWriteBatch, error)

func (*BoltWriteBatch) Commit

func (bb *BoltWriteBatch) Commit() error

func (*BoltWriteBatch) Delete

func (bb *BoltWriteBatch) Delete(key []byte, timestamp ts.Timestamp, raftIndex uint64)

func (*BoltWriteBatch) Put

func (bb *BoltWriteBatch) Put(key []byte, value []byte, expireAt int64, timestamp ts.Timestamp, raftIndex uint64)

type KvPair

type KvPair struct {
	Key   []byte
	Value []byte
}

type SnapIterTx

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

func (*SnapIterTx) Bucket

func (st *SnapIterTx) Bucket(name []byte) *bolt.Bucket

func (*SnapIterTx) Rollback

func (st *SnapIterTx) Rollback() error

type Tx

type Tx interface {
	Bucket(name []byte) *bolt.Bucket
	Rollback() error
}

Jump to

Keyboard shortcuts

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