Documentation
¶
Overview ¶
Package runstop is the stop a person sets from their own account, which the unattended runs of each account that chose the same folder read before their next move (itd-2611041549471712, dcn-2611041550139264).
The person's seat and the run's seat may be two accounts on one machine, and no store abcd has can carry a word between them, since each is owner-only. So the person chooses a shared folder at setup, on a machine no other person shares, and the stop is a file there: the one file outside abcd's owner-only rule. Declining leaves a stop in the account's own home, which reaches only that account's runs.
The file is an input from outside the reading account, and it is a request to stop and nothing more. It is opened once with O_NOFOLLOW and O_NONBLOCK (fsutil.OpenRegular) and judged on that same descriptor: a regular file, within MaxStopBytes, owned by the account the person named at setup. Who set it and when come from the descriptor. No byte of it is read, so nothing written there can reach a run, a record or a terminal. Anything else at the path is refused and named, and is no stop.
Index ¶
Constants ¶
const ( // StopDirName opens the name of the person's own directory in the shared // folder, which carries their account's number (stopDirName), StopFileName is // the stop inside it, and HomeStopFile the stop in the account's own home where // no folder was chosen. StopDirName = "abcd-stop" StopFileName = "abcd-stop.json" HomeStopFile = "stop.json" // SettingFile holds the folder and the person's account, in abcd's home. SettingFile = "shared-folder.json" // LiftLogFile is the person's own account of each stop set and lifted, in // abcd's home. LiftLogFile = "stop-log.jsonl" // DigestDir opens the name of each account's directory of dated pages in the shared // folder (digestDirFor). DigestDir = "abcd-digest" // MaxStopBytes bounds the stop file: what the verb writes is a few dozen // bytes. MaxStopBytes = 4 << 10 )
Variables ¶
var AccountHome = databaseHome
AccountHome is the home a stop is read from, and databaseHome the production value. A test names a fixture.
var WellKnownFolder = Suggested
WellKnownFolder is the platform's shared folder, read whatever the setting says; a test empties it.
Functions ¶
func Lift ¶
Lift removes this account's stop: the lift is recorded first, so a lift with no record does not happen. A stop another account wrote is left alone and named. lifted is false when there was none.
func Suggested ¶
func Suggested() string
Suggested is the folder setup offers: a real, sticky, shared directory on this platform. On Linux it is under an age cleaner's care, which the setup's page says.
Types ¶
type Pin ¶
type Pin struct {
Folder string `json:"folder"`
Person string `json:"person"`
PersonUID int `json:"person_uid"`
}
Pin is the shared folder and the person a run started under.
type Reading ¶
type Reading struct {
Stop *Stop
Refused []string
Held string
// Foreign names each stop another account left where this one looks, which is
// not honoured and is said.
Foreign []string
}
Reading is what one read found: the stop in force, if any, and one line for each thing refused on the way, which is no stop. Held says why the read cannot be trusted to have seen a stop, which holds the run; "" when it can.
func ReadPinned ¶
ReadPinned is the one read every run makes before a move. It never fails: a file that is no stop is refused and named, so it does not itself stop a run that holds no mark and it does not go unsaid; such a read keeps a marked run stopped and refuses a take-over, since it did not see clearly. It reads the account's own stop, the folder the run started under, the folder the setting names, and the platform's shared folder for an account it expects. Held says the read cannot be trusted to have seen a stop, and the run does not take it for none: a setting that cannot be read, or that has gone or changed since the run took pin; a home that cannot be found; or a folder the run started under or the setting names that fails its check, or whose stop cannot be looked at. A stop any other account left in one of those folders is not honoured, and is named in Foreign.
type Setting ¶
type Setting struct {
SchemaVersion int `json:"schema_version"`
// Folder is the shared folder, absolute.
Folder string `json:"folder"`
// Person and PersonUID name the account whose stop this account honours.
Person string `json:"person"`
PersonUID int `json:"person_uid"`
}
Setting is the choice made at setup, in each account that takes part.
func ReadSetting ¶
ReadSetting reads this account's setting: ok is false when none was chosen. It is the account's word, so it passes the guards every such file passes.
func WriteSetting ¶
WriteSetting records the choice: the folder, and the account whose stop this one honours (this account when person is empty). The folder is judged first, and nothing is written when it fails.
type Stop ¶
type Stop struct {
SetBy string `json:"set_by"`
UID int `json:"uid"`
SetAt time.Time `json:"set_at"`
Path string `json:"path"`
// Stood is set by Set on a stop that was already standing, which it left in place.
Stood bool `json:"stood,omitempty"`
}
Stop is a stop in force. Every field but Path comes from the file's descriptor, never its text.
func Set ¶
Set writes the stop from this account. A path a run would refuse is reported and left alone: the person is never told a stop took hold that no run honours. A valid stop that stands is left as it is, keeping its time, since the runs it has reached know it by that; the result's Stood says so.