core.trace module
Trace IDs, atomic creation, and bounded orphan reclamation.
- class core.trace.TraceWatchdog(redis=None, *, anchor_stream='sg:stream:inbound', source_group='sg:workers', sweep_interval=300.0, orphan_threshold=1800.0, batch_size=128)
Bases:
objectReclaim due traces with a bounded ZSET scan and revision CAS.
- Parameters:
- SWEEP_INTERVAL = 300.0
- ORPHAN_THRESHOLD = 1800.0
- DEFAULT_BATCH_SIZE = 128
- async sweep(redis=None)
Process at most
batch_sizetraces due according to Redis TIME.- Return type:
- Parameters:
redis (_WatchdogRedis | None)
- async run(redis=None)
Run sweeps until stopped; suitable for a supervised background task.
- Return type:
- Parameters:
redis (_WatchdogRedis | None)
- start(redis=None)
Start the watchdog task once and return the supervised task handle.
- class core.trace.WatchdogSweep(scanned=0, abandoned=0, ambiguous=0, cleaned=0, deferred=0, conflicted=0)
Bases:
object- Parameters:
- async core.trace.create_trace(redis, trace_id, initial_state, metadata)
Create a lifecycle trace through the canonical atomic kernel.
- Return type:
- Parameters: