binary

package
v0.1.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReduceFunc

func ReduceFunc(f interface{}) (api.BinFunc, error)

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 New

func New() *BinaryOperator

New creates a new binary operator

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

Jump to

Keyboard shortcuts

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