ov.capture.stores#
The capture store – a MutableMapping Mall over a run directory (§3.4).
A single root holds many runs. Artifacts are content-addressed (keyed by a
hash of their bytes) so identical assets dedupe across runs – which is exactly
what makes own-target diffing cheap. dol provides the filesystem-backed
mappings; this module is a thin facade that adds the ov semantics (typed
runs, artifact put/get, report + analysis storage) on top.
Layout under root:
runs/<run_id>.json # CaptureRun, JSON
artifacts/<hash>.<ext> # content-addressed bytes (shared across runs)
reports/<run_id>/<name> # rendered Markdown
analyses/<analysis_id>.json # analysis JSON
The Mall exposes four MutableMapping attributes (runs, artifacts,
reports, analyses) for callers who want raw access, plus convenience
methods that speak the SSOT models.
Functions
|
Coerce |
Classes
|
A store of stores for one or many capture runs (XDG-aligned root by default). |
- class ov.capture.stores.CaptureStore(root=None)[source]#
Bases:
objectA store of stores for one or many capture runs (XDG-aligned root by default).
>>> import tempfile >>> store = CaptureStore(tempfile.mkdtemp()) >>> art = store.put_artifact(b"<html>hi</html>", kind="dom") >>> store.artifact_bytes(art) == b"<html>hi</html>" True >>> from ov.base import CaptureRun >>> run = CaptureRun(target_url="http://x", artifacts=[art]) >>> store.save_run(run) >>> store.load_run(run.run_id).target_url 'http://x'
- artifact_bytes(artifact_or_uri)[source]#
Return the raw bytes for an
Artifact(or a rawuristring).- Return type:
- put_artifact(data, *, kind, step_id=None, content_type=None, meta=None)[source]#
Store
datacontent-addressed and return itsArtifactrecord.Identical bytes produce the same
uri, so re-storing is a no-op write and cross-run assets dedupe automatically.- Return type:
- report_names(run_id)[source]#
List report keys belonging to
run_id(separator-normalized).dolreturns directory-listing keys with the OS separator, which is a backslash on Windows; we always speak the logical/separator (and store/read with it), so normalize before the prefix match.