Skip to main content

AvailabilityScopePort

Trait AvailabilityScopePort 

Source
pub trait AvailabilityScopePort: Send + Sync {
    // Required methods
    fn display_availability<'life0, 'life1, 'async_trait>(
        &'life0 self,
        item_ids: &'life1 [Uuid],
        warehouse_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ScopedAvailability>, AvailabilityScopeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn checkout_free_qty<'life0, 'life1, 'async_trait>(
        &'life0 self,
        demands: &'life1 [CheckoutDemand],
        warehouse_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<CheckoutFreeQty>, AvailabilityScopeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn sold_out<'life0, 'life1, 'async_trait>(
        &'life0 self,
        item_ids: &'life1 [Uuid],
        warehouse_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<SoldOutVerdict, AvailabilityScopeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

The two-scope availability read a composing service (the storefront, a feed renderer, a pickup flow) consults. Every method is a pure read over the stock estate; nothing is reserved and nothing is persisted.

Required Methods§

Source

fn display_availability<'life0, 'life1, 'async_trait>( &'life0 self, item_ids: &'life1 [Uuid], warehouse_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<ScopedAvailability>, AvailabilityScopeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Display scope: fresh per-item availability at the pivot warehouse, complete over item_ids in input order (absent items zeroed — an unreceived item is unavailable, not an error).

Source

fn checkout_free_qty<'life0, 'life1, 'async_trait>( &'life0 self, demands: &'life1 [CheckoutDemand], warehouse_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<CheckoutFreeQty>, AvailabilityScopeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Checkout scope: fresh per-item availability at the (possibly pickup-overridden) pivot warehouse minus the caller’s own held quantities, floored at zero. Complete over the demand list’s items.

Source

fn sold_out<'life0, 'life1, 'async_trait>( &'life0 self, item_ids: &'life1 [Uuid], warehouse_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<SoldOutVerdict, AvailabilityScopeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Sold-out verdict over the WHOLE item set (WSC’s first-variant-only template check is the bug class this refuses to re-express): sold_out = no member has availability. Policy (may an out-of-stock item still be ordered?) stays with the caller — this is raw stock truth.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§