stream

package
v4.0.0-...-2c57b5f Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OptOnClose

func OptOnClose(onClose func()) func(*Type)

OptOnClose sets a closure to be called when the stream closes.

func Spec

func Spec() docs.FieldSpecs

Spec returns a docs.FieldSpec for a stream configuration.

Types

type Config

type Config struct {
	Input    input.Config    `yaml:"input"`
	Buffer   buffer.Config   `yaml:"buffer"`
	Pipeline pipeline.Config `yaml:"pipeline"`
	Output   output.Config   `yaml:"output"`
	// contains filtered or unexported fields
}

Config is a configuration struct representing all four layers of a Bento stream.

func FromParsed

func FromParsed(prov docs.Provider, pConf *docs.ParsedConfig, rawSource any) (conf Config, err error)

func (*Config) GetRawSource

func (c *Config) GetRawSource() any

type Type

type Type struct {
	// contains filtered or unexported fields
}

Type creates and manages the lifetime of a Bento stream.

func New

func New(conf Config, mgr bundle.NewManagement, opts ...func(*Type)) (*Type, error)

New creates a new stream.Type.

func (*Type) IsReady

func (t *Type) IsReady() bool

IsReady returns a boolean indicating whether both the input and output layers of the stream are connected.

func (*Type) Stop

func (t *Type) Stop(ctx context.Context) error

Stop attempts to close the stream within the specified timeout period. Initially the attempt is graceful, but if the context contains a deadline and it draws near the attempt becomes progressively less graceful.

If the context is cancelled an error is returned _after_ asynchronously instructing the remaining stream components to terminate ungracefully.

func (*Type) StopGracefully

func (t *Type) StopGracefully(ctx context.Context) (err error)

StopGracefully attempts to close the stream in the most graceful way by only closing the input layer and waiting for all other layers to terminate by proxy. This should guarantee that all in-flight and buffered data is resolved before shutting down.

func (*Type) StopUnordered

func (t *Type) StopUnordered(ctx context.Context) (err error)

StopUnordered attempts to close all components in parallel without allowing the stream to gracefully wind down in the order of component layers. This should only be attempted if both stopGracefully and stopOrdered failed.

Directories

Path Synopsis
Package manager creates and manages multiple streams, providing an API for performing CRUD operations.
Package manager creates and manages multiple streams, providing an API for performing CRUD operations.

Jump to

Keyboard shortcuts

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