Documentation
¶
Overview ¶
Code generated by hack/gen-logs.sh; DO NOT EDIT. This file is created and regenerated automatically. Anything added here might get removed.
Index ¶
Constants ¶
const ( EventHead = "head" EventHeadV2 = "head_v2" EventExecutionPayloadAvailable = "execution_payload_available" EventError = "error" EventConnectionError = "connection_error" )
Variables ¶
var ( // LegacyEventTopicMapping maps newer event topics to their legacy equivalents for fallback purposes. LegacyEventTopicMapping = map[string]string{ EventHeadV2: EventHead, } DefaultEventTopics = []string{EventHeadV2, EventExecutionPayloadAvailable} )
Functions ¶
func LegacyTopicFallback ¶ added in v7.1.7
LegacyTopicFallback returns topics with any topics in the input that have a legacy equivalent replaced by their legacy topic. Boolean return value indicates whether any replacements were made.
Types ¶
type EventStream ¶
type EventStream struct {
// contains filtered or unexported fields
}
EventStream is responsible for subscribing to the Beacon API events endpoint and dispatching received events to subscribers.
func NewEventStream ¶
func (*EventStream) Subscribe ¶
func (h *EventStream) Subscribe(eventsChannel chan<- *Event) error
Subscribe opens the events stream and dispatches received events on eventsChannel until the context is canceled or an error ends the stream.
type EventStreamClient ¶
type StreamGuard ¶ added in v7.1.8
type StreamGuard struct {
// contains filtered or unexported fields
}
StreamGuard ensures at most one event stream feeds a channel: starting a new run stops the previous one and waits for it to exit. The zero value is ready to use.
func (*StreamGuard) IsRunning ¶ added in v7.1.8
func (g *StreamGuard) IsRunning() bool
IsRunning reports whether the stream is connected and pumping events.
func (*StreamGuard) MarkRunning ¶ added in v7.1.8
func (g *StreamGuard) MarkRunning(running bool)
MarkRunning records whether the stream is connected and pumping events.
func (*StreamGuard) Replace ¶ added in v7.1.8
func (g *StreamGuard) Replace(ctx context.Context) (context.Context, func())
Replace stops any previous run and waits for it to exit, then registers a new one. It returns the run's context and a finish function the caller must call (typically deferred) when the run exits.