Thalweg · API reference ← Main docs

Module validate

Module validate 

Source
Expand description

Response validation and the per-service circuit breaker.

Two containment controls live here:

  • validate_response checks a worker’s response against the declared contract: exactly one column of the expected type, and a row count equal to the input. The byte-size ceiling is enforced upstream as a bounded, streaming check in crate::remote::transport so an oversized response is rejected before it is fully buffered — not here after the fact.
  • CircuitBreaker fails fast when a worker is unhealthy. It trips on the error rate over a rolling window, is held per service (all functions on a sick worker fail fast together), and admits a single probe in the half-open state.

Structs§

CircuitBreaker
Per-service circuit breaker: rolling-window error-rate trip, single-probe half-open. Cheaply cloneable; clones share one state machine.
CircuitBreakerConfig
Circuit-breaker tuning.
CircuitBreakerOpenError
Error returned when a call is rejected because the breaker is open.

Enums§

ValidationError
Validation failures, each a distinct, named error.

Functions§

validate_response
Validate a worker response’s schema and row count against the contract.