Expand description
What a running kute peer serve says about itself, for someone at the
same machine to read.
The peer and the HTTP service are separate processes, and the peer
opens no second port for this. With --status-file it writes a small
JSON file: when it starts listening, when a connection is refused,
when an exchange begins, once a second while it runs, and when it
ends. kute serve --peer-status FILE reads that file when asked
(GET /v1/peer), and Studio shows it.
A file cannot say that its writer is alive. What it can say is when it was last written, and a peer that is running writes every second, so a file that has not been written for several seconds while claiming to be running is reported as stale and not as running.
Constants§
- ENDED
- EXCHANGE
- FORMAT
- The number in
kute_peer_status. A reader refuses any other. - HEARTBEAT
- How often a running peer rewrites the file.
- MAX_
BYTES - The largest status file a reader takes.
- WAITING
Functions§
- end
- The peer is ending, this way.
- enter
- Change the state and write at once.
- now
- read
- Read a status file for the HTTP service. Never an error: a file that is missing, too large or not a status is an answer about the peer.
- set
- Change what the next write says. Nothing is written now: counts that move with every message are picked up by the next beat.
- start
- Begin writing status to
path, starting withfirst. A path that cannot be written is the operator’s mistake, told now.