-
Notifications
You must be signed in to change notification settings - Fork 33
Build Claims
For several builders sharing one cache. Before building, a worker opens
POST /api/builds/claim {"outputs":["<hash>.narinfo",…],"inputs":[…],"token":0}
and reads NDJSON status lines: built (outputs are cached, done),
build with a token (you build, keep the stream open as heartbeat),
wait (someone else builds, the stream reports built or failed when
they finish), hb (keep-alive). A holder that disappears for three
heartbeats loses the claim to the next waiter. Re-sending the token
re-enters a held claim after a reconnect.
The holder publishes the outputs with the token (claim_token on a
push --stdin request line or on POST /api/pending_closures/{id}/complete),
which commits and releases atomically. A superseded token gets 409 /
status stale and publishes nothing. POST /api/builds/fail {"claim_token":N,"kind":"…"} releases without a result and tells
current waiters. GET /api/cache-config carries claim_heartbeat_secs.
Parked streams are bounded by --max-claim-streams (503 + Retry-After
beyond).
nix-grpc-store is a build farm built on this.