blockdb

package
v1.22.2 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitWithPebble

func InitWithPebble(config dtypes.PebbleBlockDBConfig) error

InitWithPebble initializes the block database with Pebble (local) storage.

func InitWithS3

func InitWithS3(config dtypes.S3BlockDBConfig) error

InitWithS3 initializes the block database with S3 (remote) storage.

func InitWithTiered added in v1.21.0

func InitWithTiered(config dtypes.TieredBlockDBConfig, logger logrus.FieldLogger) error

InitWithTiered initializes the block database with tiered storage (Pebble cache + S3 backend).

Types

type BlockDb

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

BlockDb is the main wrapper for block database operations.

var GlobalBlockDb *BlockDb

GlobalBlockDb is the global block database instance.

func (*BlockDb) AddBlock

func (db *BlockDb) AddBlock(
	ctx context.Context,
	slot uint64,
	root []byte,
	headerVer uint64,
	headerData []byte,
	bodyVer uint64,
	bodyData []byte,
	payloadVer uint64,
	payloadData []byte,
	balVer uint64,
	balData []byte,
) (bool, bool, error)

AddBlock stores block data. Returns (added, updated, error).

func (*BlockDb) AddBlockWithCallback

func (db *BlockDb) AddBlockWithCallback(
	ctx context.Context,
	slot uint64,
	root []byte,
	dataCb func() (*types.BlockData, error),
) (bool, bool, error)

AddBlockWithCallback stores block data using a callback for deferred data loading. Returns (added, updated, error).

func (*BlockDb) AddExecData added in v1.20.3

func (db *BlockDb) AddExecData(ctx context.Context, slot uint64, blockRoot []byte, data []byte) (int64, error)

AddExecData stores execution data for a block. Returns stored size.

func (*BlockDb) Close

func (db *BlockDb) Close() error

func (*BlockDb) DeleteExecData added in v1.20.3

func (db *BlockDb) DeleteExecData(ctx context.Context, slot uint64, blockRoot []byte) error

DeleteExecData deletes execution data for a specific block.

func (*BlockDb) GetBlock

func (db *BlockDb) GetBlock(
	ctx context.Context,
	slot uint64,
	root []byte,
	flags types.BlockDataFlags,
	parseBlock func(uint64, []byte) (any, error),
	parsePayload func(uint64, []byte) (any, error),
) (*types.BlockData, error)

GetBlock retrieves block data with selective loading based on flags.

func (*BlockDb) GetEngine added in v1.20.4

func (db *BlockDb) GetEngine() types.BlockDbEngine

GetEngine returns the underlying storage engine.

func (*BlockDb) GetExecData added in v1.20.3

func (db *BlockDb) GetExecData(ctx context.Context, slot uint64, blockRoot []byte) ([]byte, error)

GetExecData retrieves full execution data for a block.

func (*BlockDb) GetExecDataRange added in v1.20.3

func (db *BlockDb) GetExecDataRange(ctx context.Context, slot uint64, blockRoot []byte, offset int64, length int64) ([]byte, error)

GetExecDataRange retrieves a byte range of execution data.

func (*BlockDb) GetExecDataTxSections added in v1.20.3

func (db *BlockDb) GetExecDataTxSections(ctx context.Context, slot uint64, blockRoot []byte, txHash []byte, sections uint32) (*types.ExecDataTxSections, error)

GetExecDataTxSections retrieves compressed section data for a single transaction. sections is a bitmask selecting which sections to return.

func (*BlockDb) GetStoredComponents added in v1.21.0

func (db *BlockDb) GetStoredComponents(ctx context.Context, slot uint64, root []byte) (types.BlockDataFlags, error)

GetStoredComponents returns which components exist for a block.

func (*BlockDb) HasExecData added in v1.20.3

func (db *BlockDb) HasExecData(ctx context.Context, slot uint64, blockRoot []byte) (bool, error)

HasExecData checks if execution data exists for a block.

func (*BlockDb) PruneExecDataBefore added in v1.20.3

func (db *BlockDb) PruneExecDataBefore(ctx context.Context, maxSlot uint64) (int64, error)

PruneExecDataBefore deletes execution data for all slots before maxSlot.

func (*BlockDb) SupportsExecData added in v1.20.3

func (db *BlockDb) SupportsExecData() bool

SupportsExecData returns true if the underlying engine supports execution data storage.

Directories

Path Synopsis
Package types provides the per-block execution data binary format (DXTX).
Package types provides the per-block execution data binary format (DXTX).

Jump to

Keyboard shortcuts

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