core.stream_age module

Fail-closed proof-horizon checks for Redis Stream recovery entries.

core.stream_age.stream_proof_deadline_ms(raw, *, stream_id=None)

Read/derive a publisher-bound proof deadline from stream metadata.

Return type:

int | None

Parameters:
async core.stream_age.redis_now_ms(redis)

Return authoritative Redis-server time in milliseconds.

Return type:

int

Parameters:

redis (Any)

core.stream_age.stream_entry_age_seconds(stream_id, *, now_ms)

Return the age encoded in a Redis Stream ID, or None if invalid.

Return type:

float | None

Parameters:
core.stream_age.proof_horizon_elapsed(stream_id, horizon_seconds, *, now_ms)

Whether an entry is old enough that a finite receipt may have expired.

Invalid IDs fail closed. Consumers must never execute an effect when they cannot establish that its transport entry is younger than the proof kept by the corresponding durable ledger.

Return type:

bool

Parameters:
core.stream_age.proof_deadline_elapsed(deadline_ms, *, now_ms)

Fail closed when a bound deadline is missing, invalid, or elapsed.

Return type:

bool

Parameters:
  • deadline_ms (int | None)

  • now_ms (int)