events

package
v0.0.54 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// best to keep this > 1 epoch as some clients may send the same attestation on new epoch.
	TTL = 7 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseEvent

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

BaseEvent provides common functionality for all events.

func NewBaseEvent

func NewBaseEvent(meta *xatu.Meta) BaseEvent

func (*BaseEvent) Meta

func (e *BaseEvent) Meta() *xatu.Meta

func (*BaseEvent) Time

func (e *BaseEvent) Time() time.Time

type BeaconDataProvider

type BeaconDataProvider interface {
	// GetWallclock returns the wallclock for the beacon chain.
	GetWallclock() *ethwallclock.EthereumBeaconChain
	// GetSlot returns the wallclock slot for a given slot number.
	GetSlot(slot uint64) ethwallclock.Slot
	// GetEpoch returns the wallclock epoch for a given epoch number.
	GetEpoch(epoch uint64) ethwallclock.Epoch
	// GetEpochFromSlot returns the wallclock epoch for a given slot number.
	GetEpochFromSlot(slot uint64) ethwallclock.Epoch
	// Synced returns true if the beacon node is synced.
	Synced(ctx context.Context) error
	// Node returns the underlying beacon node instance.
	Node() beacon.Node
}

BeaconDataProvider defines the interface for getting beacon chain data needed by events.

type DuplicateCache

type DuplicateCache struct {
	BeaconETHV1EventsBlock               *ttlcache.Cache[string, time.Time]
	BeaconETHV1EventsChainReorg          *ttlcache.Cache[string, time.Time]
	BeaconETHV1EventsFinalizedCheckpoint *ttlcache.Cache[string, time.Time]
	BeaconETHV1EventsHead                *ttlcache.Cache[string, time.Time]
	BeaconETHV1EventsBlobSidecar         *ttlcache.Cache[string, time.Time]
}

func NewDuplicateCache

func NewDuplicateCache() *DuplicateCache

func (*DuplicateCache) Start

func (d *DuplicateCache) Start()

type Event

type Event interface {
	// Meta returns the metadata of the event.
	Meta() *xatu.Meta
	// Type returns the type of the event.
	Type() string
	// Time returns the time of the event.
	Time() time.Time
	// Data returns the data of the event.
	Data() interface{}
	// Decorated returns the decorated event.
	Decorated() *xatu.DecoratedEvent
	// Ignore returns true if the event should be ignored.
	Ignore(ctx context.Context) (bool, error)
}

Event is the interface that all events must implement.

type Metrics

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

Metrics is the metrics for the events package.

func NewMetrics

func NewMetrics(namespace string) *Metrics

NewMetrics creates a new Metrics instance.

func (*Metrics) AddDecoratedEvent

func (m *Metrics) AddDecoratedEvent(count int, eventType, networkID string)

AddDecoratedEvent adds a decorated event to the metrics.

type Summary

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

Summary is a struct that holds the summary of the sentry.

func NewSummary

func NewSummary(log logrus.FieldLogger, printInterval time.Duration) *Summary

NewSummary creates a new summary with the given print interval.

func (*Summary) AddEventStreamEvents

func (s *Summary) AddEventStreamEvents(topic string, count uint64)

AddEventStreamEvents adds the given count to the event stream topic.

func (*Summary) AddEventsExported

func (s *Summary) AddEventsExported(count uint64)

AddEventsExported adds the given count to the events exported.

func (*Summary) AddFailedEvents

func (s *Summary) AddFailedEvents(count uint64)

AddFailedEvents adds the given count to the failed events.

func (*Summary) GetEventStreamEvents

func (s *Summary) GetEventStreamEvents() map[string]uint64

GetEventStreamEvents returns the event stream topics and counts.

func (*Summary) GetEventsExported

func (s *Summary) GetEventsExported() uint64

GetEventsExported returns the number of events exported.

func (*Summary) GetFailedEvents

func (s *Summary) GetFailedEvents() uint64

GetFailedEvents returns the number of failed events.

func (*Summary) Print

func (s *Summary) Print()

Print prints the summary on interval.

func (*Summary) Reset

func (s *Summary) Reset()

Reset resets the summary.

func (*Summary) Start

func (s *Summary) Start(ctx context.Context)

Start starts the summary ticker.

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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