storage

package
v0.0.0-...-d55d242 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	MerkleBranchFactor: 8,
	ConcurrentLimit:    20,
}

Functions

func NewLevelDB

func NewLevelDB(path string) (*leveldb.DB, error)

Types

type CommitData

type CommitData struct {
	Block        *core.Block
	QC           *core.QuorumCert // QC for committed block
	Transactions []*core.Transaction
	BlockCommit  *core.BlockCommit
	TxCommits    []*core.TxCommit
	// contains filtered or unexported fields
}

type Config

type Config struct {
	MerkleBranchFactor uint8
	ConcurrentLimit    int
}

type Storage

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

func New

func New(db *leveldb.DB, config Config) *Storage

func (*Storage) Commit

func (strg *Storage) Commit(data *CommitData) error

func (*Storage) GetBlock

func (strg *Storage) GetBlock(hash []byte) (*core.Block, error)

func (*Storage) GetBlockByHeight

func (strg *Storage) GetBlockByHeight(height uint64) (*core.Block, error)

func (*Storage) GetBlockCommit

func (strg *Storage) GetBlockCommit(hash []byte) (*core.BlockCommit, error)

func (*Storage) GetBlockHeight

func (strg *Storage) GetBlockHeight() uint64

func (*Storage) GetLastBlock

func (strg *Storage) GetLastBlock() (*core.Block, error)

func (*Storage) GetLastQC

func (strg *Storage) GetLastQC() (*core.QuorumCert, error)

func (*Storage) GetMerkleRoot

func (strg *Storage) GetMerkleRoot() []byte

func (*Storage) GetState

func (strg *Storage) GetState(key []byte) []byte

func (*Storage) GetTx

func (strg *Storage) GetTx(hash []byte) (*core.Transaction, error)

func (*Storage) GetTxCommit

func (strg *Storage) GetTxCommit(hash []byte) (*core.TxCommit, error)

func (*Storage) HasTx

func (strg *Storage) HasTx(hash []byte) bool

func (*Storage) VerifyState

func (strg *Storage) VerifyState(key []byte) []byte

Jump to

Keyboard shortcuts

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