indexer

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ServiceType = "tracoor.indexer"

	KeyNode                    = "node"
	KeyBlockRoot               = "block_root"
	KeyBlockHash               = "block_hash"
	KeyBlockNumber             = "block_number"
	KeyExecutionImplementation = "execution_implementation"
	KeyNetwork                 = "network"
	KeySlot                    = "slot"
	KeyEpoch                   = "epoch"
	KeyStateRoot               = "state_root"
	KeyContentEncoding         = "content_encoding"
	KeyNodeVersion             = "node_version"
	KeyLocation                = "location"
	KeyFetchedAt               = "fetched_at"
	KeyBeaconImplementation    = "beacon_implementation"
	KeyID                      = "id"
	KeyIndex                   = "index"
	KeyLockKey                 = "lock_key"
	KeyKind                    = "kind"
	KeyDedupKey                = "dedup_key"

	OrderFetchedAtDesc = "fetched_at DESC"
	OrderFetchedAtAsc  = "fetched_at ASC"
)

Variables

This section is empty.

Functions

func DBBeaconBadBlobToProtoBeaconBadBlob added in v0.0.16

func DBBeaconBadBlobToProtoBeaconBadBlob(bs *persistence.BeaconBadBlob) *indexer.BeaconBadBlob

func DBBeaconBadBlockToProtoBeaconBadBlock added in v0.0.16

func DBBeaconBadBlockToProtoBeaconBadBlock(bs *persistence.BeaconBadBlock) *indexer.BeaconBadBlock

func DBBeaconBlockToProtoBeaconBlock added in v0.0.16

func DBBeaconBlockToProtoBeaconBlock(bs *persistence.BeaconBlock) *indexer.BeaconBlock

func DBBeaconStateToProtoBeaconState

func DBBeaconStateToProtoBeaconState(bs *persistence.BeaconState) *indexer.BeaconState

func DBBlobToProtoBlob added in v0.1.0

func DBBlobToProtoBlob(b *persistence.Blob) *indexer.Blob

func DBExecutionBadBlockToProtoExecutionBadBlock

func DBExecutionBadBlockToProtoExecutionBadBlock(eb *persistence.ExecutionBadBlock) *indexer.ExecutionBadBlock

func DBExecutionBlockTraceToProtoExecutionBlockTrace

func DBExecutionBlockTraceToProtoExecutionBlockTrace(eb *persistence.ExecutionBlockTrace) *indexer.ExecutionBlockTrace

func DBExecutionPayloadEnvelopeToProtoExecutionPayloadEnvelope added in v0.1.0

func DBExecutionPayloadEnvelopeToProtoExecutionPayloadEnvelope(bs *persistence.ExecutionPayloadEnvelope) *indexer.ExecutionPayloadEnvelope

func DBPaginationCursorToProtoPaginationCursor

func DBPaginationCursorToProtoPaginationCursor(pc *persistence.PaginationCursor) *indexer.PaginationCursor

func DBPayloadDivergenceToProtoPayloadDivergence added in v0.1.0

func DBPayloadDivergenceToProtoPayloadDivergence(d *persistence.PayloadDivergence) *indexer.PayloadDivergence

func ProtoBeaconBadBlobToDBBeaconBadBlob added in v0.0.16

func ProtoBeaconBadBlobToDBBeaconBadBlob(bs *indexer.BeaconBadBlob) *persistence.BeaconBadBlob

func ProtoBeaconBadBlockToDBBeaconBadBlock added in v0.0.16

func ProtoBeaconBadBlockToDBBeaconBadBlock(bs *indexer.BeaconBadBlock) *persistence.BeaconBadBlock

func ProtoBeaconBlockToDBBeaconBlock added in v0.0.16

func ProtoBeaconBlockToDBBeaconBlock(bs *indexer.BeaconBlock) *persistence.BeaconBlock

func ProtoBeaconStateToDBBeaconState

func ProtoBeaconStateToDBBeaconState(bs *indexer.BeaconState) *persistence.BeaconState

func ProtoExecutionBadBlockToDBExecutionBadBlock

func ProtoExecutionBadBlockToDBExecutionBadBlock(eb *indexer.ExecutionBadBlock) *persistence.ExecutionBadBlock

func ProtoExecutionBlockTraceToDBExecutionBlockTrace

func ProtoExecutionBlockTraceToDBExecutionBlockTrace(eb *indexer.ExecutionBlockTrace) *persistence.ExecutionBlockTrace

func ProtoExecutionPayloadEnvelopeToDBExecutionPayloadEnvelope added in v0.1.0

func ProtoExecutionPayloadEnvelopeToDBExecutionPayloadEnvelope(bs *indexer.ExecutionPayloadEnvelope) *persistence.ExecutionPayloadEnvelope

