store

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2025 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockStore

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

func NewBlockStore

func NewBlockStore(dir string, opts ...Option) (*BlockStore, error)

func (*BlockStore) Best

func (bki *BlockStore) Best() (height int64, blkHash, appHash types.Hash, stamp time.Time)

Best returns the best block's height, hash, appHash, and time stamp. The appHash is a result of executing the block, not the appHash stored in the header, which is from the execution of the previous block. The time stamp is what is in the header.

func (*BlockStore) Close

func (bki *BlockStore) Close() error

func (*BlockStore) Get

func (bki *BlockStore) Get(blkHash types.Hash) (*ktypes.Block, *ktypes.CommitInfo, error)

func (*BlockStore) GetByHeight

func (bki *BlockStore) GetByHeight(height int64) (types.Hash, *ktypes.Block, *ktypes.CommitInfo, error)

GetByHeight retrieves the full block based on the block height. The returned hash is a convenience for the caller to spare computing it. The app hash, which is encoded in the next block header, is also returned.

func (*BlockStore) GetRaw

func (bki *BlockStore) GetRaw(blkHash types.Hash) ([]byte, *ktypes.CommitInfo, error)

func (*BlockStore) GetRawByHeight

func (bki *BlockStore) GetRawByHeight(height int64) (types.Hash, []byte, *ktypes.CommitInfo, error)

func (*BlockStore) GetTx

func (bki *BlockStore) GetTx(txHash types.Hash) (tx *ktypes.Transaction, height int64, blkHash types.Hash, blkIdx uint32, err error)

GetTx returns the raw bytes of the transaction, and information on the block containing the transaction.

func (*BlockStore) Have

func (bki *BlockStore) Have(hash types.Hash) bool

func (*BlockStore) HaveTx

func (bki *BlockStore) HaveTx(txHash types.Hash) bool

func (*BlockStore) PreFetch

func (bki *BlockStore) PreFetch(blkid types.Hash) (bool, func())

func (*BlockStore) Result

func (bki *BlockStore) Result(hash types.Hash, idx uint32) (*ktypes.TxResult, error)

func (*BlockStore) Results

func (bki *BlockStore) Results(hash types.Hash) ([]ktypes.TxResult, error)

func (*BlockStore) Store

func (bki *BlockStore) Store(blk *ktypes.Block, commitInfo *ktypes.CommitInfo) error

func (*BlockStore) StoreResults

func (bki *BlockStore) StoreResults(hash types.Hash, results []ktypes.TxResult) error

type Option

type Option func(*options)

func WithCompression

func WithCompression(compress bool) Option

func WithLogger

func WithLogger(logger log.Logger) Option

Directories

Path Synopsis
Package memstore provides a memory-backed block store, which is only suitable for testing where a disk-based store or third party dependencies are not desired.
Package memstore provides a memory-backed block store, which is only suitable for testing where a disk-based store or third party dependencies are not desired.

Jump to

Keyboard shortcuts

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