Retention for Vis-owned state: advisory inventory and bounded cleanup.
ADVISORY (scan observes, purge! acts, vis-agent doctor renders): the
gateway journals, sandbox snapshots of sessions with no row, and temp files of
killed writes. scan is pure observation (no mutation, never throws) and
purge! is the explicit operator action behind vis-agent doctor --purge.
SELF-DELETING (sweeps): diagnostic logs, the gateway journals, the display
caches and old downloaded Python archives. Those are DERIVED — a log of a
process that exited, the wire replay of a turn the DB already owns, a picture
whose bytes are already DB-owned — so they carry a window instead of a report.
sweep-targets is the one list of them. Each sweep has its own interval, and
the stamp of a root holds that interval for the whole machine (claim-sweep!),
so one process walks a root in each interval. No sweep has its own thread:
tasks gives each sweep to internal.janitor, the one maintenance worker of a
process, and the worker repeats it while the process runs. sweep-stale! runs
the same sweeps one time on the calling thread.
Journals also self-sweep inside the tailer loop (gateway.bus/sweep!) after a
single idle day, but that is a LIVENESS rule and it only runs while a daemon
does — journals from crashed or never-restarted daemons used to stay forever.
Versioned Python runtime and source trees, and the frozen guest trees under
python/vis-guest, are reclaimed by CLAIM rather than by age. Every process
claims the trees it boots from (internal.paths/claim-dir!), so an older
install still serving another Vis process is kept however old it is, while the
tree a killed process left behind is free the moment it dies. The pinned and
the newest install are never candidates at all, and a tree from a build before
claims existed still waits out the retention window.
runtime-retention-plan previews that classification without deleting.
Compiled bytecode under python/pycache is judged by EXISTENCE instead: the
prefix mirrors absolute source paths, so an entry whose source is gone is garbage
whatever its age, and one whose source is live is a cache the next import wants.
purge! removes journal files and sandbox snapshots directly, confined to the
events or sandbox store.
Retention for Vis-owned state: advisory inventory and bounded cleanup. ADVISORY (`scan` observes, `purge!` acts, `vis-agent doctor` renders): the gateway journals, sandbox snapshots of sessions with no row, and temp files of killed writes. `scan` is pure observation (no mutation, never throws) and `purge!` is the explicit operator action behind `vis-agent doctor --purge`. SELF-DELETING (`sweeps`): diagnostic logs, the gateway journals, the display caches and old downloaded Python archives. Those are DERIVED — a log of a process that exited, the wire replay of a turn the DB already owns, a picture whose bytes are already DB-owned — so they carry a window instead of a report. `sweep-targets` is the one list of them. Each sweep has its own interval, and the stamp of a root holds that interval for the whole machine (`claim-sweep!`), so one process walks a root in each interval. No sweep has its own thread: `tasks` gives each sweep to `internal.janitor`, the one maintenance worker of a process, and the worker repeats it while the process runs. `sweep-stale!` runs the same sweeps one time on the calling thread. Journals also self-sweep inside the tailer loop (`gateway.bus/sweep!`) after a single idle day, but that is a LIVENESS rule and it only runs while a daemon does — journals from crashed or never-restarted daemons used to stay forever. Versioned Python runtime and source trees, and the frozen guest trees under `python/vis-guest`, are reclaimed by CLAIM rather than by age. Every process claims the trees it boots from (`internal.paths/claim-dir!`), so an older install still serving another Vis process is kept however old it is, while the tree a killed process left behind is free the moment it dies. The pinned and the newest install are never candidates at all, and a tree from a build before claims existed still waits out the retention window. `runtime-retention-plan` previews that classification without deleting. Compiled bytecode under `python/pycache` is judged by EXISTENCE instead: the prefix mirrors absolute source paths, so an entry whose source is gone is garbage whatever its age, and one whose source is live is a cache the next import wants. `purge!` removes journal files and sandbox snapshots directly, confined to the events or sandbox store.
Test seam for the display cache root. nil (production) resolves to
~/.vis/cache, mirroring foundation.mpl-capture/display-cache-file and the
TUI channel's terminal-image cache.
Test seam for the display cache root. `nil` (production) resolves to `~/.vis/cache`, mirroring `foundation.mpl-capture/display-cache-file` and the TUI channel's terminal-image cache.
Test seam for the gateway journal directory. nil (production) resolves to
~/.vis/gateway/events, mirroring the private gateway.bus/events-dir —
journals are addressed by absolute path from several processes, so that
location is a fixed contract rather than a user-facing configurable.
Test seam for the gateway journal directory. `nil` (production) resolves to `~/.vis/gateway/events`, mirroring the private `gateway.bus/events-dir` — journals are addressed by absolute path from several processes, so that location is a fixed contract rather than a user-facing configurable.
Test seam for the diagnostic log directory. nil (production) resolves to
internal.paths/logs-dir: the vis.logs.dir property, else ~/.vis/logs.
Test seam for the diagnostic log directory. `nil` (production) resolves to `internal.paths/logs-dir`: the `vis.logs.dir` property, else `~/.vis/logs`.
Test seam for the embedded Python state root. nil (production) resolves to
~/.vis/python, mirroring com.blockether.vispython.Locations — the
runtime unpacks each pinned version under runtime/<version>/<platform>
and extracts its shipped sources under sources/<version>.
Test seam for the embedded Python state root. `nil` (production) resolves to `~/.vis/python`, mirroring `com.blockether.vispython.Locations` — the runtime unpacks each pinned version under `runtime/<version>/<platform>` and extracts its shipped sources under `sources/<version>`.
Test seam for the sandbox snapshot directory. nil (production) resolves to
paths/sandbox-defs-dir.
Test seam for the sandbox snapshot directory. `nil` (production) resolves to `paths/sandbox-defs-dir`.
Bytes one display cache may still hold once the age pass is done. Age alone does not bound an afternoon that renders thousands of figures, so the newest files up to this budget survive and the oldest go first.
Bytes one display cache may still hold once the age pass is done. Age alone does not bound an afternoon that renders thousands of figures, so the newest files up to this budget survive and the oldest go first.
Delay between diagnostic-log sweeps while a process stays alive: one hour.
Delay between diagnostic-log sweeps while a process stays alive: one hour.
Age past which any self-deleting derived artifact is deleted automatically — diagnostic logs, gateway journals, the display caches. Two weeks: longer than any plausible debugging window (a bug reported on Friday is still readable the Monday after next), short enough that a machine which never restarts does not carry a quarter of dead sessions. ONE number for every kind on purpose — a per-kind window is a promise nobody audits, and each kind is reconstructible from the DB or from nothing at all.
Age past which any self-deleting derived artifact is deleted automatically — diagnostic logs, gateway journals, the display caches. Two weeks: longer than any plausible debugging window (a bug reported on Friday is still readable the Monday after next), short enough that a machine which never restarts does not carry a quarter of dead sessions. ONE number for every kind on purpose — a per-kind window is a promise nobody audits, and each kind is reconstructible from the DB or from nothing at all.
Age past which unattended state is worth mentioning: two weeks.
Age past which unattended state is worth mentioning: two weeks.
(purge! {:keys [is-dry-run] :as opts})Reclaim everything scan reported. Returns the scan augmented with a
:purged vec (each item stamped :is-purged) and :reclaimed-bytes.
With :is-dry-run true nothing is touched: :purged still carries the plan
with every item stamped :is-purged false, so operators can look first.
Reclaim everything `scan` reported. Returns the scan augmented with a `:purged` vec (each item stamped `:is-purged`) and `:reclaimed-bytes`. With `:is-dry-run` true nothing is touched: `:purged` still carries the plan with every item stamped `:is-purged false`, so operators can look first.
(runtime-retention-plan)(runtime-retention-plan {:keys [runtime-version]})Preview keeping the newest installed release and this binary's pinned runtime.
Returns {:is-dry-run true :runtime-version :targets}, with :latest-version,
:retained and :candidates for each runtime/source store. Candidates are NOT
safe-to-delete findings: this preview tests no claim and changes no file. The
sweep reclaims a candidate only once its in-use claim is free — or, for
a tree from a build before claims existed, only after the retention window.
Numeric three-part releases are ordered numerically, not by mtime or string.
Unknown version names and symlinked directories are retained. :runtime-version
overrides the current binary's pin for fixture experiments. Missing stores
report empty vectors; unreadable stores report :unavailable? true.
Preview keeping the newest installed release and this binary's pinned runtime.
Returns `{:is-dry-run true :runtime-version :targets}`, with `:latest-version`,
`:retained` and `:candidates` for each runtime/source store. Candidates are NOT
safe-to-delete findings: this preview tests no claim and changes no file. The
sweep reclaims a candidate only once its in-use claim is free — or, for
a tree from a build before claims existed, only after the retention window.
Numeric three-part releases are ordered numerically, not by mtime or string.
Unknown version names and symlinked directories are retained. `:runtime-version`
overrides the current binary's pin for fixture experiments. Missing stores
report empty vectors; unreadable stores report `:unavailable? true`.(scan {:keys [db-info days now-ms]})Observe stale gateway journals and sandbox snapshots. Pure: touches no state and never throws — a missing DB or an unreadable subtree degrades to empty findings.
Options: :db-info (nil is fine), :days (defaults to default-stale-days)
and :now-ms for tests.
Observe stale gateway journals and sandbox snapshots. Pure: touches no state and never throws — a missing DB or an unreadable subtree degrades to empty findings. Options: `:db-info` (nil is fine), `:days` (defaults to `default-stale-days`) and `:now-ms` for tests.
(sweep-stale!)(sweep-stale! {:keys [now-ms] :as opts})Run each sweep of sweeps that is due, in order, on the calling thread. Returns
{:targets [row…] :deleted :bytes} — :deleted counts entries actually
removed and :bytes the space reclaimed. A sweep that ran gives its full rows:
for a sweep-targets entry {:id :root :days :cutoff-ms :file-count :deleted :bytes :dirs-removed :over-budget-deleted}. A sweep with no work gives
{:id :deleted 0 :bytes 0}. The claim-based rows are :python-guest,
:python-runtime and :python-sources; :python-pycache answers to the source
a bytecode entry mirrors, not to age.
A missing directory is zero work, and a permission-denied subtree is skipped rather than allowed to stop the pass.
Options, all for tests: :days (overrides every window), :budget-bytes
(overrides every byte budget) and :now-ms.
Run each sweep of `sweeps` that is due, in order, on the calling thread. Returns
`{:targets [row…] :deleted :bytes}` — `:deleted` counts entries actually
removed and `:bytes` the space reclaimed. A sweep that ran gives its full rows:
for a `sweep-targets` entry `{:id :root :days :cutoff-ms :file-count :deleted
:bytes :dirs-removed :over-budget-deleted}`. A sweep with no work gives
`{:id :deleted 0 :bytes 0}`. The claim-based rows are `:python-guest`,
`:python-runtime` and `:python-sources`; `:python-pycache` answers to the source
a bytecode entry mirrors, not to age.
A missing directory is zero work, and a permission-denied subtree is skipped
rather than allowed to stop the pass.
Options, all for tests: `:days` (overrides every window), `:budget-bytes`
(overrides every byte budget) and `:now-ms`.(tasks)The sweeps as tasks for internal.janitor/submit!: one task for each sweep, in
report order.
Each sweep has its own interval, :every-ms in sweeps, and the stamp of its
root holds that interval for the whole machine. A task asks four times in each
interval, and at least each hour, whether its sweep is due. A timer and a file
time never agree to the millisecond, so a task that asked only one time in each
interval would run its sweep in each second interval. A walk that a stopped
process left unfinished starts again at the next question. A task that is not
due answers nil, and the janitor writes no line for it. A task that walked
answers {:deleted :bytes}.
A task keeps the dynamic bindings of the caller, so the home seams of a test reach the worker thread.
The sweeps as tasks for `internal.janitor/submit!`: one task for each sweep, in
report order.
Each sweep has its own interval, `:every-ms` in `sweeps`, and the stamp of its
root holds that interval for the whole machine. A task asks four times in each
interval, and at least each hour, whether its sweep is due. A timer and a file
time never agree to the millisecond, so a task that asked only one time in each
interval would run its sweep in each second interval. A walk that a stopped
process left unfinished starts again at the next question. A task that is not
due answers nil, and the janitor writes no line for it. A task that walked
answers `{:deleted :bytes}`.
A task keeps the dynamic bindings of the caller, so the home seams of a test
reach the worker thread.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |