event

package
v7.1.8 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

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

View Source
const (
	EventHead                      = "head"
	EventHeadV2                    = "head_v2"
	EventExecutionPayloadAvailable = "execution_payload_available"

	EventError           = "error"
	EventConnectionError = "connection_error"
)

Variables

View Source
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

func LegacyTopicFallback(topics []string) ([]string, bool)

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 Event

type Event struct {
	EventType string
	Data      []byte
}

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 NewEventStream(ctx context.Context, httpClient *http.Client, host string, topics []string) (*EventStream, error)

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 EventStreamClient interface {
	Subscribe(eventsChannel chan<- *Event) error
}

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.

Jump to

Keyboard shortcuts

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