Results

A distributed results board — the dedup backstop for :kuilt-warp.

Backed by an ORMap<TaskId, LWWRegister<Result>>: each task ID maps to a last-writer-wins register holding the task's result. A duplicate execution of the same task (same taskId) is absorbed idempotently: the LWWRegister join picks the result tagged with the highest (timestamp, replicaId), discarding the other. The result map always converges to exactly one result per task.

Merge semantics — why LWW and not MVRegister? Results tolerates duplicate execution (the warp design expects ~5–25% duplication under partition; see docs/warp-foundation.md). The goal is a single converged result per task, not a set of concurrent values. LWW achieves this with zero extra state: both executions produce a result; the one with the higher timestamp wins; the other is silently discarded. For embarrassingly-parallel tasks the discarded result is never wrong — it is a redundant computation on identical input. Callers that cannot tolerate even silent discard should use the Coordinated path (slice B).

Clock responsibility. The timestamp passed to record must be monotonically increasing within a single replica to prevent older writes silently winning. Wall-clock milliseconds are the common case; a logical clock or HLC is safer under skewed clocks.

Immutable: record returns a new instance. merge is the causal join.

Type Parameters

TaskId

the type used to identify tasks — must be a stable, unique, serializable key.

Result

the result type produced by executing a task.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The set of task IDs for which a result has been recorded.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
operator fun get(taskId: TaskId): Result?

The recorded result for taskId, or null if no result has been recorded yet.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

The causal merge of two replicas of this results board.

Link copied to clipboard
fun record(replica: ReplicaId, taskId: TaskId, timestamp: Long, result: Result): Results<TaskId, Result>

Record a result for taskId on behalf of replica at timestamp.

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