stores

package
v0.0.0-...-811092d Latest Latest
Warning

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

Go to latest
Published: May 23, 2018 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBlockExists is used when writing a block that already exists
	ErrBlockExists = errors.New("block exists")
	// ErrBlockNotFound is used when a request block isn't found
	ErrBlockNotFound = errors.New("block not found")
)

Functions

This section is empty.

Types

type BadgerBlockStorage

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

func NewBadgerBlockStorage

func NewBadgerBlockStorage(db *badger.DB, keyPrefix []byte, h hasher.Hasher) *BadgerBlockStorage

func (*BadgerBlockStorage) Add

func (st *BadgerBlockStorage) Add(b *bcpb.Block) (bcpb.Digest, error)

func (*BadgerBlockStorage) Close

func (st *BadgerBlockStorage) Close() error

func (*BadgerBlockStorage) Exists

func (st *BadgerBlockStorage) Exists(id bcpb.Digest) bool

func (*BadgerBlockStorage) Genesis

func (st *BadgerBlockStorage) Genesis() (id bcpb.Digest, blk *bcpb.Block)

func (*BadgerBlockStorage) Get

func (st *BadgerBlockStorage) Get(id bcpb.Digest) (*bcpb.Block, error)

func (*BadgerBlockStorage) Iter

func (*BadgerBlockStorage) Last

func (st *BadgerBlockStorage) Last() (id bcpb.Digest, blk *bcpb.Block)

func (*BadgerBlockStorage) LastExec

func (st *BadgerBlockStorage) LastExec() (id bcpb.Digest, blk *bcpb.Block)

func (*BadgerBlockStorage) Remove

func (st *BadgerBlockStorage) Remove(id bcpb.Digest) error

func (*BadgerBlockStorage) SetGenesis

func (st *BadgerBlockStorage) SetGenesis(id bcpb.Digest) error

func (*BadgerBlockStorage) SetLast

func (st *BadgerBlockStorage) SetLast(id bcpb.Digest) error

func (*BadgerBlockStorage) SetLastExec

func (st *BadgerBlockStorage) SetLastExec(id bcpb.Digest) error

SetLastExec checks if the given digest exists and marks it as the last executed block

type BadgerDataKeyIndex

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

BadgerDataKeyIndex implements the DataKeyIndex interface backed by badger key-value store

func NewBadgerDataKeyIndex

func NewBadgerDataKeyIndex(db *badger.DB, prefix []byte) *BadgerDataKeyIndex

NewBadgerDataKeyIndex inits a new BadgerDataKeyIndex

func (*BadgerDataKeyIndex) Get

func (index *BadgerDataKeyIndex) Get(key bcpb.DataKey) (bcpb.Digest, int32, error)

Get retrieves the digest and output index associated to the DataKey

func (*BadgerDataKeyIndex) Iter

func (index *BadgerDataKeyIndex) Iter(prefix bcpb.DataKey, f DataKeyIterator) error

Iter iterates over all DataKeys starting at the given prefix DataKey

func (*BadgerDataKeyIndex) Set

func (index *BadgerDataKeyIndex) Set(key bcpb.DataKey, ref bcpb.Digest, idx int32) error

Set sets the DataKey to the given tx id and output index

type BadgerTxStorage

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

BadgerTxStorage implements a badger backed TxStorage interface

func NewBadgerTxStorage

func NewBadgerTxStorage(db *badger.DB, keyPrefix []byte) *BadgerTxStorage

NewBadgerTxStorage returns a new badger backed tx storage device.

func (*BadgerTxStorage) Get

func (store *BadgerTxStorage) Get(id bcpb.Digest) (*bcpb.Tx, error)

Get retrieves a transaction by the given id

func (*BadgerTxStorage) Iter

func (store *BadgerTxStorage) Iter(f func(bcpb.Tx) error)

Iter iterates over each transaction, calling the f for each encountered tx.

func (*BadgerTxStorage) Set

func (store *BadgerTxStorage) Set(tx *bcpb.Tx) error

Set sets the transaction returning the hash id of the transaction

func (*BadgerTxStorage) SetBatch

func (store *BadgerTxStorage) SetBatch(txs []*bcpb.Tx) error

SetBatch sets a batch of transactions returning each id or an error

type BlockIterator

type BlockIterator func(bcpb.Digest, *bcpb.Block) error

BlockIterator is used to iterate over blocks in a store

type DataKeyIterator

type DataKeyIterator func(bcpb.DataKey, bcpb.Digest, int32) bool

DataKeyIterator is used to iterate over the datakey index

Jump to

Keyboard shortcuts

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