pebble

package
v1.22.7 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockTypeHeader  uint16 = 1
	BlockTypeBody    uint16 = 2
	BlockTypePayload uint16 = 3
	BlockTypeBal     uint16 = 4
)
View Source
const (
	KeyNamespaceBlock uint16 = 1
)
View Source
const (
	// KeyNamespaceExecData is the namespace prefix for execution data keys.
	// Each key stores the full DXTX blob for one block.
	// Slot-first ordering enables efficient range deletion for pruning.
	KeyNamespaceExecData uint16 = 2
)
View Source
const (
	// KeyNamespaceLRU is the namespace for LRU tracking data.
	KeyNamespaceLRU uint16 = 2
)

Variables

This section is empty.

Functions

func NewPebbleEngine

func NewPebbleEngine(config dtypes.PebbleBlockDBConfig) (types.BlockDbEngine, error)

Types

type CacheCleanup added in v1.21.0

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

CacheCleanup manages background cleanup of cached data.

func NewCacheCleanup added in v1.21.0

func NewCacheCleanup(engine *PebbleEngine, logger logrus.FieldLogger) *CacheCleanup

NewCacheCleanup creates a new cache cleanup manager.

func (*CacheCleanup) DeleteLRU added in v1.21.0

func (c *CacheCleanup) DeleteLRU(root []byte)

DeleteLRU removes LRU data for a block (call when deleting block data).

func (*CacheCleanup) FlushLRU added in v1.21.0

func (c *CacheCleanup) FlushLRU()

FlushLRU flushes buffered LRU updates to Pebble.

func (*CacheCleanup) RecordAccess added in v1.21.0

func (c *CacheCleanup) RecordAccess(root []byte, flags types.BlockDataFlags)

RecordAccess records an access for LRU tracking. Buffered until flush.

func (*CacheCleanup) Start added in v1.21.0

func (c *CacheCleanup) Start()

Start begins the background cleanup loop.

func (*CacheCleanup) Stop added in v1.21.0

func (c *CacheCleanup) Stop()

Stop stops the background cleanup loop.

type PebbleEngine

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

func (*PebbleEngine) AddBlock

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

AddBlock stores block data. Returns (added, updated, error). - added: true if a new block was created - updated: true if an existing block was updated with new components

func (*PebbleEngine) AddExecData added in v1.20.3

func (e *PebbleEngine) AddExecData(_ context.Context, slot uint64, blockHash []byte, data []byte) (int64, error)

AddExecData stores execution data for a block as a full DXTX blob. Returns the stored size in bytes.

func (*PebbleEngine) Close

func (e *PebbleEngine) Close() error

func (*PebbleEngine) DeleteExecData added in v1.20.3

func (e *PebbleEngine) DeleteExecData(_ context.Context, slot uint64, blockHash []byte) error

DeleteExecData deletes execution data for a specific block.

func (*PebbleEngine) GetBlock

func (e *PebbleEngine) GetBlock(
	_ context.Context,
	_ 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. Note: LRU access tracking should be done by the caller via CacheCleanup.RecordAccess() to avoid expensive read-modify-write operations on every access.

func (*PebbleEngine) GetConfig added in v1.21.0

func (e *PebbleEngine) GetConfig() dtypes.PebbleBlockDBConfig

GetConfig returns the engine configuration.

func (*PebbleEngine) GetDB added in v1.20.4

func (e *PebbleEngine) GetDB() *pebble.DB

GetDB returns the underlying pebble database for metrics collection.

func (*PebbleEngine) GetExecData added in v1.20.3

func (e *PebbleEngine) GetExecData(_ context.Context, slot uint64, blockHash []byte) ([]byte, error)

GetExecData retrieves the full DXTX blob for a block. Returns nil, nil if not found.

func (*PebbleEngine) GetExecDataRange added in v1.20.3

func (e *PebbleEngine) GetExecDataRange(_ context.Context, slot uint64, blockHash []byte, offset int64, length int64) ([]byte, error)

GetExecDataRange retrieves a byte range of the DXTX blob.

func (*PebbleEngine) GetExecDataTxSections added in v1.20.3

func (e *PebbleEngine) GetExecDataTxSections(_ context.Context, slot uint64, blockHash []byte, txHash []byte, sections uint32) (*types.ExecDataTxSections, error)

GetExecDataTxSections retrieves compressed section data for a single transaction by loading the full DXTX blob and extracting the requested sections from it.

func (*PebbleEngine) GetStoredComponents added in v1.21.0

func (e *PebbleEngine) GetStoredComponents(_ context.Context, _ uint64, root []byte) (types.BlockDataFlags, error)

GetStoredComponents returns which components exist for a block.

func (*PebbleEngine) HasExecData added in v1.20.3

func (e *PebbleEngine) HasExecData(_ context.Context, slot uint64, blockHash []byte) (bool, error)

HasExecData checks if execution data exists for a block.

func (*PebbleEngine) PruneExecDataBefore added in v1.20.3

func (e *PebbleEngine) PruneExecDataBefore(_ context.Context, maxSlot uint64) (int64, error)

PruneExecDataBefore deletes execution data for all slots before maxSlot. Returns the number of objects deleted.

Jump to

Keyboard shortcuts

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