Package-level declarations

Types

Link copied to clipboard
@Serializable
data class GossipValue<ID : Comparable<ID>, Value>(val best: Value, val local: Value, val path: List<ID> = emptyList())

The best value exchanged in the gossip algorithm. It contains the best value evaluated yet, the local value of the node, and the path of nodes through which it has passed.

Functions

Link copied to clipboard
inline fun <ID : Any, Value> Aggregate<ID>.bellmanFordGradientCast(source: Boolean, local: Value, noinline accumulateData: (fromSource: Double, toNeighbor: Double, data: Value) -> Value = { _, _, data -> data }, crossinline accumulateDistance: (fromSource: Double, toNeighbor: Double) -> Double = Double::plus, metric: Field<ID, Double>): Value

Propagates local values across the network using a Bellman–Ford gradient.

inline fun <ID : Any, Value, Distance : Comparable<Distance>> Aggregate<ID>.bellmanFordGradientCast(source: Boolean, local: Value, bottom: Distance, top: Distance, noinline accumulateData: (fromSource: Distance, toNeighbor: Distance, data: Value) -> Value = { _, _, data -> data }, crossinline accumulateDistance: Reducer<Distance>, metric: Field<ID, Distance>): Value

Computes a gradient-based broadcast of local values over the network using a Bellman–Ford–style algorithm.

Link copied to clipboard
inline fun <ID : Any> Aggregate<ID>.distanceTo(source: Boolean, metric: Field<ID, Double> = hops().toDouble(), maxDiameter: Int = Int.MAX_VALUE): Double

Computes the distance from the nearest source node as a Double.

inline fun <ID : Any, Distance : Comparable<Distance>> Aggregate<ID>.distanceTo(source: Boolean, bottom: Distance, top: Distance, metric: Field<ID, Distance>, maxDiameter: Int = Int.MAX_VALUE, noinline accumulateDistance: Reducer<Distance>): Distance

Computes the distance from the nearest source node within a specified range.

Link copied to clipboard
fun <ID : Any> Aggregate<ID>.everHappened(condition: () -> Boolean): Boolean

A non-self-stabilizing function returning true if at any point in time a certain condition happened.

Link copied to clipboard
inline fun <ID : Comparable<ID>, Value : Comparable<Value>> Aggregate<ID>.gossipMax(local: Value): Value

Self-stabilizing gossipMax with a default comparator. Spreads across all (aligned) devices the current maximum Value of local, as computed by first value compared to the second.

inline fun <ID : Comparable<ID>, Value> Aggregate<ID>.gossipMax(local: Value, comparator: Comparator<Value>): Value

Self-stabilizing gossip-max. Spreads across all (aligned) devices the current maximum Value of local, as computed by comparator.

Link copied to clipboard
inline fun <ID : Comparable<ID>, Value : Comparable<Value>> Aggregate<ID>.gossipMin(local: Value): Value

Self-stabilizing gossipMin with a default comparator. Spreads across all (aligned) devices the current minimum Value of local, as computed by first value compared to the second, and then reversed.

inline fun <ID : Comparable<ID>, Value> Aggregate<ID>.gossipMin(local: Value, comparator: Comparator<Value>): Value

Self-stabilizing gossip-min. Spreads across all (aligned) devices the current minimum Value of local, as computed by comparator.

Link copied to clipboard
inline fun <ID : Any, Type> Aggregate<ID>.gradientCast(source: Boolean, local: Type, metric: Field<ID, Double>, maxDiameter: Int = Int.MAX_VALUE, noinline accumulateData: (fromSource: Double, toNeighbor: Double, data: Type) -> Type = { _, _, data -> data }, crossinline accumulateDistance: Reducer<Double> = Double::plus): Type

Broadcasts a fast-repair gradient of local values from all source nodes, always retaining the data from the nearest source.

inline fun <ID : Any, Value, Distance : Comparable<Distance>> Aggregate<ID>.gradientCast(source: Boolean, local: Value, bottom: Distance, top: Distance, metric: Field<ID, Distance>, maxDiameter: Int = Int.MAX_VALUE, noinline accumulateData: (fromSource: Distance, toNeighbor: Distance, neighborData: Value) -> Value = { _, _, data -> data }, crossinline accumulateDistance: Reducer<Distance>): Value

Computes a fast, self-healing gradient broadcast of local values from all source nodes, always retaining the data from the nearest source.

Link copied to clipboard
inline fun <ID : Any> Aggregate<ID>.hopDistanceTo(source: Boolean, maxDiameter: Int = Int.MAX_VALUE): Int

Computes the hop-count distance from the nearest source node as an Int.

Link copied to clipboard
inline fun <ID : Any, Type> Aggregate<ID>.hopGradientCast(source: Boolean, local: Type, maxDiameter: Int = Int.MAX_VALUE, noinline accumulateData: (fromSource: Int, toNeighbor: Int, data: Type) -> Type = { _, _, data -> data }): Type

Broadcasts a fast-repair gradient of local values using hop count as the distance metric.

Link copied to clipboard
inline fun <ID : Any, Type> Aggregate<ID>.intGradientCast(source: Boolean, local: Type, metric: Field<ID, Int>, maxDiameter: Int = Int.MAX_VALUE, noinline accumulateData: (fromSource: Int, toNeighbor: Int, data: Type) -> Type = { _, _, data -> data }, crossinline accumulateDistance: Reducer<Int> = Int::nonOverflowingPlus): Type

Broadcasts a fast-repair integer gradient of local values from all source nodes, always retaining the data from the nearest source.

Link copied to clipboard
inline fun <ID : Comparable<ID>> Aggregate<ID>.isHappeningAnywhere(condition: () -> Boolean): Boolean

Returns true if the condition is holding anywhere in the network, false otherwise.

Link copied to clipboard
inline fun <ID : Any, Value> Aggregate<ID>.multiGradientCast(sources: Iterable<ID>, local: Value, metric: Field<ID, Double>, maxDiameter: Int = Int.MAX_VALUE, noinline accumulateData: (fromSource: Double, toNeighbor: Double, data: Value) -> Value = { _, _, data -> data }): Map<ID, Value>

Computes a fast-repair gradient propagation from multiple sources, returning a map of the propagated values for each source ID.

inline fun <ID : Any, Value, Distance : Comparable<Distance>> Aggregate<ID>.multiGradientCast(sources: Iterable<ID>, local: Value, bottom: Distance, top: Distance, metric: Field<ID, Distance>, maxDiameter: Int = Int.MAX_VALUE, noinline accumulateData: (fromSource: Distance, toNeighbor: Distance, data: Value) -> Value = { _, _, data -> data }, crossinline accumulateDistance: Reducer<Distance>): Map<ID, Value>

Computes, for each ID in sources, a fast-repair gradient propagation of local values, returning a map from each source ID to its propagated value at this device.

Link copied to clipboard
inline fun <ID : Any, Value> Aggregate<ID>.multiIntGradientCast(sources: Iterable<ID>, local: Value, metric: Field<ID, Int> = hops(), maxDiameter: Int = Int.MAX_VALUE, noinline accumulateData: (fromSource: Int, toNeighbor: Int, data: Value) -> Value = { _, _, data -> data }): Map<ID, Value>

For each ID in sources, propagates data from that source using a fast-repair integer gradient, and collects the results in a map from source ID to propagated value.

Link copied to clipboard
inline fun <ID : Any, Value> Aggregate<ID>.nonStabilizingGossip(value: Value, noinline aggregation: (Value, Value) -> Value): Value

A non-self-stabilizing gossip function for repeated propagation of a value and aggregation of state estimates between neighboring devices.