func ProtoPaginationCursorToDBPaginationCursor

func ProtoPaginationCursorToDBPaginationCursor(pc *indexer.PaginationCursor) (*persistence.PaginationCursor, error)

func ProtoPayloadDivergenceToDBPayloadDivergence added in v0.1.0

func ProtoPayloadDivergenceToDBPayloadDivergence(d *indexer.PayloadDivergence) *persistence.PayloadDivergence

Types

type BlockConfig added in v0.0.27

type BlockConfig struct {
	Enabled bool `yaml:"enabled" default:"false"`
}

type Config

type Config struct {
	Retention      RetentionConfig      `yaml:"retention"`
	PermanentStore PermanentStoreConfig `yaml:"permanentStore"`

	// BlobGCGracePeriod is the minimum age of a zero-reference payload before it may be
	// collected. It must exceed the longest plausible fetch-plus-upload plus the agents'
	// payload-lookup cache TTL, so an agent mid-hash cannot link to a payload being deleted.
	BlobGCGracePeriod human.Duration `yaml:"blobGcGracePeriod" default:"10m"`
}

func (*Config) Validate

func (c *Config) Validate() error

type Indexer

type Indexer struct {
	indexer.IndexerServer
	// contains filtered or unexported fields
}

func NewIndexer

func NewIndexer(ctx context.Context, log logrus.FieldLogger, conf *Config, db *persistence.Indexer, st store.Store, ethereumConfig *ethereum.Config) (*Indexer, error)

func NewMockIndexer added in v0.0.15

func NewMockIndexer(ctx context.Context, config *Config) (*Indexer, func() error, error)

func (*Indexer) CountBeaconBadBlob added in v0.0.16

func (*Indexer) CountBeaconBadBlock added in v0.0.16

func (*Indexer) CountBeaconBlock added in v0.0.16

func (*Indexer) CountExecutionPayloadEnvelope added in v0.1.0

func (*Indexer) CreateBeaconBadBlob added in v0.0.16

func (*Indexer) CreateBeaconBadBlock added in v0.0.16

func (*Indexer) CreateBeaconBlock added in v0.0.16

func (*Indexer) CreateBlob added in v0.1.0

func (*Indexer) CreateExecutionPayloadEnvelope added in v0.1.0

func (*Indexer) CreatePayloadDivergence added in v0.1.0

func (*Indexer) GetBlob added in v0.1.0

func (*Indexer) GetConfig added in v0.0.22

func (*Indexer) ListBeaconBadBlob added in v0.0.16

func (*Indexer) ListBeaconBadBlock added in v0.0.16

func (*Indexer) ListBeaconBlock added in v0.0.16

func (*Indexer) ListBeaconState

func (*Indexer) ListExecutionPayloadEnvelope added in v0.1.0

func (*Indexer) ListPayloadDivergence added in v0.1.0

func (*Indexer) ListUniqueBeaconBadBlobValues added in v0.0.16

func (*Indexer) ListUniqueBeaconBadBlockValues added in v0.0.16

func (*Indexer) ListUniqueBeaconBlockValues added in v0.0.16

func (*Indexer) Start

func (i *Indexer) Start(ctx context.Context, grpcServer *grpc.Server) error

func (*Indexer) Stop

func (i *Indexer) Stop(ctx context.Context) error

func (*Indexer) Store added in v0.0.15

func (i *Indexer) Store() store.Store

type Metrics

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

Metrics covers what retention does and what it declines to do. The skip reasons matter as much as the successes: a collector that keeps deciding not to collect is the failure mode that would otherwise be invisible.

func NewMetrics

func NewMetrics(namespace string) *Metrics

NewMetrics returns the process-wide indexer metrics. Collectors are registered once: a second indexer in the same process shares them rather than fighting the registry.

func (*Metrics) ObserveArchiveHoldback added in v0.1.0

func (m *Metrics) ObserveArchiveHoldback(reason string, count int64)

ObserveArchiveHoldback records block rows a purge pass left in place because the permanent store had not confirmed them. A rising count is the archive falling behind retention — the failure mode that silently lost blocks before rows were held back.

func (*Metrics) ObserveBlobCollected added in v0.1.0

func (m *Metrics) ObserveBlobCollected()

func (*Metrics) ObserveBlobGCSkipped added in v0.1.0

func (m *Metrics) ObserveBlobGCSkipped(reason string)

func (*Metrics) ObservePurgeDuration added in v0.1.0

func (m *Metrics) ObservePurgeDuration(kind string, seconds float64)

func (*Metrics) ObserveRootDivergence added in v0.1.0

func (m *Metrics) ObserveRootDivergence(network, kind, cause string)

