Documentation
¶
Index ¶
- func InitWithPebble(config dtypes.PebbleBlockDBConfig, logger logrus.FieldLogger) error
- func InitWithS3(config dtypes.S3BlockDBConfig) error
- func InitWithTiered(pebbleConfig dtypes.PebbleBlockDBConfig, s3Config dtypes.S3BlockDBConfig, ...) error
- type BlockDb
- func (db *BlockDb) AddBlock(ctx context.Context, slot uint64, root []byte, headerVer uint64, ...) (bool, bool, error)
- func (db *BlockDb) AddBlockWithCallback(ctx context.Context, slot uint64, root []byte, ...) (bool, bool, error)
- func (db *BlockDb) AddDivergingEpochDuties(ctx context.Context, duties *types.EpochDuties) (int64, error)
- func (db *BlockDb) AddEpochDuties(ctx context.Context, duties *types.EpochDuties) (int64, error)
- func (db *BlockDb) AddExecData(ctx context.Context, slot uint64, blockRoot []byte, data []byte) (int64, error)
- func (db *BlockDb) AddSlotBids(ctx context.Context, bids *types.SlotBids) (int64, error)
- func (db *BlockDb) Close() error
- func (db *BlockDb) DeleteExecData(ctx context.Context, slot uint64, blockRoot []byte) error
- func (db *BlockDb) GetBlock(ctx context.Context, slot uint64, root []byte, flags types.BlockDataFlags, ...) (*types.BlockData, error)
- func (db *BlockDb) GetEngine() types.BlockDbEngine
- func (db *BlockDb) GetEpochDuties(ctx context.Context, firstSlot uint64) (*types.EpochDuties, error)
- func (db *BlockDb) GetEpochDutiesForRoot(ctx context.Context, firstSlot uint64, depRoot [32]byte) (*types.EpochDuties, error)
- func (db *BlockDb) GetExecData(ctx context.Context, slot uint64, blockRoot []byte) ([]byte, error)
- func (db *BlockDb) GetExecDataRange(ctx context.Context, slot uint64, blockRoot []byte, offset int64, length int64) ([]byte, error)
- func (db *BlockDb) GetExecDataTxSections(ctx context.Context, slot uint64, blockRoot []byte, txHash []byte, ...) (*types.ExecDataTxSections, error)
- func (db *BlockDb) GetObjectStats(ctx context.Context) (*types.BlockDbObjectStats, error)
- func (db *BlockDb) GetSlotBids(ctx context.Context, slot uint64) (*types.SlotBids, error)
- func (db *BlockDb) GetSlotCommittees(ctx context.Context, firstSlot uint64, slot uint64) ([][]uint64, error)
- func (db *BlockDb) GetSlotCommitteesForRoot(ctx context.Context, firstSlot uint64, slot uint64, depRoot [32]byte) ([][]uint64, error)
- func (db *BlockDb) GetSlotPtc(ctx context.Context, firstSlot uint64, slot uint64) ([]uint64, error)
- func (db *BlockDb) GetSlotPtcForRoot(ctx context.Context, firstSlot uint64, slot uint64, depRoot [32]byte) ([]uint64, error)
- func (db *BlockDb) GetStoredComponents(ctx context.Context, slot uint64, root []byte) (types.BlockDataFlags, error)
- func (db *BlockDb) HasEpochDuties(ctx context.Context, firstSlot uint64) (bool, error)
- func (db *BlockDb) HasExecData(ctx context.Context, slot uint64, blockRoot []byte) (bool, error)
- func (db *BlockDb) LookupTxHash(ctx context.Context, prefix []byte) ([]uint64, error)
- func (db *BlockDb) LookupTxHashRange(ctx context.Context, lo, hi []byte) ([]uint64, error)
- func (db *BlockDb) PruneEpochDutiesBefore(ctx context.Context, maxFirstSlot uint64) (int64, error)
- func (db *BlockDb) PruneExecDataBefore(ctx context.Context, maxSlot uint64) (int64, error)
- func (db *BlockDb) PruneSlotBidsBefore(ctx context.Context, maxSlot uint64) (int64, error)
- func (db *BlockDb) PruneTxHashBefore(ctx context.Context, maxSlot uint64) (int64, error)
- func (db *BlockDb) PutTxHashes(ctx context.Context, entries []types.TxHashEntry) error
- func (db *BlockDb) SetTimeToSlotFn(fn func(t time.Time) uint64)
- func (db *BlockDb) SetTxHashIndex(idx types.TxHashIndex)
- func (db *BlockDb) SupportsDuties() bool
- func (db *BlockDb) SupportsExecData() bool
- func (db *BlockDb) SupportsSlotBids() bool
- func (db *BlockDb) SupportsTxHashIndex() bool
- func (db *BlockDb) TxHashIndexDiskUsage() int64
- func (db *BlockDb) TxHashIndexNative() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitWithPebble ¶
func InitWithPebble(config dtypes.PebbleBlockDBConfig, logger logrus.FieldLogger) error
InitWithPebble initializes the block database with Pebble (local) storage. Pebble is the authoritative store here, so its retention configs (block / duties) delete data rather than evict cached copies. Exec-data retention is owned by the EL indexer (executionIndexer.detailsRetention); a blockDb exec-data retention is ignored with a warning.
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(pebbleConfig dtypes.PebbleBlockDBConfig, s3Config dtypes.S3BlockDBConfig, logger logrus.FieldLogger) error
InitWithTiered initializes the block database with tiered storage (Pebble cache in front of an S3 backend), reusing the shared pebble and s3 configs.
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) AddDivergingEpochDuties ¶ added in v1.24.4
func (db *BlockDb) AddDivergingEpochDuties(ctx context.Context, duties *types.EpochDuties) (int64, error)
AddDivergingEpochDuties stores the resolved duties of a diverging fork, keyed by its (non-zero) dependent root. Returns stored size.
func (*BlockDb) AddEpochDuties ¶ added in v1.24.0
AddEpochDuties stores the resolved per-epoch duties. Returns stored size.
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) AddSlotBids ¶ added in v1.24.4
AddSlotBids stores the per-slot bids object. Returns stored size.
func (*BlockDb) DeleteExecData ¶ added in v1.20.3
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) GetEpochDuties ¶ added in v1.24.0
func (db *BlockDb) GetEpochDuties(ctx context.Context, firstSlot uint64) (*types.EpochDuties, error)
GetEpochDuties retrieves the full resolved duties for an epoch.
func (*BlockDb) GetEpochDutiesForRoot ¶ added in v1.24.4
func (db *BlockDb) GetEpochDutiesForRoot(ctx context.Context, firstSlot uint64, depRoot [32]byte) (*types.EpochDuties, error)
GetEpochDutiesForRoot retrieves the full diverging-fork duties for an epoch under the given dependent root (nil if not found).
func (*BlockDb) GetExecData ¶ added in v1.20.3
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) GetObjectStats ¶ added in v1.24.4
GetObjectStats returns engine-level per-namespace object counts if the engine supports a cheap scan (Pebble / tiered hot tier); otherwise nil.
func (*BlockDb) GetSlotBids ¶ added in v1.24.4
GetSlotBids retrieves the bids object for a slot (nil if not found).
func (*BlockDb) GetSlotCommittees ¶ added in v1.24.0
func (db *BlockDb) GetSlotCommittees(ctx context.Context, firstSlot uint64, slot uint64) ([][]uint64, error)
GetSlotCommittees retrieves the attester committees for a single slot.
func (*BlockDb) GetSlotCommitteesForRoot ¶ added in v1.24.4
func (db *BlockDb) GetSlotCommitteesForRoot(ctx context.Context, firstSlot uint64, slot uint64, depRoot [32]byte) ([][]uint64, error)
GetSlotCommitteesForRoot retrieves the attester committees for a single slot of the diverging fork identified by depRoot (nil if not found).
func (*BlockDb) GetSlotPtc ¶ added in v1.24.0
GetSlotPtc retrieves the PTC members for a single slot.
func (*BlockDb) GetSlotPtcForRoot ¶ added in v1.24.4
func (db *BlockDb) GetSlotPtcForRoot(ctx context.Context, firstSlot uint64, slot uint64, depRoot [32]byte) ([]uint64, error)
GetSlotPtcForRoot retrieves the PTC members for a single slot of the diverging fork identified by depRoot (nil if not found).
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) HasEpochDuties ¶ added in v1.24.0
HasEpochDuties checks if duties exist for an epoch.
func (*BlockDb) HasExecData ¶ added in v1.20.3
HasExecData checks if execution data exists for a block.
func (*BlockDb) LookupTxHash ¶ added in v1.24.1
LookupTxHash returns candidate tx_uids for an exact 10-byte prefix.
func (*BlockDb) LookupTxHashRange ¶ added in v1.24.1
LookupTxHashRange returns candidate tx_uids for prefixes in [lo, hi).
func (*BlockDb) PruneEpochDutiesBefore ¶ added in v1.24.0
PruneEpochDutiesBefore deletes duties objects for all epochs whose first slot is before maxFirstSlot.
func (*BlockDb) PruneExecDataBefore ¶ added in v1.20.3
PruneExecDataBefore deletes execution data for all slots before maxSlot.
func (*BlockDb) PruneSlotBidsBefore ¶ added in v1.24.4
PruneSlotBidsBefore deletes bids objects for all slots before maxSlot.
func (*BlockDb) PruneTxHashBefore ¶ added in v1.24.1
PruneTxHashBefore prunes tx-hash index entries for slots before maxSlot.
func (*BlockDb) PutTxHashes ¶ added in v1.24.1
PutTxHashes writes tx-hash index entries.
func (*BlockDb) SetTimeToSlotFn ¶ added in v1.24.1
SetTimeToSlotFn forwards a time->slot resolver used for age-based retention of the slot-keyed namespaces (exec data, duties) to whichever component runs the cleanup: the tiered engine, or the pebble backend's authoritative cleanup.
func (*BlockDb) SetTxHashIndex ¶ added in v1.24.1
func (db *BlockDb) SetTxHashIndex(idx types.TxHashIndex)
SetTxHashIndex injects a tx-hash index implementation (e.g. the relational adapter) and marks it non-native. Overrides any natively-detected index.
func (*BlockDb) SupportsDuties ¶ added in v1.24.0
SupportsDuties returns true if the underlying engine supports duties storage.
func (*BlockDb) SupportsExecData ¶ added in v1.20.3
SupportsExecData returns true if the underlying engine supports execution data storage.
func (*BlockDb) SupportsSlotBids ¶ added in v1.24.4
SupportsSlotBids returns true if the underlying engine supports per-slot bids storage.
func (*BlockDb) SupportsTxHashIndex ¶ added in v1.24.1
SupportsTxHashIndex returns true if a tx-hash index is available.
func (*BlockDb) TxHashIndexDiskUsage ¶ added in v1.24.1
TxHashIndexDiskUsage returns the approximate on-disk size of a native (engine-backed) tx-hash index, or 0 when the index is relational or absent.
func (*BlockDb) TxHashIndexNative ¶ added in v1.24.1
TxHashIndexNative reports whether the active index is engine-native (Pebble/ Tiered, written post-commit) rather than the relational adapter (written in-transaction with el_transactions).