Documentation
¶
Overview ¶
Package streamstate contains the serialized state machine backing streams.
Index ¶
- Variables
- type CancelTerminal
- type Producer
- func (p *Producer[T, F]) Close()
- func (p *Producer[T, F]) Done() <-chan struct{}
- func (p *Producer[T, F]) Emit(ctx context.Context, event T) error
- func (p *Producer[T, F]) Err() error
- func (p *Producer[T, F]) Events() <-chan T
- func (p *Producer[T, F]) Final() (F, bool)
- func (p *Producer[T, F]) Finish(ctx context.Context, terminal Terminal[T, F]) error
- type Terminal
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrClosed reports that a stream has already closed. ErrClosed = errors.New("stream closed") // ErrTerminated reports that a terminal event has already been accepted. ErrTerminated = errors.New("stream already terminated") )
Functions ¶
This section is empty.
Types ¶
type CancelTerminal ¶
CancelTerminal builds the terminal event used when the stream context ends.
type Producer ¶
type Producer[T, F any] struct { // contains filtered or unexported fields }
Producer serializes event delivery and terminal state for a stream.
func NewProducer ¶
func NewProducer[T, F any](ctx context.Context, buffer int, cancel CancelTerminal[T, F]) *Producer[T, F]
NewProducer constructs a producer with the provided event buffer size.
func (*Producer[T, F]) Close ¶
func (p *Producer[T, F]) Close()
Close closes the stream without emitting another event.
func (*Producer[T, F]) Done ¶
func (p *Producer[T, F]) Done() <-chan struct{}
Done closes after the event channel closes.
func (*Producer[T, F]) Events ¶
func (p *Producer[T, F]) Events() <-chan T
Events returns the event channel.
Click to show internal directories.
Click to hide internal directories.