Documentation
¶
Overview ¶
Package watch schedules continuous verification without choosing a verification engine. Callers supply observation, analysis, and rendering functions.
Index ¶
Constants ¶
const ( Changed = "changed" Checking = "checking" Completed = "completed" Attributed = "attributed" Error = "error" Heartbeat = "heartbeat" )
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run uses one analysis worker and coalesces changes until the debounce period expires. Analyze must honor cancellation and release its temporary resources before returning. Run waits for that cleanup on shutdown and returns ctx.Err(). Observation and emission also must return promptly or honor cancellation.
Types ¶
type Event ¶
type Event struct {
Type string `json:"type"`
Sequence uint64 `json:"sequence"`
Time time.Time `json:"time"`
State State `json:"state"`
Result *Result `json:"result,omitempty"`
Error string `json:"error,omitempty"`
}
Event is delivered synchronously, in sequence order. A completed event always refers to inputs reobserved after analysis; a changed event invalidates the previous result immediately. Heartbeats deliberately contain no old result.
type Result ¶
type Result struct {
Value any `json:"value,omitempty"`
// Followup performs slower observations after the initial result is emitted.
// It uses the same bounded worker slot and cancellation scope as Analyze.
Followup func(context.Context) (Result, error) `json:"-"`
// Close releases retained resources after followup or when superseded.
Close func() `json:"-"`
}