Skip to main content

Module world

Module world 

Source
Expand description

The page world: everything a page’s run reads and writes besides the program’s own values — the document, the journal of the turns it took, the page clock, the sealed test world, and the browser’s storage.

Each lives in a thread-local of its own module; this is where they are handled as ONE world. A program run starts from a fresh one (begin_run); a session carried onto a thread of its own takes its caller’s world with it and hands it back (PageWorld); a comparison of tiers enters a fresh one per tier and restores the caller’s afterwards.

Structs§

JournalEntry
One entry of the journal: a turn that ran, the instance it ran against, what it changed, and — when it trapped — the failure that rolled it back.
PageWorld
A page world, taken out of the thread that held it: what PageWorld::take leaves a fresh one in place of and PageWorld::restore puts back.

Functions§

arm_hot_reload
A HOT RELOAD: largo serve rebuilds a page when its file changes and runs it again, and the run it arms keeps the browser’s storage — the form half filled in stays filled in — where a cold start would begin with nothing stored. Armed by whoever performs the reload, consumed by the next run.
begin_run
What a program run starts from: reset — a run of a program is a fresh process — unless a hot reload was armed (arm_hot_reload): then the journal starts again and the browser’s storage, where preserved state lives, is kept.
journal
Every turn recorded since the world began, in order.
journal_push
Record a turn.
reset
A FRESH WORLD, the document aside (its owner resets it: crate::semantics::dom::reset): an empty journal, and a browser opened for the first time — storage is what a page left on a visitor’s machine, and a run that inherited a previous run’s would make every test depend on the order the tests happened to run in.