Expand description
Admin socket — push-style daemon-lifecycle event broadcast.
Specified in docs/protocol-v1.md §“Admin endpoint”. On connect,
the daemon writes a snapshot frame (current state). Every state
transition pushes another frame. Read-only stream from daemon →
client; client writes are ignored.
Wire shape:
{"id":"admin","type":"status","status":"loading_model","phase":"download",
"downloaded_bytes":33554432,"total_bytes":5126304928,
"source_url":"https://huggingface.co/..."}Architecture:
StatusBroadcasterwraps atokio::sync::watch(for the “current state” snapshot newcomers see) and atokio::sync::broadcast(for the live event stream).serve_admin_*accept loops per platform; each accepted connection spawns a writer task that (1) writes the watch’s current value as the snapshot, then (2) forwards every broadcast event after that. Slow clients overflow the broadcast buffer and get disconnected with EOF — they reconnect to resume.
Structs§
- Status
Broadcaster - Daemon-wide status broadcaster.
Constants§
- ADMIN_
BROADCAST_ CAPACITY - Capacity of the broadcast channel that fans events out to admin clients. Past this, slow clients lag behind and the daemon drops them — they reconnect to resume from the current snapshot.
Functions§
- serve_
admin_ uds - Serve an admin Unix domain socket (Unix only). Loops until
shutdownresolves.