Field

sealed interface Field<ID : Any, out T>

A Field represents the local view of distributed values across a network of nodes.

Each field consists of:

  • A local entry, associated with the node executing the aggregate computation.

  • A set of neighboring entries, each identified by a unique ID.

The field provides functional operators for aggregation, projection, and transformation, supporting key aggregate computing patterns. Fields are expected to be aligned when used together - i.e., they share the same neighborhood structure.

Type Parameters

ID

the type used to identify nodes in the aggregate space.

T

the type of value carried by each entry in the field.

Types

Link copied to clipboard
object Companion

Base operations on Fields.

Properties

Link copied to clipboard
abstract val all: CollapseAll<FieldEntry<ID, T>>

A collapsing view over the field entries that includes the local entry and all neighbors. Provides access to the combined list/set/sequence of self + peers, e.g., for operations that need to reason about the entire neighborhood including the local node.

Link copied to clipboard
abstract val context: Aggregate<ID>

The Aggregate execution context this field belongs to.

Link copied to clipboard
abstract val local: FieldEntry<ID, T>

The entry representing the local node in the field.

Link copied to clipboard

A collapsing view over the field entries that excludes the local entry, i.e., only peers. Provides access to the neighborhood without the local node, for computations scoped to neighbors.

Functions

Link copied to clipboard
open fun <B, R> alignedMap(other: Field<ID, B>, transform: (ID, T, B) -> R): Field<ID, R>

Combines this field with another (aligned) one considering the ID when combining the values.

open fun <B, C, R> alignedMap(f1: Field<ID, B>, f2: Field<ID, C>, transform: (ID, T, B, C) -> R): Field<ID, R>

Combines this field with other two (aligned) fields based on the IDs.

open fun <B, C, D, R> alignedMap(f1: Field<ID, B>, f2: Field<ID, C>, f3: Field<ID, D>, transform: (ID, T, B, C, D) -> R): Field<ID, R>

Combines this field with other three (aligned) fields based on the IDs.

open fun <B, C, D, E, R> alignedMap(f1: Field<ID, B>, f2: Field<ID, C>, f3: Field<ID, D>, f4: Field<ID, E>, transform: (ID, T, B, C, D, E) -> R): Field<ID, R>

Combines this field with other four (aligned) fields based on the IDs.

open fun <B, C, D, E, F, R> alignedMap(f1: Field<ID, B>, f2: Field<ID, C>, f3: Field<ID, D>, f4: Field<ID, E>, f5: Field<ID, F>, transform: (ID, T, B, C, D, E, F) -> R): Field<ID, R>

Combines this field with other five (aligned) fields based on the IDs.

open fun <B, C, D, E, F, G, R> alignedMap(f1: Field<ID, B>, f2: Field<ID, C>, f3: Field<ID, D>, f4: Field<ID, E>, f5: Field<ID, F>, f6: Field<ID, G>, transform: (ID, T, B, C, D, E, F, G) -> R): Field<ID, R>

Combines this field with other six (aligned) fields based on the IDs.

Link copied to clipboard
open fun <B, R> alignedMapValues(other: Field<ID, B>, transform: (T, B) -> R): Field<ID, R>

Combines this field with another (aligned) one.

open fun <B, C, R> alignedMapValues(f1: Field<ID, B>, f2: Field<ID, C>, transform: (T, B, C) -> R): Field<ID, R>

Combines this field with other two (aligned) fields based on the IDs.

open fun <B, C, D, R> alignedMapValues(f1: Field<ID, B>, f2: Field<ID, C>, f3: Field<ID, D>, transform: (T, B, C, D) -> R): Field<ID, R>

Combines this field with other three (aligned) fields based on the IDs.

open fun <B, C, D, E, R> alignedMapValues(f1: Field<ID, B>, f2: Field<ID, C>, f3: Field<ID, D>, f4: Field<ID, E>, transform: (T, B, C, D, E) -> R): Field<ID, R>

Combines this field with other four (aligned) fields based on the IDs.

open fun <B, C, D, E, F, R> alignedMapValues(f1: Field<ID, B>, f2: Field<ID, C>, f3: Field<ID, D>, f4: Field<ID, E>, f5: Field<ID, F>, transform: (T, B, C, D, E, F) -> R): Field<ID, R>

Combines this field with other five (aligned) fields based on the IDs.

open fun <B, C, D, E, F, G, R> alignedMapValues(f1: Field<ID, B>, f2: Field<ID, C>, f3: Field<ID, D>, f4: Field<ID, E>, f5: Field<ID, F>, f6: Field<ID, G>, transform: (T, B, C, D, E, F, G) -> R): Field<ID, R>

Combines this field with other six (aligned) fields based on the IDs.

Link copied to clipboard
abstract operator fun get(id: ID): T

Get the value associated with the id. Raise an error if the id is not present in the field.

Link copied to clipboard
abstract fun <B> map(transform: (FieldEntry<ID, T>) -> B): Field<ID, B>

Map the field using the transform function.

Link copied to clipboard
open fun <B> mapToConstant(singleton: B): Field<ID, B>

Map the field resulting in a new one where the value for the local and the neighbors is singleton.

Link copied to clipboard
open fun <B> mapValues(transform: (T) -> B): Field<ID, B>

Map the field using the transform function.