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 computer also says whether a person is at it (
active): input within ten minutes and its session unlocked, as its system says, or a press in Sioul’s window or of do-not-disturb’s switch, which counts at once. A phone’s background steps slow down while nobody is at any computer (others_in_use); where the system says nothing of it, Sioul running counts, as before.
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 🔒
- PRESSED 🔒
- When a press was last made in Sioul on this computer: in its window, or of do-not-disturb’s switch (Unix seconds; 0, none in this process).
- PUBLISHED 🔒
- This process’s opening, its entry’s
started, once written into the folder (Unix seconds); 0 while not (sharing off, the key not read, the folder not writable). Until every phone said it read it, this computer is never a dose’s first reminder (health::first_here). - 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§
- active_
here 🔒 - Whether a person is at this device now, for its entry (
Entry::active): on a phone, unsaid (in use only while Sioul is on its screen); on a computer, asactive_ofreads the session’s last reading and the last press in Sioul. The system is read on a thread of its own every thirty seconds (watch_system): an exchange, a start or a close only read the value kept, and never wait on the system’s bus (a bus that never answers once held the exchanges for good: review of battery part C, F3 and G1). No reading yet, or one two minutes old: unsaid (Sioul running counts), a recent press aside. - active_
of 🔒 active_here, from what was read: a phone; the session’s last reading and how long ago it was made (none: none fresh); when Sioul was last pressed here (Unix seconds, 0 never); now.- 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).
- entries 🔒
- This device’s id and every device’s entry, as the folder and the last
pull’s copy hold them (
sioul_sync::devices::all); none while sharing is off. - 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), and, while you sleep (asleep), a computer only with someone at it (sioul_sync::devices::others_in_use): for the rhythm of a phone’s background service only; the doses’ knowing ishealth::know’s. - power_
now 🔒 - Every fact of this computer’s (
sioul_sync::power::read, throughwatch_system): may wait for a fresh reading ten seconds at most, so only on a thread of its own (the spam filter’s training by itself), never in an exchange (share::meteredreads what is kept). A computer’s alone: a phone never trains. - pressed 🔒
- A press in Sioul’s window (cpp/application.cpp), or of do-not-disturb’s
switch (
everywhere::press), on this computer: a person is at it, whatever its system says of input, for ten minutes, and whatever the session’s last reading said of its lock when the press is newer than it (sioul_sync::power::present_since). Kept for the next export, at the minute’s cadence: never an exchange of its own, which would tell the server when someone came back to this computer (review of battery part C, G2). - published_
start 🔒 - This process’s opening as written into the folder; 0 while it is not.
- raise 🔒
- Up, said; a session found up already owes an export. A computer says
too whether someone is at it (
active_here). - 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. - replace 🔒
- This device replaces another (a phone that will never share again: dead,
lost), as you said when it joined (
join::replace): written into its entry, sealed, for every device to read (Entry::replaces), what that one last said with it. Whether it went into the folder. - resumed 🔒
- This computer came back after a gap in its own running (asleep, the
machine frozen): a new opening, as a start, so that every phone’s word on
it is asked anew before it is a dose’s first (
health::tick; the seventh review’s C1). - sessions 🔒
- sioul_
window_ pressed - A press in Sioul’s window, from its event filter (cpp/application.cpp),
a few seconds apart at most:
pressed. - watch_
system 🔒 - The system’s reading thread started and asked for readings
(
sioul_sync::power::watch): this computer’s session, its power supply, its connection’s cost, read on connections of its own and kept; the one way this program has them read. In this crate’s tests, on a stand-in bus of their own that never answers (tests::stand_in_bus): never the session or the system of whoever runs them. - 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. Whether it went into the folder.