pub trait AtomicInventoryOps<Item, Time>: InventoryRepository<Item, Time>{
// Required method
fn reserve_many(
&mut self,
item_id: &Item::Id,
slots: &[(Time, Time, u32)],
) -> Result<(), InventoryError>;
}Expand description
An extension of InventoryRepository that supports atomic operations across multiple slots.
Useful for use cases like batch reservations, where all operations must succeed together or fail entirely.
Required Methods§
Sourcefn reserve_many(
&mut self,
item_id: &Item::Id,
slots: &[(Time, Time, u32)],
) -> Result<(), InventoryError>
fn reserve_many( &mut self, item_id: &Item::Id, slots: &[(Time, Time, u32)], ) -> Result<(), InventoryError>
Attempts to reserve multiple availability slots in a single atomic operation.
If any reservation fails (due to not found or insufficient availability), no changes will be applied to any of the slots.
§Parameters
item_id: The ID of the item to reserve.slots: A slice of(start_time, end_time, quantity)tuples to reserve.