Skip to main content

InMemoryBudgetStore

Struct InMemoryBudgetStore 

Source
pub struct InMemoryBudgetStore { /* private fields */ }

Implementations§

Trait Implementations§

§

impl BudgetStore for InMemoryBudgetStore

§

fn try_increment( &self, capability_id: &str, grant_index: usize, max_invocations: Option<u32>, ) -> Result<bool, BudgetStoreError>

§

fn capture_invocation_reservations( &self, request: BudgetCaptureInvocationRequest, ) -> Result<BudgetInvocationCaptureDecision, BudgetStoreError>

§

fn authorize_cumulative_approval( &self, request: BudgetAuthorizeCumulativeApprovalRequest, ) -> Result<BudgetCumulativeApprovalAuthorizationDecision, BudgetStoreError>

§

fn cancel_captured_before_dispatch( &self, request: BudgetCancelCapturedBeforeDispatchRequest, ) -> Result<BudgetCapturedBeforeDispatchCancellationDecision, BudgetStoreError>

§

fn try_charge_cost( &self, capability_id: &str, grant_index: usize, max_invocations: Option<u32>, cost_units: u64, max_cost_per_invocation: Option<u64>, max_total_cost_units: Option<u64>, ) -> Result<bool, BudgetStoreError>

Atomically check monetary budget limits and record provisional exposure if within bounds. Read more
§

fn try_charge_cost_with_ids( &self, capability_id: &str, grant_index: usize, max_invocations: Option<u32>, cost_units: u64, max_cost_per_invocation: Option<u64>, max_total_cost_units: Option<u64>, hold_id: Option<&str>, event_id: Option<&str>, ) -> Result<bool, BudgetStoreError>

§

fn try_charge_cost_with_ids_and_authority( &self, capability_id: &str, grant_index: usize, max_invocations: Option<u32>, cost_units: u64, max_cost_per_invocation: Option<u64>, max_total_cost_units: Option<u64>, hold_id: Option<&str>, event_id: Option<&str>, authority: Option<&BudgetEventAuthority>, ) -> Result<bool, BudgetStoreError>

Apply a charge under the caller’s durable hold/event identity and authority fence. Implementations must preserve all three values or return an explicit unsupported error. This method is required so a backend upgrade cannot compile successfully and fail only on live calls.
§

fn reverse_charge_cost( &self, capability_id: &str, grant_index: usize, cost_units: u64, ) -> Result<(), BudgetStoreError>

Reverse a previously applied provisional exposure for a pre-execution denial path.
§

fn reverse_charge_cost_with_ids( &self, capability_id: &str, grant_index: usize, cost_units: u64, hold_id: Option<&str>, event_id: Option<&str>, ) -> Result<(), BudgetStoreError>

§

fn reverse_charge_cost_with_ids_and_authority( &self, capability_id: &str, grant_index: usize, cost_units: u64, hold_id: Option<&str>, event_id: Option<&str>, authority: Option<&BudgetEventAuthority>, ) -> Result<(), BudgetStoreError>

Reverse a charge under the exact durable identity and authority fence.
§

fn reduce_charge_cost( &self, capability_id: &str, grant_index: usize, cost_units: u64, ) -> Result<(), BudgetStoreError>

Release a previously exposed monetary amount without changing invocation count. Read more
§

fn reduce_charge_cost_with_ids( &self, capability_id: &str, grant_index: usize, cost_units: u64, hold_id: Option<&str>, event_id: Option<&str>, ) -> Result<(), BudgetStoreError>

§

fn reduce_charge_cost_with_ids_and_authority( &self, capability_id: &str, grant_index: usize, cost_units: u64, hold_id: Option<&str>, event_id: Option<&str>, authority: Option<&BudgetEventAuthority>, ) -> Result<(), BudgetStoreError>

Release exposure under the exact durable identity and authority fence.
§

fn settle_charge_cost( &self, capability_id: &str, grant_index: usize, exposed_cost_units: u64, realized_cost_units: u64, ) -> Result<(), BudgetStoreError>

Atomically release provisional exposure and record realized spend. Read more
§

