eventticker

package
v1.0.0-rc.3.0...-64c530f Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: Apache-2.0, BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MaxRequestThreshold

func MaxRequestThreshold[T slot.IndexedID](maxRequestThreshold int) options.Option[EventTicker[T]]

MaxRequestThreshold creates an option which defines how often the EventTicker should try to request blocks before canceling the request.

func RetryInterval

func RetryInterval[T slot.IndexedID](interval time.Duration) options.Option[EventTicker[T]]

RetryInterval creates an option which sets the retry interval to the given value.

func RetryJitter

func RetryJitter[T slot.IndexedID](retryJitter time.Duration) options.Option[EventTicker[T]]

RetryJitter creates an option which sets the retry jitter to the given value.

Types

type EventTicker

type EventTicker[T slot.IndexedID] struct {
	Events *Events[T]
	// contains filtered or unexported fields
}

EventTicker takes care of requesting blocks.

func New

func New[T slot.IndexedID](opts ...options.Option[EventTicker[T]]) *EventTicker[T]

New creates a new block requester.

func (*EventTicker[T]) EvictUntil

func (r *EventTicker[T]) EvictUntil(index slot.Index)

func (*EventTicker[T]) HasTicker

func (r *EventTicker[T]) HasTicker(id T) bool

func (*EventTicker[T]) QueueSize

func (r *EventTicker[T]) QueueSize() int

func (*EventTicker[T]) Shutdown

func (r *EventTicker[T]) Shutdown()

func (*EventTicker[T]) StartTicker

func (r *EventTicker[T]) StartTicker(id T)

func (*EventTicker[T]) StartTickers

func (r *EventTicker[T]) StartTickers(ids []T)

func (*EventTicker[T]) StopTicker

func (r *EventTicker[T]) StopTicker(id T)

type Events

type Events[T slot.IndexedID] struct {
	// Request is an event that is triggered when the requester wants to request the given entity.
	Tick *event.Event1[T]

	// RequestQueued is an event that is triggered when a new request is started.
	TickerStarted *event.Event1[T]

	// RequestStopped is an event that is triggered when a request is stopped.
	TickerStopped *event.Event1[T]

	// RequestFailed is an event that is triggered when a request is stopped after too many attempts.
	TickerFailed *event.Event1[T]

	event.Group[Events[T], *Events[T]]
}

Events represents events happening on a EventTicker.

func NewEvents

func NewEvents[T slot.IndexedID](linkedEvents ...*Events[T]) (newEvents *Events[T])

NewEvents contains the constructor of the Events object (it is generated by a generic factory).

Jump to

Keyboard shortcuts

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