lmdb

package
v0.0.0-...-041d6b2 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBlockDataPrefix   = "blockdata_"
	DefaultBlockHeaderPrefix = "header_"
	DefaultMetadataIndexName = "metadata"
	LatestBlockHeightKey     = "latest_block_height"
)
View Source
const (
	DefaultIndexPrefix = "indexes/"
)

Variables

View Source
var (
	ErrIndexKeyNotFound = fmt.Errorf("key is not found in the index")
)

Functions

This section is empty.

Types

type Database

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

func NewDatabase

func NewDatabase(path string) (*Database, error)

func (*Database) FetchBlock

func (d *Database) FetchBlock(blockHash []byte) (*types2.Block, error)

func (*Database) FetchBlockByHeight

func (d *Database) FetchBlockByHeight(height uint64) (*types2.Block, error)

func (*Database) FetchBlockData

func (d *Database) FetchBlockData(blockHash []byte) ([]*types2.Transaction, error)

func (*Database) FetchBlockHeader

func (d *Database) FetchBlockHeader(blockHash []byte) (*types2.BlockHeader, error)

func (*Database) FetchBlockHeaderByHeight

func (d *Database) FetchBlockHeaderByHeight(height uint64) (*types2.BlockHeader, error)

func (*Database) GetLatestBlockHeight

func (d *Database) GetLatestBlockHeight() (uint64, error)

func (*Database) HasBlock

func (d *Database) HasBlock(blockHash []byte) (bool, error)

func (*Database) SetLatestBlockHeight

func (d *Database) SetLatestBlockHeight(height uint64) error

func (*Database) StoreBlock

func (d *Database) StoreBlock(block *types2.Block) error

type Index

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

func NewIndex

func NewIndex(name string, dbEnv *lmdb.Env, db lmdb.DBI) *Index

func (*Index) Delete

func (i *Index) Delete(key []byte) error

func (*Index) GetBytes

func (i *Index) GetBytes(key []byte) ([]byte, error)

func (*Index) GetUint64

func (i *Index) GetUint64(key []byte) (uint64, error)

func (*Index) PutBytes

func (i *Index) PutBytes(key []byte, value []byte) error

func (*Index) PutUint64

func (i *Index) PutUint64(key []byte, value uint64) error

Jump to

Keyboard shortcuts

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