testcomponents

package
v0.37.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package testcomponents contains components useful for testing. They are not intended to be exposed by end users and so this package should only be imported in tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Count added in v0.37.0

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

func NewCount added in v0.37.0

func NewCount(o component.Options, cfg CountConfig) (*Count, error)

func (*Count) Run added in v0.37.0

func (t *Count) Run(ctx context.Context) error

func (*Count) Update added in v0.37.0

func (t *Count) Update(args component.Arguments) error

Update implements Component.

type CountConfig added in v0.37.0

type CountConfig struct {
	Frequency time.Duration `river:"frequency,attr"`
	Max       int           `river:"max,attr"`
}

type CountExports added in v0.37.0

type CountExports struct {
	Count int `river:"count,attr,optional"`
}

type Fake added in v0.36.0

type Fake struct {
	RunFunc    func(ctx context.Context) error
	UpdateFunc func(args component.Arguments) error
}

Fake is a fake component instance which invokes fields when its methods are called. Fake does not register itself as a component and must be provided in a custom registry.

The zero value is ready for use.

func (*Fake) Run added in v0.36.0

func (f *Fake) Run(ctx context.Context) error

Run implements component.Component. f.RunFunc will be invoked if it is non-nil, otherwise a default implementation is used.

func (*Fake) Update added in v0.36.0

func (f *Fake) Update(args component.Arguments) error

Update implements component.Component. f.UpdateFunc will be invoked if it is non-nil, otherwise a default implementation is used.

type Passthrough

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

Passthrough implements the testcomponents.passthrough component, where it always emits its input as an output.

func NewPassthrough

func NewPassthrough(o component.Options, cfg PassthroughConfig) (*Passthrough, error)

NewPassthrough creates a new passthrough component.

func (*Passthrough) DebugInfo

func (t *Passthrough) DebugInfo() interface{}

DebugInfo implements DebugComponent.

func (*Passthrough) Run

func (t *Passthrough) Run(ctx context.Context) error

Run implements Component.

func (*Passthrough) Update

func (t *Passthrough) Update(args component.Arguments) error

Update implements Component.

type PassthroughConfig

type PassthroughConfig struct {
	Input string        `river:"input,attr"`
	Lag   time.Duration `river:"lag,attr,optional"`
}

PassthroughConfig configures the testcomponents.passthrough component.

type PassthroughExports

type PassthroughExports struct {
	Output string `river:"output,attr,optional"`
}

PassthroughExports describes exported fields for the testcomponents.passthrough component.

type Summation added in v0.37.0

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

func NewSummation added in v0.37.0

func NewSummation(o component.Options, cfg SummationConfig) (*Summation, error)

NewSummation creates a new summation component.

func (*Summation) Run added in v0.37.0

func (t *Summation) Run(ctx context.Context) error

Run implements Component.

func (*Summation) Update added in v0.37.0

func (t *Summation) Update(args component.Arguments) error

Update implements Component.

type SummationConfig added in v0.37.0

type SummationConfig struct {
	Input int `river:"input,attr"`
}

type SummationExports added in v0.37.0

type SummationExports struct {
	Sum       int `river:"sum,attr"`
	LastAdded int `river:"last_added,attr"`
}

type Tick

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

Tick implements the testcomponents.tick component, where the wallclock time will be emitted on a given frequency.

func NewTick

func NewTick(o component.Options, cfg TickConfig) (*Tick, error)

NewTick creates a new testcomponents.tick component.

func (*Tick) Run

func (t *Tick) Run(ctx context.Context) error

Run implements Component.

func (*Tick) Update

func (t *Tick) Update(args component.Arguments) error

Update implements Component.

type TickConfig

type TickConfig struct {
	Frequency time.Duration `river:"frequency,attr"`
}

TickConfig configures the testcomponents.tick component.

type TickExports

type TickExports struct {
	Time time.Time `river:"tick_time,attr,optional"`
}

TickExports describes exported fields for the testcomponents.tick component.

Jump to

Keyboard shortcuts

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