Documentation ¶
Index ¶
- type AddEvent
- type AddEventOptions
- type AddStream
- type AddStreamOptions
- type Reader
- func WithReaderBlockDuration(d time.Duration) Reader
- func WithReaderBufferSize(size int) Reader
- func WithReaderMaxPolled(n int64) Reader
- func WithReaderStartAfter(id string) Reader
- func WithReaderStartAt(startAt time.Time) Reader
- func WithReaderStartAtNewest() Reader
- func WithReaderStartAtOldest() Reader
- func WithReaderTopic(topic string) Reader
- func WithReaderTopicPattern(pattern string) Reader
- type ReaderOptions
- type Sink
- func WithSinkAckGracePeriod(d time.Duration) Sink
- func WithSinkBlockDuration(d time.Duration) Sink
- func WithSinkBufferSize(size int) Sink
- func WithSinkMaxPolled(n int64) Sink
- func WithSinkNoAck() Sink
- func WithSinkStartAfter(id string) Sink
- func WithSinkStartAt(startAt time.Time) Sink
- func WithSinkStartAtNewest() Sink
- func WithSinkStartAtOldest() Sink
- func WithSinkTopic(topic string) Sink
- func WithSinkTopicPattern(pattern string) Sink
- type SinkOptions
- type Stream
- type StreamOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddEvent ¶
type AddEvent func(*AddEventOptions)
AddEvent is an option for adding an event to a stream.
func WithOnlyIfStreamExists ¶
func WithOnlyIfStreamExists() AddEvent
WithOnlyIfStreamExists only adds the event if the stream exists.
type AddEventOptions ¶
func ParseAddEventOptions ¶
func ParseAddEventOptions(opts ...AddEvent) AddEventOptions
ParseAddEventOptions parses the given options and returns the corresponding AddEventOptions.
type AddStream ¶
type AddStream func(*AddStreamOptions)
AddStream is an option for adding a stream to a sink.
func WithAddStreamStartAfter ¶
WithAddStreamStartAfter sets the last read event ID, the sink will start reading from the next event. Only one of WithAddStreamStartAtNewest, WithAddStreamStartAtOldest, WithAddStreamStartAfter or WithAddStreamStartAt can be used.
func WithAddStreamStartAt ¶
WithAddStreamStartAt sets the start position for the added stream to the event added on or after startAt. Only one of WithAddStreamStartAtNewest, WithAddStreamStartAtOldest, WithAddStreamStartAfter or WithAddStreamStartAt can be used.
func WithAddStreamStartAtNewest ¶
func WithAddStreamStartAtNewest() AddStream
WithAddStreamStartAtNewest sets the sink start position for the added stream to the newest event. Only one of WithAddStreamStartAtNewest, WithAddStreamStartAtOldest, WithAddStreamStartAfter or WithAddStreamStartAt can be used.
func WithAddStreamStartAtOldest ¶
func WithAddStreamStartAtOldest() AddStream
WithAddStreamStartAtOldest sets the sink start position for the added stream to the oldest event. Only one of WithAddStreamStartAtNewest, WithAddStreamStartAtOldest, WithAddStreamStartAfter or WithAddStreamStartAt can be used.
type AddStreamOptions ¶
type AddStreamOptions struct {
LastEventID string
}
func ParseAddStreamOptions ¶
func ParseAddStreamOptions(opts ...AddStream) AddStreamOptions
ParseAddStreamOptions parses the options and returns the add stream options.
type Reader ¶
type Reader func(*ReaderOptions)
Reader is a sink creation option.
func WithReaderBlockDuration ¶
WithReaderBlockDuration sets the maximum amount of time the reader waits for MaxPolled events. The default block duration is 5 seconds. If the block duration is set to 0 then the reader blocks indefinitely.
func WithReaderBufferSize ¶
WithReaderBufferSize sets the reader channel buffer size. The default buffer size is 1000. If the buffer is full the reader blocks until the buffer has space available.
func WithReaderMaxPolled ¶
WithReaderMaxPolled sets the maximum number of events polled by the reader at once. The default maximum number of events is 1000.
func WithReaderStartAfter ¶
WithReaderStartAfter sets the last read event ID, the reader will start reading from the next event.
func WithReaderStartAt ¶
WithReaderStartAt sets the start position for the reader to the event added on or after startAt.
func WithReaderStartAtNewest ¶
func WithReaderStartAtNewest() Reader
WithReaderStartAtNewest sets the reader start position to the newest event, this is the default. Only one of WithReaderStartAtNewest, WithReaderStartAtOldest, WithReaderStartAfter or WithReaderStartAt can be used.
func WithReaderStartAtOldest ¶
func WithReaderStartAtOldest() Reader
WithReaderStartAtOldest sets the reader start position to the oldest event. Only one of WithReaderStartAtOldest, WithReaderStartAfter or WithReaderStartAt should be used.
func WithReaderTopic ¶
WithReaderTopic sets the reader topic.
func WithReaderTopicPattern ¶
WithReaderTopicPattern sets the reader topic pattern. pattern must be a valid regular expression or NewReader panics.
type ReaderOptions ¶
type ReaderOptions struct { BlockDuration time.Duration MaxPolled int64 Topic string TopicPattern string BufferSize int LastEventID string }
func ParseReaderOptions ¶
func ParseReaderOptions(opts ...Reader) ReaderOptions
ParseReaderOptions parses the given options and returns the corresponding reader options.
type Sink ¶
type Sink func(*SinkOptions)
Sink is a sink creation option.
func WithSinkAckGracePeriod ¶
WithSinkAckGracePeriod sets the grace period for acknowledging events. The default grace period is 20 seconds. Note: all sinks with identical names must have the same ack grace period.
func WithSinkBlockDuration ¶
WithSinkBlockDuration sets the maximum amount of time the sink waits for MaxPolled events. The default block duration is 5 seconds. If the block duration is set to 0 then the sink blocks indefinitely.
func WithSinkBufferSize ¶
WithSinkBufferSize sets the sink channel buffer size. The default buffer size is 1000. If the buffer is full the sink blocks until the buffer has space available.
func WithSinkMaxPolled ¶
WithSinkMaxPolled sets the maximum number of events polled by the sink at once. The default maximum number of events is 1000.
func WithSinkNoAck ¶
func WithSinkNoAck() Sink
WithSinkNoAck removes the need to acknowledge events read from the sink.
func WithSinkStartAfter ¶
WithSinkStartAfter sets the last read event ID, the sink will start reading from the next event. Only one of WithSinkStartAtNewest, WithSinkStartAtOldest, WithSinkStartAfter or WithSinkStartAt can be used.
func WithSinkStartAt ¶
WithSinkStartAt sets the start position for the sink, defaults to the last event. Only one of WithSinkStartAtNewest, WithSinkStartAtOldest, WithSinkStartAfter or WithSinkStartAt can be used.
func WithSinkStartAtNewest ¶
func WithSinkStartAtNewest() Sink
WithSinkStartAtNewest sets the sink start position to the newest event, this is the default. Only one of WithSinkStartAtNewest, WithSinkStartAtOldest, WithSinkStartAfter or WithSinkStartAt can be used.
func WithSinkStartAtOldest ¶
func WithSinkStartAtOldest() Sink
WithSinkStartAtOldest sets the sink start position to the oldest event. Only one of WithSinkStartAtNewest, WithSinkStartAtOldest, WithSinkStartAfter or WithSinkStartAt can be used.
func WithSinkTopicPattern ¶
WithSinkTopicPattern sets the sink topic pattern. pattern must be a valid regular expression or NewSink panics.
type SinkOptions ¶
type SinkOptions struct { BlockDuration time.Duration MaxPolled int64 Topic string TopicPattern string BufferSize int LastEventID string NoAck bool AckGracePeriod time.Duration }
func ParseSinkOptions ¶
func ParseSinkOptions(opts ...Sink) SinkOptions
ParseSinkOptions parses the options and returns the sink options.
type Stream ¶
type Stream func(*StreamOptions)
Stream is a stream creation option.
func WithStreamLogger ¶
WithStreamLogger sets the logger used by the stream.
func WithStreamMaxLen ¶
WithStreamMaxLen sets the maximum number of events stored by the stream.
type StreamOptions ¶
func ParseStreamOptions ¶
func ParseStreamOptions(opts ...Stream) StreamOptions
ParseStreamOptions parses the given options and returns the corresponding StreamOptions.