func (*Metrics) ObserveRowsPurged added in v0.1.0

func (m *Metrics) ObserveRowsPurged(kind string, count int64)

func (*Metrics) SetPurgeBacklog added in v0.1.0

func (m *Metrics) SetPurgeBacklog(kind string, rows int64)

type PermanentStore added in v0.0.27

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

PermanentStore ensures that at least one copy of each block per network is retained by copying it to a permanent location in the store.

func NewPermanentStore added in v0.0.27

func NewPermanentStore(log logrus.FieldLogger, st store.Store, db *persistence.Indexer, nodeID string, conf *PermanentStoreConfig) (*PermanentStore, error)

NewPermanentStore creates a new permanent store.

func (*PermanentStore) GetPermanentLocation added in v0.0.28

func (p *PermanentStore) GetPermanentLocation(block PermanentStoreBlock) string

GetPermanentLocation returns the permanent location for an artifact. Beacon blocks keep the layout they have always had, so archives written before envelopes existed still resolve; every other kind gets its own subdirectory, which is also what keeps a block and its envelope - same root, same extension - from being the same object.

func (*PermanentStore) IsEnabled added in v0.0.27

func (p *PermanentStore) IsEnabled() bool

IsEnabled reports whether the permanent store archives anything at all.

func (*PermanentStore) IsEnabledFor added in v0.1.0

func (p *PermanentStore) IsEnabledFor(kind string) bool

IsEnabledFor reports whether this kind of artifact is archived.

func (*PermanentStore) QueueBlock added in v0.0.27

func (p *PermanentStore) QueueBlock(block PermanentStoreBlock)

QueueBlock adds a block to the queue for processing. Every path that does not hand the block to a worker signals ProcessedChan itself — with a not-archived result — so a caller waiting on it is never stranded and never mistakes a dropped block for an archived one.

func (*PermanentStore) Start added in v0.0.27

func (p *PermanentStore) Start(ctx context.Context) error

Start starts the permanent store.

func (*PermanentStore) Stop added in v0.0.27

func (p *PermanentStore) Stop(ctx context.Context) error

Stop stops the permanent store.

type PermanentStoreBlock added in v0.0.27

type PermanentStoreBlock struct {
	Kind      string
	Location  string
	BlockRoot string
	Network   string
	Slot      phase0.Slot
	// ProcessedChan, when non-nil, receives exactly one result and is then closed. It must
	// be buffered: the send never blocks, so on an unbuffered channel a waiter that has
	// already given up costs the result its value and the close reads as not archived.
	ProcessedChan chan PermanentStoreResult
}

PermanentStoreBlock contains the minimal information needed to identify an archivable artifact. Kind distinguishes the two artifacts that share a block root from gloas on - the beacon block and its execution payload envelope - and an empty Kind means persistence.KindBeaconBlock, which is what every caller meant before envelopes existed.

type PermanentStoreConfig added in v0.0.27

type PermanentStoreConfig struct {
	Blocks BlockConfig `yaml:"blocks"`
	// ExecutionPayloadEnvelopes is its own switch, but archiving gloas blocks without it
	// keeps only half of each slot: the payload lives in the envelope from that fork on.
	ExecutionPayloadEnvelopes BlockConfig `yaml:"executionPayloadEnvelopes"`
}

type PermanentStoreResult added in v0.1.0

type PermanentStoreResult struct {
	Archived bool
}

PermanentStoreResult is what became of a queued block. Archived is true only when the block is known to be present in the permanent store; a full queue, a lost lock or a worker error all report false, so a waiter can hold its row back rather than purge an object the archive never received.

type RetentionConfig

type RetentionConfig struct {
	BeaconStates              human.Duration `yaml:"beaconStates" default:"30m"`
	BeaconBlocks              human.Duration `yaml:"beaconBlocks" default:"30m"`
	ExecutionPayloadEnvelopes human.Duration `yaml:"executionPayloadEnvelopes" default:"30m"`
	BeaconBadBlocks           human.Duration `yaml:"beaconBadBlocks" default:"312480m"` // 6 months
	BeaconBadBlobs            human.Duration `yaml:"beaconBadBlobs" default:"312480m"`  // 6 months
	ExecutionBlockTraces      human.Duration `yaml:"executionBlockTraces" default:"30m"`
	ExecutionBadBlocks        human.Duration `yaml:"executionBadBlocks" default:"312480m"` // 6 months
	// PayloadDivergences bounds the divergence log. It is deliberately long: the record of a
	// node serving the wrong bytes is the finding, and it outlives the payload it describes.
	PayloadDivergences human.Duration `yaml:"payloadDivergences" default:"312480m"` // 6 months
}

Jump to

Keyboard shortcuts

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