pub struct A1Context {
pub revocation: Arc<dyn RevocationStore>,
pub nonces: Arc<dyn NonceStore>,
pub clock: Arc<dyn Clock + Send + Sync>,
pub policy: Option<PolicySet>,
pub audit: Arc<dyn AuditSink>,
pub namespace: Option<String>,
}Expand description
A wiring context that holds all runtime dependencies required for chain authorization.
A1Context is the recommended entry point for applications that do not
need fine-grained control over each authorization call. Configure once at
startup, share across threads via Arc<A1Context>, and call authorize.
§Example
ⓘ
use a1::context::A1Context;
use a1::{DyoloChain, intent::{Intent, MerkleProof}};
let ctx = A1Context::builder().build();
let action = ctx.authorize(&chain, &agent_pk, &intent_hash, &proof)?;
println!("authorized depth={}", action.receipt().chain_depth);Fields§
§revocation: Arc<dyn RevocationStore>§nonces: Arc<dyn NonceStore>§clock: Arc<dyn Clock + Send + Sync>§policy: Option<PolicySet>§audit: Arc<dyn AuditSink>§namespace: Option<String>Implementations§
Source§impl A1Context
impl A1Context
pub fn builder() -> A1ContextBuilder
Sourcepub fn health_check(&self) -> Result<(), A1Error>
pub fn health_check(&self) -> Result<(), A1Error>
Probe both storage backends. Returns Err if either is unhealthy.
Call this from your process health endpoint so load balancers can drain a replica before its backing store degrades authorization decisions.
Auto Trait Implementations§
impl Freeze for A1Context
impl !RefUnwindSafe for A1Context
impl Send for A1Context
impl Sync for A1Context
impl Unpin for A1Context
impl UnsafeUnpin for A1Context
impl !UnwindSafe for A1Context
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more