| Crates.io | duende-policy |
| lib.rs | duende-policy |
| version | 0.2.0 |
| created_at | 2026-01-06 14:09:30.702122+00 |
| updated_at | 2026-01-13 12:17:11.396598+00 |
| description | Policy enforcement for Duende (quality gates, circuit breakers, resource limits) |
| homepage | |
| repository | https://github.com/paiml/duende |
| max_upload_size | |
| id | 2025930 |
| size | 118,109 |
Policy enforcement for the Duende daemon framework.
This crate provides policy enforcement mechanisms:
use duende_policy::{CircuitBreaker, CircuitState};
use std::time::Duration;
let mut breaker = CircuitBreaker::new(5, Duration::from_secs(30));
if breaker.allow() {
match do_work().await {
Ok(_) => breaker.record_success(),
Err(_) => breaker.record_failure(),
}
}
use duende_policy::{JidokaGate, JidokaCheck};
let gate = JidokaGate::new(vec![
JidokaCheck::coverage(95.0),
JidokaCheck::mutation_score(80.0),
JidokaCheck::zero_satd(),
]);
match gate.check(&daemon) {
JidokaResult::Pass => println!("Quality gate passed"),
JidokaResult::Stop { violations, .. } => {
eprintln!("Quality gate failed: {:?}", violations);
}
}
MIT OR Apache-2.0