pub struct TransportCapacityPoolV1 {
pub id: String,
pub resource: String,
pub custodian: KnowledgeHolderRef,
pub window_from: SimTime,
pub window_until: SimTime,
pub quantity: u64,
pub booked: u64,
pub consumed: u64,
pub revision: u64,
}Expand description
A windowed pool of interchangeable transport capacity, such as ferry crossings, carriage places, or relay mounts for one period.
quantity is the capacity offered for the whole window. booked is held
by confirmed bookings and consumed by consumed ones; released, expired,
cancelled, and failed bookings hold nothing. revision advances whenever
the offer or either counter changes, so allocation evidence can cite the
exact pool state it read.
Fields§
§id: String§resource: String§custodian: KnowledgeHolderRef§window_from: SimTime§window_until: SimTime§quantity: u64§booked: u64§consumed: u64§revision: u64Implementations§
Source§impl TransportCapacityPoolV1
impl TransportCapacityPoolV1
Sourcepub fn new(
id: String,
resource: String,
custodian: KnowledgeHolderRef,
window_from: SimTime,
window_until: SimTime,
quantity: u64,
) -> Result<TransportCapacityPoolV1, TransportError>
pub fn new( id: String, resource: String, custodian: KnowledgeHolderRef, window_from: SimTime, window_until: SimTime, quantity: u64, ) -> Result<TransportCapacityPoolV1, TransportError>
Creates an empty pool at revision one.
pub fn validate(&self) -> Result<(), TransportError>
Sourcepub fn revise(
&mut self,
window_from: SimTime,
window_until: SimTime,
quantity: u64,
) -> Result<(), TransportError>
pub fn revise( &mut self, window_from: SimTime, window_until: SimTime, quantity: u64, ) -> Result<(), TransportError>
Replaces the offered window and quantity. The new quantity must still cover everything booked or consumed.
Sourcepub fn apply_allocations(
&mut self,
allocations: &[BookingAllocationV1],
) -> Result<(), TransportError>
pub fn apply_allocations( &mut self, allocations: &[BookingAllocationV1], ) -> Result<(), TransportError>
Commits one allocation pass computed by allocate_capacity_bookings
against this exact pool revision, then advances the revision.
Sourcepub fn apply_booking_transition(
&mut self,
quantity: u64,
from: CapacityBookingStatus,
to: CapacityBookingStatus,
) -> Result<(), TransportError>
pub fn apply_booking_transition( &mut self, quantity: u64, from: CapacityBookingStatus, to: CapacityBookingStatus, ) -> Result<(), TransportError>
Applies the capacity effect of one booking transition made after
allocation: consumption moves quantity from booked to consumed,
while releasing, cancelling, or expiring a confirmed booking and
releasing a consumed one return it. Cancelling or failing a request
holds nothing and leaves the pool unchanged. Confirmation happens only
through Self::apply_allocations.
Trait Implementations§
Source§impl Clone for TransportCapacityPoolV1
impl Clone for TransportCapacityPoolV1
Source§fn clone(&self) -> TransportCapacityPoolV1
fn clone(&self) -> TransportCapacityPoolV1
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more