Expand description
CACHE: root, session, ids, cursor, URL index, global jobs, page snapshots.
<root>/index.json url → {dir, t} (shared, flock)
<root>/jobs.json [{session, cmd, t}] j<N> = N-th row, global monotonic (flock)
<root>/account.json last `fats account` read: {t, rows: [Account]} (parsed numbers, no answers)
<root>/swept its mtime = the last sweep of every session (`sweep`)
<root>/pace/<host> the home-IP brake: the last plain start to that host (`provider::pace`)
<root>/telemetry/ `ping/` day and week stamps · `days/` day marks · `week/` the weekly tally
(`bump`) · `latest.json` · `sent.jsonl` (`telemetry::at`); not in `usage`
<root>/<session>/state.json {u: [{url, dir, alias?, job, serp?}], cursor}
<root>/<session>/u<N>/ raw.html · meta.json · doc.json (rebuilt from raw.html when stale)
· error.txt (0600): the providers' error answers, masked, never printed
<root>/<session>/u<N>/assets/ m<K>.<ext> + m<K>.json: picture K of the page, fetched on demand (`Asset`)
<root>/<session>/j<N>/ meta.json of web search j<N> (hits inside) · error.txt; its results are `serp`
entries with no dir until a command fetches them into the same id
<root>/<session>/run/u<N>.* a fetch that outlives its call (`Detached`): .json the run, .lock held by
its process, .log that process's stdout + stderr
<root>/<session>/run/setup-<p>.* the key form for provider p (`setup::run_file`): .json token, port, deadline;
.log its outputStructs§
- Asset
- Picture K of a page, fetched on demand (
cli::asset):<page>/assets/m<K>.<ext>(extfrom its content type), then this record asm<K>.json(written last: no record = not stored).w,h= the size read from the bytes (0 = unread). - Cache
stis a snapshot; every change goes throughalloc/save, which re-read state.json under the session lock, so parallel agents in one session never overwrite each other’s ids.- Cursor
- Detached
- A fetch that outlives its call (past
wait:),run/u<N>.json: written by the call that reservedu<N>, then by the process that runs it (fats --continue j<J>.u<N>): its pid once it holdsu<N>.lock,statusas tiers start and land,doneat the end. The lock is held for that process’s life: nodone+ a free lock = it died. Any other writer writes under that lock, read again there (run_tell). - Done
- How a detached fetch ended: what the call that waits for it adds to the stored page’s outline.
- Entry
- HopRow
- One provider call in a fetch’s or search’s
hops, as meta.json keeps it:fetch::Hop::rowwrites it, every view reads its fields.provideris the stored name (brightdata,oxylabs-js); only the fields a view surfaces are kept: provider, code, cost, ms, why (tried/health/fail_detail), and the request budgetlimit/remaining(limits, kept as the two numbers Oxylabs sends). - Job
- Meta
- Snap
- What
Cache::ingeststores. - State
- Week
- The weekly tally the usage summary is built from (
stats::weekly): counts, codes and fixed names only, one file a week (<cache>/telemetry/week/2026-W43.json, this week’s and last week’s kept). Sessions are swept within the hour, so it counts as things happen: a stored fetch or search (tally), a command (stats::tally_run), a panic (stats::crash).n= each counter by its path in the summary (tier\toxyjs\tok),samples= the lastweek_samplesof eachtok\tpage(a stored page’s clean tokens),tok\tread(a read’s answer),ms\tplain,ms\tpaid(a page call that served).
Enums§
- NoDoc
- Why a snapshot has no doc.
Constants§
- ERROR_
FILE - A failed run’s provider answers (
fetch::error_text):statspoints at the file, nothing prints it. - MINE
- fats made this root (
private_rootwrites it): the sweep deletes only under a root holding it. - SPEND_
FILE - THE spend ledger, in the key dir (never swept, so
statsstill sums what was spent once the pages are gone): one JSON line[unix s, [cost, unverified], "<dir>"]per stored fetch or search record that cost or may have, and per dead run’s calls in flight once itsrun/is swept;dir= the record’s path (<root>/default/u3). No URL, no query. A row it cannot write is never a failed fetch:statsprobes the file and says why. - WEEK_S
Functions§
- assets
- The pictures stored under page dir
dir(Asset). - build
- Body → Doc by its kind (
clean::kind_of, kept in meta.json): a PDF, a server’s Markdown, a text document, else a page;og= a JS shell served as its own og card (fetch::og_card), made again from the same body. - bump
- Add to this week’s tally (
<root>/telemetry/week/), at levelfullonly (a count made under an opt-out would go once it is lifted), under its lock aslocktakes it (edit_when); a week’s first write drops every older file but last week’s. A count fats cannot write is lost, never a failed command. - code_of
- A code as counted: one errors.json names (
js_shell; a*row’s prefix + digits:http_404), elseother. - edit
- Read-modify-write a shared root file under an exclusive lock.
- guarded
- A converter panic is an error, never a crash.
- jload
- jsave
- Atomic write: tmp + rename.
- now
- private_
root - The cache root is its owner’s only (0700 on unix): jobs.json keeps every command (queries too), account.json
balances. A missing root is created so, with
MINEin it, and so is the default root (fats’s own name in the OS cache dir, made by builds before the sweep); oneFATS_CACHEnames is left as it is (fatsshows its mode,configwhether it is swept). An error here is reported by the first write (cache_write). - raw_
name - The stored body’s file name for a kind:
raw.html(also an og card’s),raw.pdf,raw.zip,raw.txt,raw.json,raw.xml. - run_at
- The detached run in file
json(Cache::run_file) and whether it lives, THE liveness rule (a pending id, status, a batch pool’s floor): its lock is held. The launcher takes it before the run file exists and hands it to the run’s process (Cache::run_claim), so a run not scheduled yet lives too (a 2 s pid-0 window read! abandonedunder load). The lock is probed BEFORE the file is read: a process that wrotedoneand let go reads as ended with it. A queued run lives while its lane’s process does (the lock of the run it is queued behind,by). - sweep
- THE sweep, run after the answer is out (
main,mcp):expireddirs of this session every run, of every session at most once persweep_every_s(thesweptfile’s mtime), only under a root fats made (MINE), onlyoursdirs of a session dir (a real dir holding a state.json; a symlink is never followed). A session dir and its state.json stay (ids never restart, sou1never names another page); the full sweep also forgets what the hour is over for: an index row with its page, a job’s command oncecache_ttl_sold, and a history row’s URL (a search’s results too) once its page is gone and its job forgotten: its id reads! expired. - tally
- Count a stored fetch or search record (
cache::ingest,cache::serp_put): its calls per tier (a call cut after the other provider won is neither ok nor failed) and paid provider, each failed call’s code and the record’s own when no call ended with it (no_key), the serving page call’s ms, the page’s clean tokens (tok), a PDF. No URL, no query: every name comes from our tables. - url_key
- usage
- Bytes under the root, the pictures among them (
assets/), every live snapshot’s meta.json path (expired: the sweep’s rule, so a dead copy counts in no health row), all sessions (status: size, pages, provider health). Telemetry’stelemetry/(its stamps, day marks and the weekly tallyWeek) is no cached page: a command’s own count never changes the next’s status. Under a root fats did not make (MINE:/, a home) only what fats wrote there is walked: theoursdirs of each session dir (one holding a state.json), as the sweep finds them. - week_of
2026-W43: the ISO week of unix timet.