pub struct MutationGateway;Expand description
Unified mutation governance gateway.
Stateless: all dependencies are passed per-call via MutationRequest.
This allows any consumer (MCP, autopilot, HTTP server) to use the gateway.
Implementations§
Source§impl MutationGateway
impl MutationGateway
Sourcepub async fn evaluate(
req: &MutationRequest<'_>,
) -> Result<GatewayDecision, StorageError>
pub async fn evaluate( req: &MutationRequest<'_>, ) -> Result<GatewayDecision, StorageError>
Evaluate a mutation request through the full governance pipeline.
Sequence:
- Policy evaluation (block rules, rate limits, approval routing)
- DB-backed idempotency check (5-minute window)
- Pending audit record creation
Returns a GatewayDecision indicating whether the mutation may
proceed, was denied, routed to approval, or is a duplicate.
Sourcepub async fn complete_success(
pool: &DbPool,
ticket: &MutationTicket,
result_summary: &str,
rollback_action: Option<&str>,
elapsed_ms: u64,
rate_limit_configs: &[PolicyRateLimit],
) -> Result<(), StorageError>
pub async fn complete_success( pool: &DbPool, ticket: &MutationTicket, result_summary: &str, rollback_action: Option<&str>, elapsed_ms: u64, rate_limit_configs: &[PolicyRateLimit], ) -> Result<(), StorageError>
Record a successful mutation: complete audit + increment rate counters.
Sourcepub async fn complete_failure(
pool: &DbPool,
ticket: &MutationTicket,
error_message: &str,
elapsed_ms: u64,
) -> Result<(), StorageError>
pub async fn complete_failure( pool: &DbPool, ticket: &MutationTicket, error_message: &str, elapsed_ms: u64, ) -> Result<(), StorageError>
Record a failed mutation in the audit trail.
Auto Trait Implementations§
impl Freeze for MutationGateway
impl RefUnwindSafe for MutationGateway
impl Send for MutationGateway
impl Sync for MutationGateway
impl Unpin for MutationGateway
impl UnsafeUnpin for MutationGateway
impl UnwindSafe for MutationGateway
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more