api

package
v2.0.0-dev.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 3 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bounded

type Bounded interface {
	SetEofIngest(eof EOFIngest)
}

type BytesCollector

type BytesCollector interface {
	Sink
	Collect(ctx StreamContext, item []byte) error
}

type BytesIngest

type BytesIngest func(ctx StreamContext, payload []byte, meta map[string]any, ts time.Time)

type BytesSource

type BytesSource interface {
	Source
	Subscribe(ctx StreamContext, ingest BytesIngest) error
}

type Closable

type Closable interface {
	Close(ctx StreamContext) error
}

type Connector

type Connector interface {
	Connect(ctx StreamContext) error
}

Connector is a source feature that allows the source to connect to the data source.

type EOFIngest

type EOFIngest func(ctx StreamContext)

type Function

type Function interface {
	// Validate The argument is a list of xsql.Expr
	Validate(args []interface{}) error
	// Exec Execute the function, return the result and if execution is successful.
	// If execution fails, return the error and false.
	Exec(args []interface{}, ctx FunctionContext) (interface{}, bool)
	// IsAggregate If this function is an aggregate function. Each parameter of an aggregate function will be a slice
	IsAggregate() bool
}

type FunctionContext

type FunctionContext interface {
	StreamContext
	GetFuncId() int
}

type Logger

type Logger interface {
	Debug(args ...interface{})
	Info(args ...interface{})
	Warn(args ...interface{})
	Error(args ...interface{})
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
}

type LookupSource

type LookupSource interface {
	// Open creates the connection to the external data source
	Open(ctx StreamContext) error
	// Configure Called during initialization. Configure the source with the data source(e.g. topic for mqtt) and the properties
	// read from the yaml
	Configure(datasource string, props map[string]interface{}) error
	// Lookup receive lookup values to construct the query and return query results
	Lookup(ctx StreamContext, fields []string, keys []string, values []interface{}) ([]Tuple, error)
	Closable
}

type MetaInfo

type MetaInfo interface {
	Meta() ReadonlyMessage
	Timestamp() time.Time
}

type ModuleInfo

type ModuleInfo struct {
	Id          string
	Description string
	New         func() Nodelet
}

type Nodelet

type Nodelet interface {
	// Provision is called when the node is created, usually setting the configs. Do not put time-consuming operations here.
	Provision(ctx StreamContext, configs map[string]any) error
	Closable
}

type RawTuple

type RawTuple interface {
	Raw() []byte
	MetaInfo
}

type ReadonlyMessage

type ReadonlyMessage interface {
	Get(key string) (value any, ok bool)
	Range(f func(key string, value any) bool)
	// ToMap todo remove after eliminate map
	ToMap() map[string]any
}

ReadonlyMessage Message is the interface that wraps each record. Use this interface to exchange data between different components. It is used in sink

type ResendSink

type ResendSink interface {
	Sink
	// CollectResend Called when the sink cache resend is triggered
	CollectResend(ctx StreamContext, data interface{}) error
}

type Rewindable

type Rewindable interface {
	GetOffset() (any, error)
	Rewind(offset any) error
	ResetOffset(input map[string]any) error
}

Rewindable is a source feature that allows the source to rewind to a specific offset.

type Sink

type Sink interface {
	Nodelet
	Connector
}

Sink is the interface that wraps the basic Sink method. It is used to connect to the external system and send data to it. A sink must implement the Sink interface AND any collector interface. The lifecycle of a sink: Provision -> Connect -> Collect -> Close

type Source

type Source interface {
	Nodelet
	Connector
}

Source is the interface that wraps the basic Source method. The lifecycle of a source: Provision -> Connect -> Subscribe -> Close

type Store

type Store interface {
	SaveState(checkpointId int64, opId string, state map[string]interface{}) error
	// SaveCheckpoint saves the whole checkpoint state into storage
	SaveCheckpoint(checkpointId int64) error
	GetOpState(opId string) (*sync.Map, error)
	Clean() error
}

type StreamContext

type StreamContext interface {
	context.Context
	GetLogger() Logger
	GetRuleId() string
	GetOpId() string
	GetInstanceId() int
	GetRootPath() string

	WithMeta(ruleId string, opId string, store Store) StreamContext
	WithInstance(instanceId int) StreamContext
	WithCancel() (StreamContext, context.CancelFunc)

	SetError(e error)
	// IncrCounter State handling
	IncrCounter(key string, amount int) error
	GetCounter(key string) (int, error)
	PutState(key string, value interface{}) error
	GetState(key string) (interface{}, error)
	DeleteState(key string) error
	// ParseTemplate parse the template string with the given data
	ParseTemplate(template string, data interface{}) (string, error)
	// ParseJsonPath parse the jsonPath string with the given data
	ParseJsonPath(jsonPath string, data interface{}) (interface{}, error)
}

type Tuple

type Tuple interface {
	Message() ReadonlyMessage
	MetaInfo
}

Tuple is the record passing in source and sink

type TupleCollector

type TupleCollector interface {
	Sink
	Collect(ctx StreamContext, item Tuple) error
	CollectList(ctx StreamContext, items []Tuple) error
}

type TupleIngest

type TupleIngest func(ctx StreamContext, data any, meta map[string]any, ts time.Time)

TupleIngest reads in a structural data or its list. It supports map and []map for now

type TupleSource

type TupleSource interface {
	Source
	Subscribe(ctx StreamContext, ingest TupleIngest) error
}

Jump to

Keyboard shortcuts

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