utils

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEventNotFound = errors.New("event not found")

Functions

func ExtractFromDBUrl

func ExtractFromDBUrl(url string) string

func ExtractFromWebsocketUrl

func ExtractFromWebsocketUrl(url string) (addr, proto string)

func WaitForHttpResponse

func WaitForHttpResponse(url string, timeout time.Duration) error

func WaitForTCP

func WaitForTCP(addr string, timeout time.Duration) error

Types

type EventLookup added in v0.12.0

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

func NewEventLookup added in v0.12.0

func NewEventLookup(opts ...Option) *EventLookup

func (*EventLookup) AddEvent added in v0.12.0

func (e *EventLookup) AddEvent(
	event *eventv1.Event,
	track *trackv1.Track,
	recordingMode providerev1.RecordingMode,
) *EventProcessingData

func (*EventLookup) Clear added in v0.12.0

func (e *EventLookup) Clear()

removes all events from the lookup

func (*EventLookup) Close added in v0.15.0

func (e *EventLookup) Close()

removes all events and signals shutdown to internal services (for example: watchdogs)

func (*EventLookup) GetEvent added in v0.12.0

func (e *EventLookup) GetEvent(selector *commonv1.EventSelector) (
	*EventProcessingData, error,
)

func (*EventLookup) GetEvents added in v0.12.0

func (e *EventLookup) GetEvents() []*EventProcessingData

func (*EventLookup) RemoveEvent added in v0.12.0

func (e *EventLookup) RemoveEvent(selector *commonv1.EventSelector)

type EventProcessingData added in v0.12.0

type EventProcessingData struct {
	Event               *eventv1.Event
	Track               *trackv1.Track
	Processor           *processing.Processor
	AnalysisBroadcast   broadcast.BroadcastServer[*analysisv1.Analysis]
	RacestateBroadcast  broadcast.BroadcastServer[*racestatev1.PublishStateRequest]
	DriverDataBroadcast broadcast.BroadcastServer[*racestatev1.PublishDriverDataRequest]
	SpeedmapBroadcast   broadcast.BroadcastServer[*racestatev1.PublishSpeedmapRequest]
	ReplayInfoBroadcast broadcast.BroadcastServer[*eventv1.ReplayInfo]
	SnapshotBroadcast   broadcast.BroadcastServer[*analysisv1.SnapshotData]
	Mutex               sync.Mutex
	LastDriverData      *racestatev1.PublishDriverDataRequest
	LastAnalysisData    *analysisv1.Analysis
	LastReplayInfo      *eventv1.ReplayInfo
	RecordingMode       providerev1.RecordingMode
	LastRsInfoId        int                        // holds the last rs_info_id for storing state data
	LastDataEvent       time.Time                  // holds the time of the last incoming data event
	SnapshotData        []*analysisv1.SnapshotData // holds the snapshot data for current event
}

func (*EventProcessingData) MarkDataEvent added in v0.15.0

func (epd *EventProcessingData) MarkDataEvent()

type Option added in v0.15.0

type Option func(*EventLookup)

func WithContext added in v0.15.0

func WithContext(ctx context.Context) Option

func WithStaleDuration added in v0.15.0

func WithStaleDuration(d time.Duration) Option

if staleDuration > 0, a watchdog will be started to remove stale events

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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