Skip to main content

Module kvstore

Module kvstore 

Source
Expand description

An explicit, bounded compatibility frontend for the current replica.

CPU word: opcode[1:0], value[31:2], key[63:32]. Opcode one is PUT; other opcodes remain GET as upstream. PUT supports key16/value16 and rejects wider values rather than silently truncating. GET uses key32 zero-extended to the table’s key64. All response fields are initialized.

The current controller duplicates each (value32, sequence32) decision onto output and remote. This adapter buffers both, verifies equality, and applies each accepted sequence once within a coordinated session. Only repeats of the latest applied sequence/value are drained; older replays fault. Reset discards this deduplication history. This is not an adapter for historical mutually exclusive local/remote ownership. Sequence zero, gaps, backwards movement, conflicting duplicates, and malformed beats fault closed. A session must reset before sequence wrap; reset must also reset/drain the table, controller, and all transport queues together. The first nonzero sequence is accepted: attaching mid-history requires an externally established consistent snapshot, not just a plausible sequence.

Transfers occur on rising edges with valid and ready asserted. Producers hold valid and payload until transfer during healthy operation. A terminal fault requires coordinated recovery; reset suppresses all handshakes.

One local PUT may wait while remote decisions continue to apply. A matching decided value completes that PUT, but the wire has no client/request ID: this proves value convergence, not attribution to a particular proposal. GET is a local read, not a linearizable distributed read. A successful PUT response says the table update completed, not that the protocol is safe.

Structs§

Decision
One 256-bit controller decision. Reserved lanes must be zero, last true.
KvIn
CPU, controller, and table inputs for one outstanding local operation.
KvOut
CPU results and requests to the external controller and local table.
KvResult
Observable CPU result. Status: 0 success, 1 PUT range error, 2 table failure. Protocol fault is reported separately and is sticky.
KvState
Separate local-operation and replicated-application state machines.
LegacyKv16
Lossless-within-profile replacement for the upstream KV frontend.

Functions§

kv_kernel
CPU phases: idle, propose, wait-decision, lookup-request, lookup-response. Apply phases: idle, update-request, update-response.