Skip to main content

Crate sail_cache

Crate sail_cache 

Source
Expand description

Tiered result cache. Status: the local disk tier (ADR 0011), the in-memory tier (memory), disk maintenance (maint: summaries, integrity checks, eviction and clearing) and the shared tier of signed entries (shared, ADR 0017).

An entry maps a v2 query key (ADR 0008) to the exact reply bytes the pinned solver produced for that command. Each entry is one file, <root>/v2/<k0k1>/<key>, holding a JSON header line followed by the reply bytes. Writes are atomic: a temporary file, then a rename. A read checks that the stored key matches and that the reply hash matches. Any problem is a miss: the entry is removed and the caller falls back to the solver.

Modules§

maint
Disk-tier maintenance: listing, summaries, integrity checks, eviction and clearing (ADR 0015).
memory
The in-memory tier: a bounded, least-recently-used map from keys to replies, in front of the disk tier (ADR 0015).
pack
Reply packs: the signed replies a release ships for its pinned vstd (ADR 0062).
shared
The shared tier (charter rule 9, ADR 0017).

Structs§

DiskCache
The local disk tier.
Effort
Solver effort for a check-sat reply (ADR 0009).
FileStamp
The identity of one entry file on disk: device, inode, length and modification time.
Meta
Metadata stored with each reply.
StoreContext
Provenance and namespace for an explicitly scoped cache store.
Stored
A valid entry read from disk.

Enums§

Problem
Why an entry file is not a valid entry.
PutOutcome
What DiskCache::put_stamped did.

Constants§

ENTRY_VERSION
Format version of entry files.
STALE_TEMP
How old a temporary file must be before maintenance treats it as left over from an interrupted write and removes it. Younger ones may belong to a write in progress.
TOUCH_INTERVAL
How long an entry’s access time may lag behind its last use. Reads touch an entry’s access time at most this often, so gc can evict the least recently used entries without a write on every hit.

Functions§

parse_entry
Parses and checks entry file contents against the key named key (hex). The header must parse, name key, carry this format version and hash the reply correctly.
shape_ok
Whether reply has the shape the solver gives for a command named command (the name stored in the header). This is the coarse, name-only form of the shim’s shape check (ADR 0011): the header keeps the command’s name, not its text, so for example an echo reply is only checked to end a line. Every reply must be exactly one complete response frame: two concatenated forms would add a reply to a session’s stream.