Documentation ¶
Index ¶
- func ReduceFunc(f interface{}) (api.BinFunc, error)
- type BinaryOperator
- func (o *BinaryOperator) Exec(ctx context.Context) (err error)
- func (o *BinaryOperator) GetOutput() <-chan interface{}
- func (o *BinaryOperator) SetConcurrency(concurr int)
- func (o *BinaryOperator) SetInitialState(val interface{})
- func (o *BinaryOperator) SetInput(in <-chan interface{})
- func (o *BinaryOperator) SetOperation(op api.BinOperation)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReduceFunc ¶
ReduceFunc returns a binary function which takes a user-defined accumulator function to apply reduction (fold) logic to incoming streaming items to return a single summary value. The user-provided accumulator function must be of type:
func(S,T) R where S is the partial result (initially the seed) T is the streamed item from upstream R is the calculated value which becomes partial result for next value
It is important to understand that applying a reductive operator after an open-ended emitter (i.e. a network) may never end. To force a Reduction function to terminate, it is sensible to place it after a batch operator for instance.
Types ¶
type BinaryOperator ¶
type BinaryOperator struct {
// contains filtered or unexported fields
}
BinaryOperator represents an operator that knows how to run a binary operations such as aggregation, reduction, etc.
func (*BinaryOperator) Exec ¶
func (o *BinaryOperator) Exec(ctx context.Context) (err error)
Exec executes the associated operation
func (*BinaryOperator) GetOutput ¶
func (o *BinaryOperator) GetOutput() <-chan interface{}
GetOutput returns the output channel for the executor node
func (*BinaryOperator) SetConcurrency ¶
func (o *BinaryOperator) SetConcurrency(concurr int)
SetConcurrency sets the concurrency level
func (*BinaryOperator) SetInitialState ¶
func (o *BinaryOperator) SetInitialState(val interface{})
SetInitialState sets an initial value used with the first streamed item
func (*BinaryOperator) SetInput ¶
func (o *BinaryOperator) SetInput(in <-chan interface{})
SetInput sets the input channel for the executor node
func (*BinaryOperator) SetOperation ¶
func (o *BinaryOperator) SetOperation(op api.BinOperation)
SetOperation sets the operation to execute