enqueue

fun enqueue(taskId: TaskId, descriptor: TaskDescriptor)

Add a task to the distributed work queue on the CoordinationKind.Free path.

The descriptor — carrying the op name and serialised args — is the unit of work that travels: claiming peers resolve TaskDescriptor.op in their own OpRegistry and run their registered copy locally. The function never crosses the fabric; only its name and args do.

The enqueue is replicated immediately to all current peers via the Quilter. Idempotent at the ORMap level: a concurrent enqueue of the same taskId on another peer survives merge (add-wins on the key; LWW picks one descriptor if two concurrent enqueues race on the same ID).


fun enqueue(taskId: TaskId, kind: CoordinationKind)

Add taskId to the distributed work queue on the CoordinationKind.Coordinated path.

Routes to the Raft-backed escalation path. The ring owner proposes the task to raftNode for total-order delivery, then calls coordinatedExecutor exactly once per committed log entry. The task is replicated in a separate queue so the free path is completely unaffected.

Requires raftNode to be non-null — throws IllegalStateException immediately if none was supplied to the constructor.

Note: CoordinationKind.Free is not accepted here — use enqueue(taskId, descriptor) for free-path tasks. A TaskDescriptor is required to carry the op name and args.

Idempotent at the ORSet level: a concurrent add of the same ID on another peer survives merge (add-wins).