Skip to main content

Module context_watch

Module context_watch 

Source
Expand description

The context watch: a watcher over the context-watch subject that reports each context reading to Lys, which decides what a crossed budget does (ACCESS-003 R1).

A runner publishes its session’s context reading on context-watch (a hot publish decided from its pass like any other); a granted call on the service carries a reading the same way. Each reading is reported to Lys’s POST /agents/{agent}/usage as its context_percent, under a stable event id (the message’s own id, or the call’s operation id), so a reading reported again charges nothing. Lys keeps each crossing and asks the session’s runner to compact, give notice or stop; liminal decides none of it and keeps no threshold.

The watcher is told, never polls: the subscription’s inbox notifier wakes one watcher thread, which drains every ready reading and sleeps on its channel again. Stopping the watch (or dropping it) ends the thread.

Structs§

ContextReading
One context reading, as a runner publishes it.
ContextReporter
Reports context readings to Lys over LysHttp.
ContextWake
The wake the watched subscription’s inbox fires on every admitted envelope, and the receiving end the watcher sleeps on.
ContextWatch
The running watcher; stopping or dropping it ends the thread.
Drained
What a drain came to.

Traits§

ContextFeed
The ready readings on the watched subject, each with its message id.

Functions§

drain
Drains every ready reading from feed into reporter.