Skip to main content

resolve_store_path

Function resolve_store_path 

Source
pub fn resolve_store_path(api_version: &str) -> Result<PathBuf>
Expand description

Resolves the active api_version (from the config cascade) to its store file. Every .db this crate supports is embedded into the compiled binary via include_bytes! (VERSION_STORE_BYTES) exactly like validator.rs embeds each version’s schema — there is no filesystem fallback chain to reason about, and this crate never depends on any particular .db file existing anywhere on disk after cargo install. The one difference from a schema lookup: SQLite needs a real file to open a Connection against (unlike a &[u8] JSON schema, read directly from memory), so this extracts the embedded bytes to a fixed path in the OS temp dir the first time a given api_version is requested in this process, then reuses that same path on every later call (see EXTRACTED below) — a rebuilt binary with different embedded bytes (a populate_embeddings re-run, an add-version update) still can never be shadowed by a stale leftover from a previous install, since a fresh process always extracts fresh.