Aggregate

interface Aggregate<ID : Any>

Models the minimal set of aggregate operations. Holds the localId of the device executing the aggregate program.

Properties

Link copied to clipboard
abstract val localId: ID

The local ID of the device.

Functions

Link copied to clipboard
abstract fun align(pivot: Any?)

Pushes the pivot in the alignment stack.

Link copied to clipboard
abstract fun <R> alignedOn(pivot: Any?, body: () -> R): R

Alignment function that pushes in the stack the pivot, executes the body and pop the last element of the stack after it is called. Returns the body's return element.

Link copied to clipboard
abstract fun dealign()

Pops the last element of the alignment stack.

Link copied to clipboard
abstract fun <Initial> evolve(initial: Initial, transform: (Initial) -> Initial): Initial

Iteratively updates the value computing the transform expression at each device using the last computed value or the initial.

Link copied to clipboard
abstract fun <Initial, Return> evolving(initial: Initial, transform: YieldingScope<Initial, Return>): Return

Iteratively updates the value computing the transform expression from a YieldingContext at each device using the last computed value or the initial.

Link copied to clipboard
abstract fun <Initial> exchange(initial: Initial, body: (Field<ID, Initial>) -> Field<ID, Initial>): Field<ID, Initial>

The exchange function manages the computation of values between neighbors in a specific context. It computes a body function starting from the initial value and the messages received from other neighbors, then sends the results from the evaluation to specific neighbors or to everyone, it is contingent upon the origin of the calculated value, whether it was received from a neighbor or if it constituted the initial value.

Link copied to clipboard

Same behavior of exchange but this function can yield a Field of Return value.

Link copied to clipboard
abstract fun <Scalar> neighboring(local: Scalar): Field<ID, Scalar>

Observes the value of an expression local across neighbours.

Link copied to clipboard

Observes the value of an expression local across neighbours.

Link copied to clipboard
fun <ID : Any, T> Aggregate<ID>.project(field: Field<ID, T>): Field<ID, T>

Projects the field into the current context. This method is meant to be used internally by the Collektive compiler plugin and, unless there is some major bug that needs to be worked around with a kludge, it should never be called, as it incurs in a performance penalty both in computation and message size. A field may be misaligned if captured by a sub-scope which contains an alignment operation. This function takes such field and restricts it to be aligned with the current neighbors.

Link copied to clipboard
fun <ID : Any, Initial> Aggregate<ID>.share(initial: Initial, transform: (Field<ID, Initial>) -> Initial): Initial

share captures the space-time nature of field computation through observation of neighbours' values, starting from an initial value, it reduces to a single local value given a transform function and updating and sharing to neighbours of a local variable.

Link copied to clipboard

sharing captures the space-time nature of field computation through observation of neighbors' values, starting from an initial value, it reduces to a single local value given a transform function and updating and sharing to neighbors of a local variable.