boltdb

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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB_BUCKET []byte = []byte("DbBucket")

Functions

func NewBoltDriver

func NewBoltDriver(path string) (engine.Driver, error)

Types

type BoltBatch

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

WriteBatch write batch

func NewBoltBatch

func NewBoltBatch(db *bolt.DB) (*BoltBatch, error)

func (*BoltBatch) Commit

func (bb *BoltBatch) Commit() error

func (*BoltBatch) Delete

func (bb *BoltBatch) Delete(key []byte)

func (*BoltBatch) Put

func (bb *BoltBatch) Put(key []byte, value []byte)

type BoltDriver

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

Store store

func (*BoltDriver) Close

func (bs *BoltDriver) Close() error

func (*BoltDriver) Delete

func (bs *BoltDriver) Delete(key []byte) error

func (*BoltDriver) Get

func (bs *BoltDriver) Get(key []byte) (value []byte, err error)

func (*BoltDriver) GetSnapshot

func (bs *BoltDriver) GetSnapshot() (engine.Snapshot, error)

func (*BoltDriver) NewBatch

func (bs *BoltDriver) NewBatch() engine.Batch

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

func (*BoltDriver) NewIterator

func (bs *BoltDriver) NewIterator(startKey, endKey []byte) engine.Iterator

func (*BoltDriver) Put

func (bs *BoltDriver) Put(key []byte, value []byte) error

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) Get

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

func (*BoltSnapshot) NewIterator

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

func (*BoltSnapshot) Release

func (bs *BoltSnapshot) Release()

Release snapshot使用完需要释放

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