Documentation
¶
Overview ¶
Package stream provides cancellation-aware, bounded streams used throughout the SDK. The core channel uses no helper goroutine and allocates its ring once.
Index ¶
- Variables
- type Channel
- func (c *Channel[T]) Abort(err error) error
- func (c *Channel[T]) Cap() int
- func (c *Channel[T]) Close() error
- func (c *Channel[T]) Closed() bool
- func (c *Channel[T]) Len() int
- func (c *Channel[T]) Range(ctx context.Context) iter.Seq2[T, error]
- func (c *Channel[T]) Recv(ctx context.Context) (T, error)
- func (c *Channel[T]) Send(ctx context.Context, value T) error
- func (c *Channel[T]) TryRecv() (value T, ok bool, err error)
- func (c *Channel[T]) TrySend(value T) bool
- type Deferred
- type MultiInput
- type Reader
- type SliceReader
- type Writer
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrClosed = errors.New("stream closed")
View Source
var ErrSourceAlreadySet = errors.New("stream source already set")
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel[T any] struct { // contains filtered or unexported fields }
Channel is a bounded MPMC stream with explicit error termination.
func NewChannel ¶
type Deferred ¶
type Deferred[T any] struct { // contains filtered or unexported fields }
Deferred presents a Reader before its actual source is available.
func NewDeferred ¶
type MultiInput ¶
type MultiInput[T any] struct { // contains filtered or unexported fields }
MultiInput fans dynamically added readers into one bounded output. A failed input is removed without terminating other inputs.
func NewMultiInput ¶
func (*MultiInput[T]) Close ¶
func (m *MultiInput[T]) Close() error
func (*MultiInput[T]) InputCount ¶
func (m *MultiInput[T]) InputCount() int
func (*MultiInput[T]) Remove ¶
func (m *MultiInput[T]) Remove(id string)
type SliceReader ¶
type SliceReader[T any] struct { // contains filtered or unexported fields }
func FromSlice ¶
func FromSlice[T any](values []T) *SliceReader[T]
Click to show internal directories.
Click to hide internal directories.