Documentation ¶
Index ¶
- type Bounded
- type BytesCollector
- type BytesIngest
- type BytesSource
- type Closable
- type Connector
- type EOFIngest
- type Function
- type FunctionContext
- type Logger
- type LookupSource
- type MetaInfo
- type ModuleInfo
- type Nodelet
- type RawTuple
- type ReadonlyMessage
- type ResendSink
- type Rewindable
- type Sink
- type Source
- type Store
- type StreamContext
- type Tuple
- type TupleCollector
- type TupleIngest
- type TupleSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BytesCollector ¶
type BytesCollector interface { Sink Collect(ctx StreamContext, item []byte) error }
type BytesIngest ¶
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 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 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 ¶
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 ¶
Source is the interface that wraps the basic Source method. The lifecycle of a source: Provision -> Connect -> Subscribe -> Close
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 ¶
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 }