Skip to main content

trace_cache_source

Function trace_cache_source 

Source
pub fn trace_cache_source(
    db_path: impl AsRef<Path>,
    tenant: &str,
    trace_id: &str,
) -> Result<Option<Option<Uuid>>, StoreError>
Expand description

The route index recorded on trace_id, scoped to tenant.

Ok(None) means the trace is not visible to this tenant (or does not exist) — the same ownership check trace_exists makes, so this cannot be used to probe another tenant’s traces. Ok(Some(None)) means the trace exists but predates route recording.

§Errors

On a store read failure. The decision a trace’s answer was originally proven by, if it was itself a cache replay.

A cache hit is recorded under a NEW trace id, with cache_source naming the decision whose gate passed. So feedback arriving on a replay must be applied to that source, not to the replay’s own id — otherwise a Fail reported against a replayed answer retracts nothing and the disproven entry keeps serving until TTL.

Returns Ok(None) for an unknown trace, Ok(Some(None)) for one that ran the ladder itself.

§Errors

StoreError when the database cannot be opened or queried.