CoordinationFree

class CoordinationFree<A : Quilted<A>>(val state: A)

A task or contribution that is safe to apply without coordination — it lives in a join-semilattice, so concurrent applications from any number of peers converge to the same result regardless of order, duplication, or delivery gaps.

The monotone contract is encoded in the type: only values that implement Quilted (i.e., values whose Quilted.piece join is idempotent, commutative, and associative) can be wrapped here. This makes it structurally impossible to place a non-monotone value on the coordination-free path.

Use embroider to merge a contribution into this value. For tasks that are NOT idempotent or require strict exactly-once delivery, use Coordinated instead.

Type Parameters

A

the lattice type — must implement Quilted.

See also

Constructors

Link copied to clipboard
constructor(state: A)

Properties

Link copied to clipboard
val state: A

the current lattice value.

Functions

Link copied to clipboard

Apply contribution by joining its state into this value's state.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun <A : Quilted<A>, B : Quilted<B>> CoordinationFree<A>.monotoneMap(transform: (A) -> B): CoordinationFree<B>

Apply transform to this value's state, producing a new CoordinationFree with the transformed state. The caller is responsible for ensuring transform is itself monotone — i.e. that the output lattice's join is preserved under the mapping.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Pair this value with other into a LatticeProduct, combining both states into a single coordination-free snapshot.