Documentation
¶
Index ¶
- type ChannelSink
- type EventQueue
- func (q *EventQueue[E]) Drain()
- func (q *EventQueue[E]) IsRunning() bool
- func (q *EventQueue[E]) Len() (inQueue, reserved int)
- func (q *EventQueue[E]) Push(e E)
- func (q *EventQueue[E]) Reserve(fn func() E)
- func (q *EventQueue[E]) Run(ctx context.Context) (remaining int, err error)
- func (q *EventQueue[E]) WaitReserved() <-chan struct{}
- type Option
- type Sink
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelSink ¶
type ChannelSink[E any] struct { // contains filtered or unexported fields }
func NewChannelSink ¶
func NewChannelSink[E any](buf uint) *ChannelSink[E]
func (*ChannelSink[E]) Outlet ¶
func (s *ChannelSink[E]) Outlet() <-chan E
type EventQueue ¶
type EventQueue[E any] struct { // contains filtered or unexported fields }
func (*EventQueue[E]) Drain ¶
func (q *EventQueue[E]) Drain()
Drain blocks until queue and reserved events become 0.
func (*EventQueue[E]) IsRunning ¶
func (q *EventQueue[E]) IsRunning() bool
func (*EventQueue[E]) Len ¶
func (q *EventQueue[E]) Len() (inQueue, reserved int)
func (*EventQueue[E]) Push ¶
func (q *EventQueue[E]) Push(e E)
func (*EventQueue[E]) Reserve ¶
func (q *EventQueue[E]) Reserve(fn func() E)
Reserve reserves update. fn will be called in a newly created goroutine.
func (*EventQueue[E]) Run ¶
func (q *EventQueue[E]) Run(ctx context.Context) (remaining int, err error)
Run runs q.
func (*EventQueue[E]) WaitReserved ¶
func (q *EventQueue[E]) WaitReserved() <-chan struct{}
WaitReserved returns a channel which is sent every time reserved event enters into the queue. The channel is closed once all reserved event, which was present at the moment WaitReserved is called, enter into the queue.
type Option ¶
type Option[E any] func(q *EventQueue[E])
type Sink ¶
type Sink[E any] interface { // Write writes the event object to Sink. // If Write returns error, the event is put back to the queue. Write(ctx context.Context, event E) error }
Sink is written once EventQueue receives events. Write is serialized in EventQueue. It can be goroutine-unsafe method.
Click to show internal directories.
Click to hide internal directories.