Currently in testing: the GitHub code will be opened once complete.

A · Acquire

Structurerefresh

A lock acquire request. lease is the lease duration in seconds — the safety net the server uses to reclaim the key if the client dies without releasing. wait is the upper bound in seconds on how long to wait to acquire; 0 means one immediate attempt without entering the queue. There is no infinite wait. The response is Acquired A on success, Timed Out T if the wait expires, or Busy B if the wait queue is full.

owner — Response Correlation Identifier

owner is an identifier for one acquire attempt's response. The client generates a fresh value per call, and the server echoes it in A, T, and B so pipelined replies can be matched.

owner is neither lock authority nor a fencing token. Sending the same key and owner again does not return an active token or renew its lease. If even one request byte may have been sent and no reply was confirmed, the client must not automatically resend that acquire with the same owner; the result is Indeterminate. It must not enter the critical section, and an unobserved grant is reclaimed no later than its lease expiry.

Official clients create one monotonic whole-operation deadline from the caller's normalized wait, and keep that deadline and owner across definitely-unsent retries. Immediately before sending, the writer rounds up the remaining time and recalculates the wire wait, so a late connection cannot start a fresh 255-second server wait. A queued request past the whole deadline is not sent; if it may already have been sent, its exact session is closed and the result is Indeterminate. If a correlated A from just before the deadline is discovered late at the Ticket delivery gate, the session need not close, but the exact token is scheduled for a compensating release and Indeterminate is returned. Correlated T and B remain definitive timeout and busy results, respectively.

An original wait=0 remains an immediate wire attempt. During its separate five-second transport deadline, the client may select another connection and retry with the same owner only while the request is definitely unsent; the actual server-side attempt is still exactly one. It never retransmits after a possible send.

Byte notation: op is an ASCII character, wait/lease are binary (u8), owner is binary (u64, big-endian), and key is UTF-8 text (variable-length, shown as N in the structure). The trailing \n is 0A. The fixed header is a binary value that may contain 0x0A, so it must be consumed by byte count first, before scanning for the newline.

Flow

Client
Server
A · acquire (key · wait · lease · owner)
key is unheld → issued immediately
A · acquired (token)
held + wait>0 → waits its turn in the FIFO queue
turn arrives → A · acquired (token)
wait exceeded → T · timed out
wait=0 + held → T · immediate miss
queue/server capacity full → B · busy
requestresponse

See Request × Key-State Matrix for the full rules on behavior per key state.