Aggregate

interface Aggregate<ID : Any>

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

Types

Link copied to clipboard
object Companion

Contains the inlined version of the Aggregate.exchange, Aggregate.exchanging, Aggregate.neighboring functions.

Properties

Link copied to clipboard
abstract val inMemoryOnly: Boolean

Whether this context works only in memory. If false, this context is capable of serializing and deserializing messages.

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

Inline access to the data serialization method of an Aggregate. This method is used to avoid building serializers for in-memory-only contexts.

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, dataSharingMethod: DataSharingMethod<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
inline fun <ID : Any, Initial> Aggregate<ID>.exchange(initial: Initial, noinline body: (Field<ID, Initial>) -> Field<ID, Initial>): Field<ID, Initial>

Inlined version of the Aggregate.exchange function.

Link copied to clipboard
abstract fun <Initial, Return> exchanging(initial: Initial, dataSharingMethod: DataSharingMethod<Initial>, body: YieldingScope<Field<ID, Initial>, Field<ID, Return>>): Field<ID, Return>

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

Link copied to clipboard
inline fun <ID : Any, Initial, Return> Aggregate<ID>.exchanging(initial: Initial, noinline body: YieldingScope<Field<ID, Initial>, Field<ID, Return>>): Field<ID, Return>

Inlined version of the Aggregate.exchanging function.

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

Observes the value of an expression local across neighbours.

Link copied to clipboard
inline fun <ID : Any, Scalar> Aggregate<ID>.neighboring(local: Scalar): Field<ID, Scalar>

Inlined version of the Aggregate.neighboring function.

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, restricting the field to the current context.

Link copied to clipboard
inline fun <ID : Any, Initial> Aggregate<ID>.share(initial: Initial, noinline 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.