bcstate

package
v0.0.0-...-49942cb Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFull     = errors.New("store is full")
	ErrNotExist = errors.New("key does not exist")
)

Functions

func BlobAdapter

func BlobAdapter(c KV) blobAdapter

func Exists

func Exists(kv KV, key []byte) (bool, error)

func PrefixEnd

func PrefixEnd(prefix []byte) []byte

Types

type BoltDB

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

func NewBoltDB

func NewBoltDB(db *bolt.DB) *BoltDB

func (*BoltDB) Bucket

func (db *BoltDB) Bucket(p string) KV

func (*BoltDB) ReadTx

func (kv *BoltDB) ReadTx(ctx context.Context, f func(db DB) error) error

func (*BoltDB) WriteTx

func (kv *BoltDB) WriteTx(ctx context.Context, f func(db DB) error) error

type Cell

type Cell interface {
	LoadF(func([]byte) error) error
	Store([]byte) error
}

type DB

type DB interface {
	Bucket(string) KV
}

type KV

type KV interface {
	GetF(k []byte, f func([]byte) error) error
	Put(k, v []byte) error
	Delete(k []byte) error
	NextSequence() (uint64, error)

	// calls fn with first <= k < last
	// if last == nil ForEach will call fn with the last key
	ForEach(first, last []byte, fn func(k, v []byte) error) error

	SizeTotal() uint64
	SizeUsed() uint64
}

type KVCell

type KVCell struct {
	KV  KV
	Key string
}

func (KVCell) LoadF

func (c KVCell) LoadF(f func(data []byte) error) error

func (KVCell) Store

func (c KVCell) Store(data []byte) error

type MemCell

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

func (*MemCell) LoadF

func (c *MemCell) LoadF(f func(data []byte) error) error

func (*MemCell) Store

func (c *MemCell) Store(data []byte) error

type MemDB

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

func (*MemDB) Bucket

func (db *MemDB) Bucket(p string) KV

type MemKV

type MemKV struct {
	Capacity uint64
	// contains filtered or unexported fields
}

func (*MemKV) Bucket

func (kv *MemKV) Bucket(p string) KV

func (*MemKV) Delete

func (kv *MemKV) Delete(key []byte) error

func (*MemKV) ForEach

func (kv *MemKV) ForEach(start, end []byte, fn func(k, v []byte) error) error

func (*MemKV) GetF

func (kv *MemKV) GetF(key []byte, f func([]byte) error) error

func (*MemKV) NextSequence

func (kv *MemKV) NextSequence() (uint64, error)

func (*MemKV) Put

func (kv *MemKV) Put(key, value []byte) error

func (*MemKV) SizeTotal

func (kv *MemKV) SizeTotal() uint64

func (*MemKV) SizeUsed

func (kv *MemKV) SizeUsed() uint64

type PrefixedDB

type PrefixedDB struct {
	Prefix string
	DB
}

func (PrefixedDB) Bucket

func (db PrefixedDB) Bucket(p string) KV

type PrefixedTxDB

type PrefixedTxDB struct {
	Prefix string
	TxDB
}

func (PrefixedTxDB) ReadTx

func (tx PrefixedTxDB) ReadTx(ctx context.Context, f func(db DB) error) error

func (PrefixedTxDB) WriteTx

func (tx PrefixedTxDB) WriteTx(ctx context.Context, f func(DB) error) error

type QuotaDB

type QuotaDB struct {
	Capacity uint64
	DB
	// contains filtered or unexported fields
}

func (*QuotaDB) Bucket

func (db *QuotaDB) Bucket(p string) KV

type TxDB

type TxDB interface {
	DB
	WriteTx(context.Context, func(db DB) error) error
	ReadTx(context.Context, func(db DB) error) error
}

Jump to

Keyboard shortcuts

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