snooper

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClientTypeID

func GetClientTypeID(clientName string) uint8

GetClientTypeID maps client names to type IDs

func GetClientTypeName

func GetClientTypeName(clientTypeID uint8) string

GetClientTypeName maps client type IDs to names

Types

type BeaconExecutionTime

type BeaconExecutionTime struct {
	Client *execution.Client // snooper client
	Time   uint16            // milliseconds
	Added  time.Time         // when this was recorded
}

BeaconExecutionTime represents execution timing data compatible with beacon package

func (*BeaconExecutionTime) GetClient

func (e *BeaconExecutionTime) GetClient() *execution.Client

Implement ExecutionTimeData interface

func (*BeaconExecutionTime) GetTime

func (e *BeaconExecutionTime) GetTime() uint16

type BlockHashRingBuffer

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

BlockHashRingBuffer implements an efficient ring buffer for storing block hashes

func NewBlockHashRingBuffer

func NewBlockHashRingBuffer(capacity int) *BlockHashRingBuffer

NewBlockHashRingBuffer creates a new ring buffer with the specified capacity

func (*BlockHashRingBuffer) Add

func (rb *BlockHashRingBuffer) Add(hash common.Hash)

Add adds a block hash to the ring buffer

func (*BlockHashRingBuffer) Clear

func (rb *BlockHashRingBuffer) Clear()

Clear removes all elements from the buffer

func (*BlockHashRingBuffer) Contains

func (rb *BlockHashRingBuffer) Contains(hash common.Hash) bool

Contains checks if a block hash exists in the ring buffer

func (*BlockHashRingBuffer) Size

func (rb *BlockHashRingBuffer) Size() int

Size returns the current number of elements in the buffer

type ExecutionTimeCache

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

ExecutionTimeCache temporarily stores execution times for blocks that haven't been processed yet

func NewExecutionTimeCache

func NewExecutionTimeCache(ttl time.Duration) *ExecutionTimeCache

NewExecutionTimeCache creates a new execution time cache

func (*ExecutionTimeCache) Close

func (c *ExecutionTimeCache) Close()

Close stops the cache cleanup routine

func (*ExecutionTimeCache) Delete

func (c *ExecutionTimeCache) Delete(blockHash common.Hash)

Delete removes execution times for a specific block hash

func (*ExecutionTimeCache) Get

func (c *ExecutionTimeCache) Get(blockHash common.Hash) []BeaconExecutionTime

Get retrieves execution times for a specific block hash

func (*ExecutionTimeCache) GetAndDelete

func (c *ExecutionTimeCache) GetAndDelete(blockHash common.Hash) []BeaconExecutionTime

GetAndDelete atomically retrieves and removes execution times for a specific block hash

func (*ExecutionTimeCache) GetStats

func (c *ExecutionTimeCache) GetStats() (int, int)

GetStats returns cache statistics

func (*ExecutionTimeCache) Set

func (c *ExecutionTimeCache) Set(blockHash common.Hash, client *execution.Client, execTime time.Duration)

Set stores an execution time for a specific block hash and client type

type ExecutionTimeEvent

type ExecutionTimeEvent struct {
	BlockHash     common.Hash
	BlockNumber   uint64
	ClientID      uint16
	ExecutionTime time.Duration
	Timestamp     time.Time
}

ExecutionTimeEvent represents a block execution time event

type ExecutionTimeProviderImpl

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

ExecutionTimeProviderImpl implements the ExecutionTimeProvider interface

func NewExecutionTimeProvider

func NewExecutionTimeProvider(cache *ExecutionTimeCache) *ExecutionTimeProviderImpl

NewExecutionTimeProvider creates a new execution time provider

func (*ExecutionTimeProviderImpl) GetAndDeleteExecutionTimes

func (p *ExecutionTimeProviderImpl) GetAndDeleteExecutionTimes(blockHash common.Hash) []beacon.ExecutionTimeData

GetAndDeleteExecutionTimes implements the ExecutionTimeProvider interface

type SnooperManager

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

SnooperManager manages snooper clients for execution time tracking

func NewSnooperManager

func NewSnooperManager(logger logrus.FieldLogger, indexer *beacon.Indexer) *SnooperManager

NewSnooperManager creates a new snooper manager

func (*SnooperManager) AddClient

func (sm *SnooperManager) AddClient(executionClient *execution.Client, snooperURL string) error

AddClient adds a new snooper client for an execution client

func (*SnooperManager) Close

func (sm *SnooperManager) Close() error

Close gracefully shuts down the snooper manager

func (*SnooperManager) GetCache

func (sm *SnooperManager) GetCache() *ExecutionTimeCache

GetCache returns the execution time cache

func (*SnooperManager) HandleExecutionTimeEvent

func (sm *SnooperManager) HandleExecutionTimeEvent(event *ExecutionTimeEvent)

HandleExecutionTimeEvent processes execution time events from tracer_event messages

func (*SnooperManager) HasClients

func (sm *SnooperManager) HasClients() bool

HasClients returns true if any snooper clients are configured

func (*SnooperManager) RemoveClient

func (sm *SnooperManager) RemoveClient(clientID uint16)

RemoveClient removes a snooper client

Jump to

Keyboard shortcuts

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