pub struct SqliteBudgetStore { /* private fields */ }Implementations§
Source§impl SqliteBudgetStore
impl SqliteBudgetStore
pub fn open(path: impl AsRef<Path>) -> Result<Self, BudgetStoreError>
pub fn upsert_usage( &mut self, record: &BudgetUsageRecord, ) -> Result<(), BudgetStoreError>
pub fn import_snapshot_records( &mut self, usages: &[BudgetUsageRecord], events: &[BudgetMutationRecord], ) -> Result<(), BudgetStoreError>
pub fn delete_mutation_event( &mut self, event_id: &str, ) -> Result<(), BudgetStoreError>
pub fn delete_hold(&mut self, hold_id: &str) -> Result<(), BudgetStoreError>
pub fn import_mutation_record( &mut self, record: &BudgetMutationRecord, ) -> Result<(), BudgetStoreError>
pub fn list_usages_after( &self, limit: usize, after_seq: Option<u64>, ) -> Result<Vec<BudgetUsageRecord>, BudgetStoreError>
pub fn list_all_usages( &self, ) -> Result<Vec<BudgetUsageRecord>, BudgetStoreError>
pub fn list_mutation_events_after_seq( &self, limit: usize, after_event_seq: u64, ) -> Result<Vec<BudgetMutationRecord>, BudgetStoreError>
pub fn try_increment_with_event_id( &mut self, capability_id: &str, grant_index: usize, max_invocations: Option<u32>, event_id: Option<&str>, ) -> Result<bool, BudgetStoreError>
Trait Implementations§
Source§impl BudgetStore for SqliteBudgetStore
impl BudgetStore for SqliteBudgetStore
fn try_increment( &mut self, capability_id: &str, grant_index: usize, max_invocations: Option<u32>, ) -> Result<bool, BudgetStoreError>
Source§fn try_charge_cost(
&mut 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>
fn try_charge_cost( &mut 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( &mut 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>
Source§fn reverse_charge_cost(
&mut self,
capability_id: &str,
grant_index: usize,
cost_units: u64,
) -> Result<(), BudgetStoreError>
fn reverse_charge_cost( &mut 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( &mut self, capability_id: &str, grant_index: usize, cost_units: u64, hold_id: Option<&str>, event_id: Option<&str>, ) -> Result<(), BudgetStoreError>
Source§fn reduce_charge_cost(
&mut self,
capability_id: &str,
grant_index: usize,
cost_units: u64,
) -> Result<(), BudgetStoreError>
fn reduce_charge_cost( &mut 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( &mut self, capability_id: &str, grant_index: usize, cost_units: u64, hold_id: Option<&str>, event_id: Option<&str>, ) -> Result<(), BudgetStoreError>
Source§fn settle_charge_cost(
&mut self,
capability_id: &str,
grant_index: usize,
exposed_cost_units: u64,
realized_cost_units: u64,
) -> Result<(), BudgetStoreError>
fn settle_charge_cost( &mut 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( &mut 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 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 list_mutation_events( &self, limit: usize, capability_id: Option<&str>, grant_index: Option<usize>, ) -> Result<Vec<BudgetMutationRecord>, BudgetStoreError>
fn budget_guarantee_level(&self) -> BudgetGuaranteeLevel
fn budget_metering_profile(&self) -> BudgetMeteringProfile
fn reverse_budget_hold( &mut self, request: BudgetReverseHoldRequest, ) -> Result<BudgetHoldMutationDecision, BudgetStoreError>
fn release_budget_hold( &mut self, request: BudgetReleaseHoldRequest, ) -> Result<BudgetHoldMutationDecision, BudgetStoreError>
fn reconcile_budget_hold( &mut self, request: BudgetReconcileHoldRequest, ) -> Result<BudgetHoldMutationDecision, BudgetStoreError>
fn capture_budget_hold( &mut self, request: BudgetReconcileHoldRequest, ) -> Result<BudgetHoldMutationDecision, BudgetStoreError>
Auto Trait Implementations§
impl !Freeze for SqliteBudgetStore
impl !RefUnwindSafe for SqliteBudgetStore
impl !Sync for SqliteBudgetStore
impl !UnwindSafe for SqliteBudgetStore
impl Send for SqliteBudgetStore
impl Unpin for SqliteBudgetStore
impl UnsafeUnpin for SqliteBudgetStore
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