Skip to main content

Module path_cache

Module path_cache 

Source
Expand description

Process-wide cache of BC5D tables loaded from explicit filesystem paths.

The bridge/solve-json surfaces accept a caller-supplied table PATH (mobile apps download the .bin themselves and hand the engine a file path), and a parsed table is several MB — re-reading and re-CRC-ing it on every card or solve call would dominate the request. Entries are keyed by (canonical path, file size, mtime) so replacing a downloaded table under the same name is picked up on the next call, and the cache is bounded (oldest entry evicted at capacity).

Filesystem-only by construction, so the whole module is compiled out on wasm32 (where WASM callers pass table BYTES via loadBc5dTable instead).

Functions§

load_verified
Load a BC5D table from path, verifying the header (magic, version, dimensions) and the stored CRC32 exactly as Bc5dTable::load does, with the parsed result cached process-wide.
load_verified_for_caliber
load_verified plus the caliber-identity guard: the loaded table must be for the caliber of the shot that is about to use it, per Bc5dTable::ensure_caliber_matches (shot_caliber_in in INCHES).