Package-level declarations

Types

Link copied to clipboard
@Serializable
data class Candidacy<ID : Any, Distance : Comparable<Distance>, Strength : Comparable<Strength>>(val candidate: ID, val distance: Distance, val strength: Strength) : Comparable<Candidacy<ID, Distance, Strength>>

A Candidacy represents a candidate in an election. candidate is the ID of the candidate. distance is the Distance of the current device from the candidate. strength is the Strength of the candidate.

Functions

Link copied to clipboard
inline fun <ID : Comparable<ID>> Aggregate<ID>.boundedElection(bound: Double, metric: Field<ID, Double>, crossinline selectBest: Reducer<Candidacy<ID, Double, ID>> = ::maxOf): ID
inline fun <ID : Comparable<ID>> Aggregate<ID>.boundedElection(bound: Int, metric: Field<ID, Int> = hops(), crossinline selectBest: Reducer<Candidacy<ID, Int, ID>> = ::maxOf): ID
inline fun <ID : Any, Strength : Comparable<Strength>> Aggregate<ID>.boundedElection(strength: Strength, bound: Double, metric: Field<ID, Double>, crossinline selectBest: Reducer<Candidacy<ID, Double, Strength>> = ::maxOf): ID
inline fun <ID : Any, Strength : Comparable<Strength>> Aggregate<ID>.boundedElection(strength: Strength, bound: Int, metric: Field<ID, Int> = hops(), crossinline selectBest: Reducer<Candidacy<ID, Int, Strength>> = ::maxOf): ID
inline fun <ID : Comparable<ID>, Distance : Comparable<Distance>> Aggregate<ID>.boundedElection(bound: Distance, metric: Field<ID, Distance>, bottom: Distance, crossinline accumulateDistance: Reducer<Distance>, crossinline selectBest: Reducer<Candidacy<ID, Distance, ID>> = ::maxOf): ID
inline fun <ID : Any, Distance : Comparable<Distance>, Strength : Comparable<Strength>> Aggregate<ID>.boundedElection(strength: Strength, bound: Distance, metric: Field<ID, Distance>, bottom: Distance, crossinline accumulateDistance: Reducer<Distance>, crossinline selectBest: Reducer<Candidacy<ID, Distance, Strength>> = ::maxOf): ID

Bounded election is a self-stabilizing and priority-based multi-leader election algorithm presented in a IEEE ACSOS 2022 paper.

Link copied to clipboard
inline fun <ID : Comparable<ID>> Aggregate<ID>.globalElection(): ID
inline fun <ID : Any, Strength : Comparable<Strength>> Aggregate<ID>.globalElection(strength: Strength, metric: Field<ID, Int> = hops(), crossinline selectBest: Reducer<Candidacy<ID, Int, Strength>> = ::maxOf): ID

Self-stabilizing, priority-based single-leader election built by forcing Int.MAX_VALUE as bound for boundedElection.