Apps     Components     Interfaces     All Files     Source Tree     source: tos.lib.TinyDB.Operator.nc

Interface: Operator

Operators apply filters and transformations to data tuples and neighbor results. They are applied by the TupleRouter. Examples of operators include selections and aggregates (both of which implement the operator interface. Due to the fairly static nature of TinyDB, support for Selections and Aggregates are currently hard coded -- e.g., to add new operator types, explicit changes to the TupleRouter are needed.

Components providing this interface:
tos.lib.TinyDB.AggOperator
tos.lib.TinyDB.SelOperator

Components requiring this interface:
tos.lib.TinyDB.ParsedQuery
tos.lib.TinyDB.TupleRouterM

Commands

Events

Commands - Details

nextResult

TinyDBError nextResult(QueryResultPtr qr, ParsedQueryPtr qs, ExprPtr e)

Return the next result for this expression

Parameters:

qr - (input) The index of the result to return
(output) The value of the result

qs - The query whose results we are fetching

e - The expressions whose results we are fetching Note that stateless operators (e.g. filters) may not return any results


processPartialResult

TinyDBError processPartialResult(QueryResultPtr qr, ParsedQueryPtr qs, ExprPtr e)

Process a tuple from a neighbor

Parameters:

qr - The result to process

qs - The query corresponding to the result

e - The expression corresponding to the result

Returns: Error code indicating type of failure. Expect err_InvalidAggregateRecord if qs or e don't correspond to qr.

endOfEpoch

result_t endOfEpoch(ParsedQueryPtr q, ExprPtr e)

Signal to the operator that an epoch as ended, possibly causing it to reset the state that this operator stores for the specified expression (Called every epoch) Operator state is appended to the expression (ick!) , in the opState handle -- each expression is owned by exactly one operator, which may store state there.

Parameters:

q - The query that's being reset

e - The expression that's being reset

Events - Details

processedTuple

TinyDBError processedTuple(TuplePtr t, ParsedQueryPtr q, ExprPtr e, bool passed)

Called when an operator has finished processing a local tuple

Parameters:

t - The tuple just processed.

q - The query the tuple belongs to

e - The expression that was applied. If e is a filter (selection operator) e->passed indicates if this tuple passed the filter.

passed - True if this tuple passed the operator and should continue to be processed