jellycell.cache.index¶
SQLite catalogue accelerator for the cache.
The filesystem is the source of truth; this index is a derived accelerator
for the catalogue page (spec §2.3). :meth:CacheIndex.rebuild_from_store
re-scans all manifests to repair corruption.
Module Contents¶
Classes¶
SQLite accelerator over the manifest directory. |
API¶
- class jellycell.cache.index.CacheIndex(db_path: pathlib.Path)¶
SQLite accelerator over the manifest directory.
Initialization
- insert(manifest: jellycell.cache.manifest.Manifest, manifest_path: pathlib.Path) None¶
Upsert a manifest into the index.
- list_by_notebook(notebook: str) list[dict[str, Any]]¶
Return all cell entries for a given notebook path (relative).
- notebook_view_key(project_root: pathlib.Path, notebook_rel: str) str | None¶
Hash of everything that affects the rendered view of a notebook.
The live viewer uses this as its response-cache key. Captures both source edits (the notebook file’s bytes) and manifest changes (the ordered set of cell cache keys), so either kind of change invalidates the cached HTML cleanly.
Returns a hex sha256 string, or
Nonewhen the notebook file is missing — the caller should skip caching in that case and let the 404 path render naturally.
- find_producer(artifact_path: str) dict[str, Any] | None¶
Look up which cell produced an artifact at
artifact_path.Returns a dict with
cache_key,notebook,cell_id,cell_namefor the most recent producer, orNoneif no manifest references this path.Used by :func:
jellycell.api.loadto register implicit dep edges, and by the UI to display “which cell produced this file?”.
- rebuild_from_store(store: jellycell.cache.store.CacheStore) int¶
Re-scan all manifests from
store. Returns the count indexed.