Expand description
This device’s sessions, as your other devices learn them through the
sharing folder (docs/database.md, “Devices”; sioul_sync::devices): its
start, its clean close, and between them working, up.
- On a computer, a session is the window’s life: up when Sioul starts,
down as the last step of a clean close (the window closed, or the stop
signal: cpp/signals.cpp quits Qt), after the final export (
share::closing). - On a phone, a session is the time on the screen: up when Sioul comes back, down when it goes to the background, after its export (Android may end a process in the background without a word, so it goes down then).
- A reminder handled while no session is open here (a dose’s alarm,
“Taken” pressed on its notification) is a session of its own: up, what
it records, its export, down (
receiver). Only when the last one ends, the window’s or a receiver’s, does it go down. - Each exchange says what it read and wrote (
exported), never touching the session: a phone’s background service exporting in its own process never undoes the window’s.
A crash leaves it up: your other devices then say they cannot tell what was marked here, until it starts again or you say it is off.
Structs§
- Sessions 🔒
- The sessions open in this process: the window’s, and receivers at work.
Statics§
- EXPORTED 🔒
- RECORDED 🔒
- When this process last recorded something of the doses (a mark, a record, a reminder), and when its last export read the files (milliseconds, this device’s clock). A session goes down only once an export read the files after the last of them: else an answer captured here may not have gone out, and saying “closed” would make the others sure of what they lack.
- SESSIONS 🔒
Functions§
- all_out 🔒
- Whether everything recorded here went out with an export since.
- doses_
said 🔒 - Whether this device’s entry may say it shares its doses: it shares the health part, and that part is not held here under a newer format (its answers then wait unsent, and the others must not count them as known).
- exported 🔒
- An exchange done: what it read and wrote, said; the session as it is. The first export of a session is carried at once (a phone’s sync app asked to look): the others see this device in use with fresh news, not with what it last shared before it was put away.
- in_
receiver 🔒 - Whether a reminder’s own session is at work in this process (no window open): the sync app is then asked once it is down, not by each exchange inside it.
- kind 🔒
- A phone, or a computer.
- kind_
and_ 🔒name - A device’s kind (“phone”, “computer”) and name, from its entry in the folder; none when it has none (an older Sioul, or not arrived yet).
- left 🔒
- Sharing stopped here: down, and said to count no more.
- lower 🔒
- Down, said, the last step of a session, once all it recorded went out; else it stays up, and the others say what they cannot know until the next session’s export.
- may_
lower 🔒 - Whether a session may go down (closed: everything it captured went out): all it recorded went out, and the doses’ part is not held here, which this process’s own counts cannot tell after a restart.
- name 🔒
- This device’s name, to say where: a computer’s host name; a phone’s model (its host name is “localhost”), said “the phone” by the others.
- now 🔒
- others_
in_ 🔒use - Whether another device says it is in use, with an export dated lately
(
FRESHandSKEW): for the rhythm of a phone’s background service only; the doses’ knowing ishealth::know’s. - raise 🔒
- Up, said; a session found up already owes an export.
- receiver 🔒
work(what a reminder records, then its export) as a session of its own when none is open here: up first, so that a process ended in its midst leaves the others in doubt rather than sure; down after, then the sync app asked to carry it (share::nudge_carriers): the lowered entry goes up, not the raised one.- recorded 🔒
- Something of the doses recorded here (
health::change,change_records): owed to the others until an export reads it. - sessions 🔒
- went_
out 🔒 - Whether what was recorded (
RECORDED) went out with an export since (EXPORTED): both 0 in a process just started, which knows nothing of an earlier one’s. - window_
closed 🔒 - The window’s session ended, its final export done (
share::closing): down, unless a receiver is still at work, orendedsays it is not over after all (a phone’s Sioul brought back meanwhile). - window_
opened 🔒 - The window opened, or a phone’s Sioul back on the screen: up. Found up already (the last session ended without closing: a crash), what it left is owed an export before the next close.
- write 🔒
- This device’s entry changed by
change, its identity set: written here, and into the folder when sharing is on. Never fails loudly: the doses of the others say what they cannot know when it is not written.