Expand description
The pulse: the watcher telling kasl-server whether you are working, on a break, or not in a day - right now, once a minute.
Everything else kasl sends is about the past: a day goes up when it is pushed. The pulse is the one thing about the present, and the only side that knows it is this one - the watcher knows whether it is inside a pause and whether today’s workday is open (ADR 0014 in kasl-server).
Three rules shape it:
- Opt-in, per connection. Connecting agrees to send finished days. A
live signal of whether someone is at their keyboard is a different thing
to agree to, so it waits for
kasl server pulse enable. - The state and nothing else. Not the task, not the reason for a break: those belong to the day, under the server’s privacy level.
- The server owns the cadence. It answers every pulse with the interval it wants and the point at which it stops believing one; the two have to agree, so kasl takes both rather than configuring its own.
The watcher is the only sender. kasl server pulse enable and kasl server status read what it recorded in ServerPulse rather than sending a
pulse of their own, so the server never hears two versions of the present.
// Beside the monitor, for as long as the watcher runs.
tokio::spawn(kasl::libs::pulse::run(monitor.pause_flag()));Structs§
- Cadence
- When the next pulse is due.
- Pulser
- The watcher’s side of the pulse, one tick at a time.
- Status
Line - One line of the pulse’s report, and whether it is a warning.
Enums§
- Beat
- What came of one pulse.
Constants§
- DEFAULT_
INTERVAL - The interval used until the server has said what it wants.
- REFUSED_
RETRY - How long to wait after the server refused a pulse.
Functions§
- beat
- Sends one pulse claiming
state, records how it went, and says how long to wait before the next. - describe
- What
kasl server statussays about the pulse. - format_
ago - A span of seconds the way a person reads it:
42 s,6 min,2 h 5 min,3 d. - interval_
from - The interval a server asked for, held inside [
INTERVAL_BOUNDS]. - presence
- What the watcher claims, from what it sees.
- run
- Runs the pulse for as long as the watcher does.