Package-level declarations

Types

Link copied to clipboard
class AggregateContext(localId: ID, messages: Collection<InboundMessage>, previousState: Set<State<*>>)

Context for managing aggregate computation. It represents the localId of the device, the messages received from the neighbours, and the previousState of the device.

Link copied to clipboard
data class AggregateResult<R>(val localId: ID, val result: R, val toSend: OutboundMessage, val newState: Set<State<*>>)

Result of the aggregate computation. It represents the localId of the device, the result of the computation, the messages toSend to other devices and the newState of the device.

Functions

Link copied to clipboard
fun <X> aggregate(localId: ID, condition: () -> Boolean, network: Network, init: AggregateContext.() -> X): AggregateResult<X>

Aggregate program entry point which computes multiple iterations of a device localId, over a condition and a network of devices, with the lambda init with AggregateContext object receiver that provides the aggregate constructs.

fun <X> aggregate(localId: ID, messages: Set<InboundMessage> = emptySet(), state: Set<State<*>> = emptySet(), init: AggregateContext.() -> X): AggregateResult<X>

Aggregate program entry point which computes a single iteration of a device localId, taking as parameters the previous state, the messages received from the neighbours and the init with AggregateContext object receiver that provides the aggregate constructs.