tiered

package
v1.24.3 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTieredEngine

func NewTieredEngine(pebbleConfig dtypes.PebbleBlockDBConfig, s3Config dtypes.S3BlockDBConfig, logger logrus.FieldLogger) (types.BlockDbEngine, error)

NewTieredEngine creates a new tiered storage engine from the shared pebble (cache) and s3 (primary) configs.

Types

type TieredEngine

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

TieredEngine combines Pebble (cache) and S3 (primary storage) in a tiered architecture. Reads check cache first, then fall back to S3. Writes go to both (write-through).

func (*TieredEngine) AddBlock

func (e *TieredEngine) AddBlock(
	ctx context.Context,
	slot uint64,
	root []byte,
	dataCb func() (*types.BlockData, error),
) (bool, bool, error)

AddBlock stores block data using write-through to both cache and S3. Returns (added, updated, error).

func (*TieredEngine) AddEpochDuties added in v1.24.0

func (e *TieredEngine) AddEpochDuties(ctx context.Context, duties *types.EpochDuties) (int64, error)

AddEpochDuties stores duties write-through to S3 (primary) and the Pebble cache.

func (*TieredEngine) AddExecData added in v1.24.1

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

AddExecData stores execution data write-through: S3 (primary, authoritative) then the Pebble cache (best-effort). Returns the authoritative stored size.

func (*TieredEngine) Close

func (e *TieredEngine) Close() error

Close closes both storage engines.

func (*TieredEngine) DeleteExecData added in v1.24.1

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

DeleteExecData removes execution data from both tiers.

func (*TieredEngine) EstimateTxHashIndexSize added in v1.24.1

func (e *TieredEngine) EstimateTxHashIndexSize() int64

EstimateTxHashIndexSize returns the index's approximate on-disk size in the pebble cache (where it is pinned).

func (*TieredEngine) GetBlock

func (e *TieredEngine) 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. Checks cache first, fetches missing components from S3.

func (*TieredEngine) GetCache added in v1.24.1

func (e *TieredEngine) GetCache() *pebble.PebbleEngine

GetCache returns the Pebble cache tier (for metrics/debug).

func (*TieredEngine) GetEpochDuties added in v1.24.0

func (e *TieredEngine) GetEpochDuties(ctx context.Context, firstSlot uint64) (*types.EpochDuties, error)

GetEpochDuties retrieves the full duties, checking the cache first.

func (*TieredEngine) GetExecData added in v1.24.1

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

GetExecData returns the full DXTX blob, checking the cache first and populating it from S3 on a miss.

func (*TieredEngine) GetExecDataRange added in v1.24.1

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

GetExecDataRange returns a byte range of the DXTX blob, serving from the cache when the object is cached and falling back to S3 range reads otherwise.

func (*TieredEngine) GetExecDataTxSections added in v1.24.1

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

GetExecDataTxSections returns the requested per-tx sections, serving from the cache when the object is cached and falling back to S3's efficient range reads otherwise. A single-tx view is not worth pulling the full blob to cache.

func (*TieredEngine) GetPrimary added in v1.24.1

func (e *TieredEngine) GetPrimary() *s3.S3Engine

GetPrimary returns the S3 primary tier (for metrics/debug).

func (*TieredEngine) GetSlotCommittees added in v1.24.0

func (e *TieredEngine) GetSlotCommittees(ctx context.Context, firstSlot uint64, slot uint64) ([][]uint64, error)

GetSlotCommittees reads a slot's committees, checking the cache first and populating it from S3 on a miss.

func (*TieredEngine) GetSlotPtc added in v1.24.0

func (e *TieredEngine) GetSlotPtc(ctx context.Context, firstSlot uint64, slot uint64) ([]uint64, error)

GetSlotPtc reads a slot's PTC, checking the cache first.

func (*TieredEngine) GetStoredComponents

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

GetStoredComponents returns which components exist for a block. Checks cache first, then S3.

func (*TieredEngine) HasEpochDuties added in v1.24.0

func (e *TieredEngine) HasEpochDuties(ctx context.Context, firstSlot uint64) (bool, error)

HasEpochDuties checks the cache first, then S3.

func (*TieredEngine) HasExecData added in v1.24.1

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

HasExecData checks the cache first, then S3.

func (*TieredEngine) LookupTxHash added in v1.24.1

func (e *TieredEngine) LookupTxHash(ctx context.Context, prefix []byte) ([]uint64, error)

func (*TieredEngine) LookupTxHashRange added in v1.24.1

func (e *TieredEngine) LookupTxHashRange(ctx context.Context, lo, hi []byte) ([]uint64, error)

func (*TieredEngine) PruneEpochDutiesBefore added in v1.24.0

func (e *TieredEngine) PruneEpochDutiesBefore(ctx context.Context, maxFirstSlot uint64) (int64, error)

PruneEpochDutiesBefore prunes duties from both tiers.

func (*TieredEngine) PruneExecDataBefore added in v1.24.1

func (e *TieredEngine) PruneExecDataBefore(ctx context.Context, maxSlot uint64) (int64, error)

PruneExecDataBefore prunes execution data from both tiers (authoritative retention, distinct from cache eviction). Returns the primary's count.

func (*TieredEngine) PruneTxHashBefore added in v1.24.1

func (e *TieredEngine) PruneTxHashBefore(ctx context.Context, maxSlot uint64) (int64, error)

func (*TieredEngine) PutTxHashes added in v1.24.1

func (e *TieredEngine) PutTxHashes(ctx context.Context, entries []types.TxHashEntry) error

func (*TieredEngine) SetTimeToSlotFn added in v1.24.1

func (e *TieredEngine) SetTimeToSlotFn(fn func(t time.Time) uint64)

SetTimeToSlotFn installs the time->slot resolver used by the Pebble cache's age-based eviction of slot-keyed namespaces (exec data, duties).

func (*TieredEngine) TierStats added in v1.24.1

func (e *TieredEngine) TierStats() (hits, misses int64)

TierStats returns the tier-level cache hit/miss counts.

Jump to

Keyboard shortcuts

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