stream

package
v1.2.11 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2021 License: MPL-2.0 Imports: 4 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// EOFBehaviourPoll will make the session poll for new records after an EOF error is received
	EOFBehaviourPoll eofBehaviour = 1 << iota
	// EOFBehaviourExit wil make the session exit when EOF is received
	EOFBehaviourExit eofBehaviour = 1 << iota
)

Variables

This section is empty.

Functions

func FromOffset

func FromOffset(o int64) consumerOpts

func WithEOFBehaviour

func WithEOFBehaviour(v eofBehaviour) consumerOpts

func WithMaxBatchSize

func WithMaxBatchSize(v int) consumerOpts

func WithMaxRecordCount

func WithMaxRecordCount(o int64) consumerOpts

func WithMinBatchSize

func WithMinBatchSize(v int) consumerOpts

func WithName

func WithName(v string) consumerOpts

func WithOffsetIterator

func WithOffsetIterator(v OffsetIterator) consumerOpts

Types

type Batch

type Batch struct {
	Records []commitlog.Entry
}

type Consumer

type Consumer interface {
	Consume(ctx context.Context, r io.ReadSeeker, processor Processor) error
}

func NewConsumer

func NewConsumer(opts ...consumerOpts) Consumer

type ConsumerOpts

type ConsumerOpts struct {
	Name                      string
	MaxBatchSize              int
	MinBatchSize              int
	MaxBatchMemorySizeInBytes int
	MaxRecordCount            int64
	FromOffset                int64
	EOFBehaviour              eofBehaviour
	OffsetProvider            OffsetIterator
	Middleware                []func(Processor, ConsumerOpts) Processor
}

ConsumerOpts describes stream session preferences

type OffsetIterator

type OffsetIterator interface {
	Next() (uint64, error)
	AdvanceTo(uint64)
}

type Poller

type Poller interface {
	Ready() <-chan Batch
	Error() error
}

type Processor

type Processor func(context.Context, Batch) error

Processor is a function that will process stream records

Jump to

Keyboard shortcuts

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