component

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivityState

type ActivityState int
const (
	Inactive ActivityState = iota
	Live
	Terminated
)

func (ActivityState) String

func (as ActivityState) String() string

type Aggregator

type Aggregator struct{}

TODO(#12): No Aggregation Component Support

type Component

type Component interface {
	/*
		NOTE - Storing the PUUID assumes that one component
		can only be a part of one pipeline at a time. This could be
		problematic if we want to have a component be a part of multiple
		pipelines at once. In that case, we would need to store a slice
		of PUUIDs instead.
	*/
	// PUUID ... Returns component's PUUID
	PUUID() core.PUUID

	// UUID ...
	UUID() core.CUUID
	// Type ... Returns component enum type
	Type() core.ComponentType

	// AddRelay ... Adds an engine relay to component egress routing
	AddRelay(relay *core.EngineInputRelay) error

	// AddEgress ...
	AddEgress(core.CUUID, chan core.TransitData) error
	// RemoveEgress ...
	RemoveEgress(core.CUUID) error

	// Close ... Signifies a component to stop operating
	Close() error

	// EventLoop ... Component driver function; spun up as separate go routine
	EventLoop() error

	// GetIngress ... Returns component ingress channel for some register type value
	GetIngress(rt core.RegisterType) (chan core.TransitData, error)

	// OutputType ... Returns component output data type
	OutputType() core.RegisterType

	StateKey() *core.StateKey

	// TODO(#24): Add Internal Component Activity State Tracking
	ActivityState() ActivityState
}

Component ... Generalized interface that all pipeline components must adhere to

func NewOracle

func NewOracle(ctx context.Context, outType core.RegisterType,
	od OracleDefinition, opts ...Option) (Component, error)

NewOracle ... Initializer

func NewPipe

func NewPipe(ctx context.Context, pd PipeDefinition, inType core.RegisterType,
	outType core.RegisterType, opts ...Option) (Component, error)

NewPipe ... Initializer

type Option

type Option = func(*metaData)

Option ... Component type agnostic option

func WithCUUID

func WithCUUID(id core.CUUID) Option

WithCUUID ... Passes component UUID to component metadata field

func WithEventChan

func WithEventChan(sc chan StateChange) Option

WithEventChan ... Passes state channel to component metadata field

func WithInTypes

func WithInTypes(its []core.RegisterType) Option

WithInTypes ... Passes input types to component metadata field

func WithPUUID

func WithPUUID(pUUID core.PUUID) Option

WithPUUID ... Passes component PUUID to component metadata field

func WithStateKey

func WithStateKey(key *core.StateKey) Option

WithStateKey ... Passes state key to component metadata field

type Oracle

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

Oracle ... Component used to represent a data source reader; E.g, Eth block indexing, interval API polling

func (Oracle) ActivityState

func (meta Oracle) ActivityState() ActivityState

ActivityState ... Returns component current activity state

func (*Oracle) Close

func (o *Oracle) Close() error

Close ... This function is called at the end when processes related to oracle need to shut down

func (*Oracle) EventLoop

func (o *Oracle) EventLoop() error

EventLoop ... Component loop that actively waits and transits register data from a channel that the definition's read routine writes to

func (Oracle) OutputType

func (meta Oracle) OutputType() core.RegisterType

OutputType ... Returns component's data output type

func (Oracle) PUUID

func (meta Oracle) PUUID() core.PUUID

UUID ... Returns component's PUUID NOTE - This currently assumes that component collisions are impossible

func (Oracle) StateKey

func (meta Oracle) StateKey() *core.StateKey

StateKey ... Returns component's state key

func (Oracle) Type

func (meta Oracle) Type() core.ComponentType

Type ... Returns component's type

func (Oracle) UUID

func (meta Oracle) UUID() core.CUUID

UUID ... Returns component's CUUID

type OracleConstructorFunc

type OracleConstructorFunc = func(context.Context, *core.ClientConfig, ...Option) (Component, error)

OracleConstructorFunc ... Type declaration that a registry oracle component constructor must adhere to

type OracleDefinition

type OracleDefinition interface {
	BackTestRoutine(ctx context.Context, componentChan chan core.TransitData,
		startHeight *big.Int, endHeight *big.Int) error
	ReadRoutine(ctx context.Context, componentChan chan core.TransitData) error
}

OracleDefinition ... Provides a generalized interface for developers to bind their own functionality to

type OracleType

type OracleType = string

OracleType ...

const (
	// BackTestOracle ... Represents an oracle used for backtesting some heuristic
	BacktestOracle OracleType = "backtest"
	// LiveOracle ... Represents an oracle used for powering some live heuristic
	LiveOracle OracleType = "live"
)

type Pipe

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

func (Pipe) ActivityState

func (meta Pipe) ActivityState() ActivityState

ActivityState ... Returns component current activity state

func (*Pipe) Close

func (p *Pipe) Close() error

Close ... Shuts down component by emitting a kill signal to a close channel

func (*Pipe) EventLoop

func (p *Pipe) EventLoop() error

EventLoop ... Driver loop for component that actively subscribes to an input channel where transit data is read, transformed, and transitte to downstream components

func (Pipe) OutputType

func (meta Pipe) OutputType() core.RegisterType

OutputType ... Returns component's data output type

func (Pipe) PUUID

func (meta Pipe) PUUID() core.PUUID

UUID ... Returns component's PUUID NOTE - This currently assumes that component collisions are impossible

func (Pipe) StateKey

func (meta Pipe) StateKey() *core.StateKey

StateKey ... Returns component's state key

func (Pipe) Type

func (meta Pipe) Type() core.ComponentType

Type ... Returns component's type

func (Pipe) UUID

func (meta Pipe) UUID() core.CUUID

UUID ... Returns component's CUUID

type PipeConstructorFunc

type PipeConstructorFunc = func(context.Context, *core.ClientConfig, ...Option) (Component, error)

PipeConstructorFunc ... Type declaration that a registry pipe component constructor must adhere to

type PipeDefinition

type PipeDefinition interface {
	Transform(ctx context.Context, data core.TransitData) ([]core.TransitData, error)
}

type StateChange

type StateChange struct {
	ID core.CUUID

	From ActivityState // S
	To   ActivityState // S'
}

StateChange ... Represents a component state change event that is processed by component management logic to determine proper pipeline states and duplicate pipeline merging opportunities

Jump to

Keyboard shortcuts

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