Skip to main content

Module doses

Module doses 

Source
Expand description

Each dose that fell due, as a record your devices share (docs/health.md, “Doses as records”): $XDG_STATE_HOME/sioul/health-doses.toml, in the sharing’s health part.

A dose falls due: a device that sees it opens its record, not taken yet (the canary), and says so (opened: each device that did, and when). The first device that captures your answer turns it into taken (when you took it, earlier if you say so) or skipped, noting itself and when. Each device writes only its own opening and its own answer, so the sharing, where the later word wins entry by entry, never has two devices fighting over one entry: answers merge here, when read (answered), by the earliest captured; two that differ are both kept, both said, and you choose. A merge takes nothing out. Records go nine days after their dose (KEPT_DAYS).

A file of its own, not a table of health-state.toml: an older Sioul saves that one through what it knows and would drop the table, which the sharing would then take out on every device. An older Sioul keeps this file’s changes waiting, unknown to it, and writes nothing in it. The marks of health-state.toml (taken, not_taken) are still written beside the answers, for it, and read here as answers of a device not named.

Structs§

Answer
One device’s answer, shared whole (whole = ["dose.*.answer.*"] in the sharing).
DoseRecords
The doses that fell due, by key (<medicine>@<Unix seconds>).
Given
An answer as merged: what, by which device, when.
Record
One dose that fell due.

Enums§

Answered
A dose’s answers, merged.
State
What an answer says.

Constants§

FILE
The file’s name, in Sioul’s state folder.
KEPT_DAYS
How long a record is kept after its dose was due: the Health page’s week back (shown, read only), and two days.
SKIPPED
TAKEN

Functions§

answered
A dose’s answers, from the records and the marks of health-state.toml, merged: the same answer everywhere is that answer, the earliest captured; answers that differ are all kept. A mark of health-state.toml that says what an answer already says is that answer, written beside it for an older Sioul.
parts 🔒
“levo@1800000000” → (“levo”, 1800000000).