Skip to content

salvus.flow.acta.memo.protocol

salvus.flow.acta.memo.protocol salvus flow acta memo protocol

Cache lookup, output verification, and result commit.

Functions

all_refs_resolve()

def all_refs_resolve(
    output_refs: Mapping[str, Any], store: ContentStoreBase
) -> bool: ...

Check output descriptors and their payloads exist in store.

Parameters
  • output_refs Mapping[str, Any] — Mapping from output name to a single digest or a list of digests.
  • store ContentStoreBase — The content store to check presence against.
Returns bool

commit()

def commit(
    records: RecordStore,
    key: str,
    task: str,
    envelope: dict[str, Any],
    arg_values: dict[str, Any],
    output_refs: dict[str, Any],
    timings: dict[str, float],
    package_names: tuple[str, ...] = ("salvus",),
    provenance: dict[str, Any] | None = None,
    fingerprint_parts: Mapping[str, str] | None = None,
    retention: Retention = Retention.STANDARD,
    run_id: str | None = None,
    input_snapshot: dict[str, Any] | None = None,
    from_binding: bool = False,
) -> Manifest: ...

Write a manifest for a fresh computation and commit its record.

Parameters
  • records RecordStore — The record store to write into.
  • key str — The envelope key this execution was computed for.
  • task str — Task name.
  • envelope dict[str, Any] — The full envelope mapping (see salvus.flow.acta.memo.envelope.build_envelope).
  • arg_values dict[str, Any] — The call’s raw argument values, after normalizing and eliding. Stored so explain can name a changed argument; never hashed.
  • output_refs dict[str, Any] — Mapping from output name to digest(s); every digest must already be present in the content store before this is called.
  • timings dict[str, float] — Mapping from stage name to elapsed seconds.
  • package_names tuple[str, ...] = ('salvus',) — Packages whose installed versions to record; missing packages are omitted.
  • provenance dict[str, Any] | None = None — Execution metadata, such as worker hostname and backend. The manifest’s own hostname identifies the calling process.
  • fingerprint_parts Mapping[str, str] | None = None — The per-node digests behind the task’s fingerprint, so explain can name a changed reference. Omit for a task that pins impl.
  • retention Retention = Retention.STANDARD — Retention class to store on the record.
  • run_id str | None = None — The run this execution belonged to, or None.
  • input_snapshot dict[str, Any] | None = None — Full dispatch inputs, or None if unavailable.
  • from_binding bool = False — Whether to adopt a published result. Local invalidation markers block adoption.
Returns Manifest — The newly-written manifest.

lookup()

def lookup(
    records: RecordStore, store: ContentStoreBase, key: str
) -> Hit | Miss: ...

Look up key, verifying its payloads before reporting a hit.

Delete records with missing outputs and report a miss. On a hit, update last_used_at if it is older than TOUCH_COALESCE_AFTER.

Parameters
  • records RecordStore — The record store to query.
  • store ContentStoreBase — The content store whose payloads back the record.
  • key str — The envelope key to look up.
Returns Hit | Miss — Hit if the record exists and every output ref resolves; Miss otherwise.

Classes

Hit

class Hit(builtins.object):
    def __init__(
        self, output_refs: dict[str, Any], manifest: Manifest
    ) -> None: ...

A verified cache hit: record and payloads both present.

Parameters
  • output_refs dict[str, Any] — Mapping from output name to digest(s), as stored in the record.
  • manifest Manifest — The manifest that produced this record.

Miss

class Miss(builtins.object):
    def __init__(self) -> None: ...

No usable record: either none exists, or its refs were dangling.