Documentation
¶
Index ¶
- func WithCallbacksDemux[T, C any](d Demultiplexer[Event[C]]) options.Option[reactor[T, C]]
- func WithCloneFn[T any](f func(T) T) options.Option[DemuxOptions[T]]
- func WithControlQueueCapcity[T any](capacity int) options.Option[DemuxOptions[T]]
- func WithEventQueue[T any](q core.Queue[T]) options.Option[DemuxOptions[T]]
- func WithEventsDemux[T, C any](d Demultiplexer[Event[T]]) options.Option[reactor[T, C]]
- func WithTimes[T, C any](tick, timeout time.Duration) options.Option[reactor[T, C]]
- type Demultiplexer
- type DemuxOptions
- type Event
- type EventHandler
- type ID
- type ReactiveService
- type Reactor
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithCallbacksDemux ¶ added in v0.0.3
func WithCallbacksDemux[T, C any](d Demultiplexer[Event[C]]) options.Option[reactor[T, C]]
func WithCloneFn ¶ added in v0.0.3
func WithCloneFn[T any](f func(T) T) options.Option[DemuxOptions[T]]
func WithControlQueueCapcity ¶ added in v0.0.4
func WithControlQueueCapcity[T any](capacity int) options.Option[DemuxOptions[T]]
func WithEventQueue ¶ added in v0.0.2
func WithEventsDemux ¶ added in v0.0.3
func WithEventsDemux[T, C any](d Demultiplexer[Event[T]]) options.Option[reactor[T, C]]
Types ¶
type Demultiplexer ¶ added in v0.0.3
type Demultiplexer[T any] interface { io.Closer // Start starts the event loop Start(context.Context) error // Enqueue adds a new event to the event queue Enqueue(T) // Register registers handlers. It accepts the event selector, amount of goroutine workers // that will be used to process events, and the handlers that will be called. Register(id string, s Service[T], workers int) // Unregister unregisters handlers Unregister(id string) }
Demultiplexer provides a thread-safe, non-blocking, asynchronous event processing. Using lock-free queues for events and control messages, and atomic pointers to manage states and workers. This component can be used instead of go channels in cases of multiple parallel readers
func NewDemux ¶ added in v0.0.3
func NewDemux[T any](opts ...options.Option[DemuxOptions[T]]) Demultiplexer[T]
type DemuxOptions ¶ added in v0.0.4
type DemuxOptions[T any] struct { // contains filtered or unexported fields }
type EventHandler ¶ added in v0.0.3
EventHandler is a function that handles events, it accepts a callback function as a second parameter. The callback function is expected to be called once the event was processed
type ID ¶ added in v0.0.3
type ID []byte
ID is the ID used for events
func IDFromString ¶ added in v0.0.3
type ReactiveService ¶ added in v0.0.3
Click to show internal directories.
Click to hide internal directories.