core

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LoggerKeyComponent is the logger key for components.
	LoggerKeyComponent = "component"
)

Variables

This section is empty.

Functions

func CloseSequentially

func CloseSequentially(a, b io.Closer) error

CloseSequentially closes a and if there is no error, closes b.

Types

type Config

type Config struct {
	PrometheusAddr string

	Debug             bool
	DebugPackets      bool
	DebugHTTPMessages bool

	ProfilePathCPU    string
	ProfilePathMemory string
	ProfileHTTPAddr   string

	Plugin string
}

Config is a general config.

type Context

type Context struct {
	Config     *Config
	FlowConfig *FlowConfig
	SessionID  string
	StdContext context.Context
	Cancel     context.CancelFunc
	Errors     chan error
	Logger     zerolog.Logger
	Registry   *envelope.Registry
}

Context is a context for a session.

func NewContext

func NewContext(cfg *Config, flowCfg *FlowConfig, errs chan error) Context

NewContext creates a new context.

func NewContextForWriter

func NewContextForWriter(cfg *Config, flowCfg *FlowConfig, errs chan error, w io.Writer) Context

NewContextForWriter creates a new context with logs written to a specific writer.

type FlowConfig

type FlowConfig struct {
	SourceDuration     time.Duration
	InputDrainDuration time.Duration

	Addr            string
	AddrSink        string
	CaptureResponse bool
	Middleware      string
	HTTPTimeout     time.Duration

	TCPTimeout time.Duration

	BufferOutput bool

	GCSBucketName string
	GCSObjectName string

	InputFile string

	S3CompatEndpoint   string
	S3CompatAccessKey  string
	S3CompatSecretKey  string
	S3CompatToken      string
	S3CompatSecure     bool
	S3CompatBucketName string
	S3CompatObjectName string
}

FlowConfig is a Flow config.

type InputFormat

type InputFormat interface {
	Init(Context, Middleware, <-chan InputReader)
	Out() <-chan interface{}
}

InputFormat is an interface for formatting input.

type InputFormatCtor

type InputFormatCtor func(Context) (InputFormat, error)

InputFormatCtor is a map of string to input format constructors.

type InputModifier

type InputModifier interface {
	Wrap(InputReader) (InputReader, error)
}

InputModifier wraps an InputReader.

type InputModifierCtor

type InputModifierCtor func(Context) (InputModifier, error)

InputModifierCtor is a map of string to input modifier constructors.

type InputModifiers

type InputModifiers []InputModifier

InputModifiers is a slice of InputModifier.

func (InputModifiers) Wrap

Wrap wraps an InputReader in all modifiers.

type InputReader

type InputReader interface {
	io.ReadCloser
	Meta() *Meta
}

InputReader is an input reader.

func EmptyMeta

func EmptyMeta(r io.ReadCloser) InputReader

EmptyMeta wraps an io.ReadCloser with an empty Meta.

type Meta

type Meta struct {
	SourceID string
	// contains filtered or unexported fields
}

Meta is a map of flow-related metadata.

func NewMeta

func NewMeta(sourceID string, values map[string]interface{}) *Meta

NewMeta creates a new Meta.

func (*Meta) Get

func (m *Meta) Get(key string) (interface{}, bool)

Get gets a value.

func (*Meta) GetString

func (m *Meta) GetString(key string) (string, bool)

GetString gets a string value.

func (*Meta) Set

func (m *Meta) Set(key string, value interface{})

Set sets a value.

type Middleware

type Middleware interface {
	Start() error
	Wait() error
	Close()
	Exec(Context, []byte, interface{}) (interface{}, error)
}

Middleware is an interface that can modify objects.

func NewMiddleware

func NewMiddleware(ctx Context, command string) (Middleware, error)

NewMiddleware creates a new Middleware.

type OutputFormat

type OutputFormat interface {
	Init(Context, io.Writer)
	In() chan<- interface{}
	Complete() <-chan struct{}
}

OutputFormat is an interface for formatting output

type OutputFormatCtor

type OutputFormatCtor func(Context) (OutputFormat, error)

OutputFormatCtor is a map of string to output format constructors.

type OutputModifier

type OutputModifier interface {
	Wrap(OutputWriter) (OutputWriter, error)
}

OutputModifier wraps an OtputWriter.

type OutputModifierCtor

type OutputModifierCtor func(Context) (OutputModifier, error)

OutputModifierCtor is a map of string to output modifier constructors.

type OutputModifiers

type OutputModifiers []OutputModifier

OutputModifiers is a slice of OutputModifier.

func (OutputModifiers) Wrap

Wrap wraps an OutputWrtier in all modifiers.

type OutputWriter

type OutputWriter interface {
	io.WriteCloser
}

OutputWriter is an output writer.

type Sink

type Sink io.WriteCloser

Sink is a writable location for output.

type SinkCtor

type SinkCtor func(Context) (Sink, error)

SinkCtor is a map of string to sink constructors.

type Source

type Source interface {
	Init(Context)
	Streams() <-chan InputReader
}

Source is a data source that can be consumed by an input pipe.

type SourceCtor

type SourceCtor func(Context) (Source, error)

SourceCtor is a map of string to source constructors.

Jump to

Keyboard shortcuts

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