cache

package
v0.1.1-experimental.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PayloadIDCache

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

PayloadIDCache provides a mechanism to store and retrieve payload IDs based on slot and parent block hash. It is designed to improve the efficiency of payload ID retrieval by caching recent entries.

func NewPayloadIDCache

func NewPayloadIDCache() *PayloadIDCache

NewPayloadIDCache initializes and returns a new instance of PayloadIDCache. It prepares the internal data structures for storing payload ID mappings.

func (*PayloadIDCache) Get

func (p *PayloadIDCache) Get(slot primitives.Slot, stateRoot [32]byte,
) (engine.PayloadID, bool)

Get retrieves the payload ID associated with a given slot and eth1 hash. It returns the found payload ID and a boolean indicating whether the lookup was successful.

func (*PayloadIDCache) Set

func (p *PayloadIDCache) Set(
	slot primitives.Slot, stateRoot [32]byte, pid engine.PayloadID,
)

Set updates or inserts a payload ID for a given slot and eth1 hash. It also prunes entries in the cache that are older than the historicalPayloadIDCacheSize limit.

func (*PayloadIDCache) UnsafePrunePrior

func (p *PayloadIDCache) UnsafePrunePrior(slot primitives.Slot)

UnsafePrunePrior removes payload IDs from the cache for slots less than the specified slot. Only used for testing.

Jump to

Keyboard shortcuts

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