stream

package
v0.0.0-...-dd0f3b3 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrReturnedLate   = "processor returned late before context closed"
	ErrAlreadyStopped = "stream already stopped"
)

Error messages

Variables

This section is empty.

Functions

This section is empty.

Types

type AdviceHandler

type AdviceHandler func(a context.Advice, next func())

AdviceHandler is provided to Stream.StartWith so that the programmer may react to Advice messages being received by the Stream's monitor channel. Calling next() will ultimately invoke the default behavior for the received Advice. Not calling next() will short-circuit that behavior

type Processor

type Processor[In, Out any] func(*context.Context[In, Out])

Processor is a function that processes part of a Stream topology. Recoverable and fatal errors can be sent to the context.Context's Monitor channel.

func (Processor[In, Out]) Start

func (p Processor[In, Out]) Start(c *context.Context[In, Out])

Start begins the Processor in a new go routine, logging any abnormalities

type Running

type Running interface {
	// Stop instructs the Stream to stop processing
	Stop() error

	// IsRunning returns whether the Stream is processing messages
	IsRunning() bool
}

type Sink

type Sink struct{}

Sink messages are produced by a Processor that is meant to terminate a Stream. Examples would be node.SinkTo and node.Sink

type Source

type Source struct{}

Source messages are provided to a Processor that is meant to generate messages from a source outside its current Stream. Examples would be node.TopicConsumer and node.Generate

type Stream

type Stream interface {
	// Start begins background processing of the Stream
	Start() Running

	// StartWith begins background processing of the Stream, but gives the
	// programmer first crack at the Advice being received on the Stream's
	// monitor channel
	StartWith(AdviceHandler) Running
}

Stream is a process that performs the work assigned to it using the set of Processors provided to it when constructed

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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