fn settle_charge_cost_with_ids( &self, capability_id: &str, grant_index: usize, exposed_cost_units: u64, realized_cost_units: u64, hold_id: Option<&str>, event_id: Option<&str>, ) -> Result<(), BudgetStoreError>

§

fn settle_charge_cost_with_ids_and_authority( &self, capability_id: &str, grant_index: usize, exposed_cost_units: u64, realized_cost_units: u64, hold_id: Option<&str>, event_id: Option<&str>, authority: Option<&BudgetEventAuthority>, ) -> Result<(), BudgetStoreError>

Reconcile exposure and spend under the exact durable identity and authority fence.
§

fn list_usages( &self, limit: usize, capability_id: Option<&str>, ) -> Result<Vec<BudgetUsageRecord>, BudgetStoreError>

§

fn get_usage( &self, capability_id: &str, grant_index: usize, ) -> Result<Option<BudgetUsageRecord>, BudgetStoreError>

§

fn get_invocation_quota_usage( &self, key: &BudgetQuotaKey, ) -> Result<Option<BudgetInvocationQuotaUsage>, BudgetStoreError>

§

fn get_cumulative_approval_account_usage( &self, key: &BudgetCumulativeApprovalAccountKey, ) -> Result<Option<BudgetCumulativeApprovalAccountUsage>, BudgetStoreError>

§

fn get_cumulative_approval_operation_usage( &self, operation_id: &str, ) -> Result<Option<BudgetCumulativeApprovalUsage>, BudgetStoreError>

§

fn list_mutation_events( &self, limit: usize, capability_id: Option<&str>, grant_index: Option<usize>, ) -> Result<Vec<BudgetMutationRecord>, BudgetStoreError>

§

fn authorize_budget_hold( &self, request: BudgetAuthorizeHoldRequest, ) -> Result<BudgetAuthorizeHoldDecision, BudgetStoreError>

§

fn reverse_budget_hold( &self, request: BudgetReverseHoldRequest, ) -> Result<BudgetReverseHoldDecision, BudgetStoreError>

§

fn release_budget_hold( &self, request: BudgetReleaseHoldRequest, ) -> Result<BudgetReleaseHoldDecision, BudgetStoreError>

§

fn reconcile_budget_hold( &self, request: BudgetReconcileHoldRequest, ) -> Result<BudgetReconcileHoldDecision, BudgetStoreError>

§

fn capture_budget_hold( &self, request: BudgetCaptureHoldRequest, ) -> Result<BudgetCaptureHoldDecision, BudgetStoreError>

§

fn reap_orphaned_holds( &self, realized_by_hold: &HashMap<String, u64>, ) -> Result<(usize, usize), BudgetStoreError>

§

fn count_open_holds(&self) -> Result<usize, BudgetStoreError>

§

fn list_open_delegated_reserved_hold_ids( &self, ) -> Result<Option<Vec<String>>, BudgetStoreError>

§

fn request_id_has_reserved_hold( &self, request_id: &str, ) -> Result<Option<bool>, BudgetStoreError>

§

fn get_budget_hold( &self, hold_id: &str, ) -> Result<Option<BudgetHoldSnapshot>, BudgetStoreError>

§

fn mark_hold_reserved( &self, hold_id: &str, reserved_until_unix_secs: i64, currency: &str, payment_reference: Option<&str>, envelope: &ReservedHoldEnvelope, ) -> Result<(), BudgetStoreError>

§

fn reserve_invocation_hold( &self, hold_id: &str, capability_id: &str, grant_index: usize, reserved_until_unix_secs: i64, envelope: &ReservedHoldEnvelope, ) -> Result<(), BudgetStoreError>

§

fn reap_expired_reserved_holds( &self, now_unix_secs: i64, ) -> Result<usize, BudgetStoreError>

Source§

fn budget_guarantee_level(&self) -> BudgetGuaranteeLevel

Source§

fn budget_authority_profile(&self) -> BudgetAuthorityProfile

Source§

fn budget_metering_profile(&self) -> BudgetMeteringProfile

Source§

impl Default for InMemoryBudgetStore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more