Skip to main content

TransportExecution

Struct TransportExecution 

Source
pub struct TransportExecution {
    pub id: TransportExecutionId,
    pub delivery_attempt: Option<DomainRecordVersionRef>,
    pub state: TransportExecutionState,
    pub active_itinerary_revision: Option<ItineraryRevisionId>,
    pub current_leg_index: usize,
    pub estimated_arrival_at: Option<SimTime>,
    pub current_endpoint: Option<String>,
    pub revisions: Vec<ItineraryRevision>,
    pub legs: Vec<LegExecution>,
    pub handoffs: Vec<Handoff>,
    pub bookings: Vec<CapacityBooking>,
    pub saga: Option<DeliverySaga>,
}

Fields§

§id: TransportExecutionId§delivery_attempt: Option<DomainRecordVersionRef>§state: TransportExecutionState§active_itinerary_revision: Option<ItineraryRevisionId>§current_leg_index: usize§estimated_arrival_at: Option<SimTime>§current_endpoint: Option<String>§revisions: Vec<ItineraryRevision>§legs: Vec<LegExecution>§handoffs: Vec<Handoff>§bookings: Vec<CapacityBooking>§saga: Option<DeliverySaga>

Implementations§

Source§

impl TransportExecution

Source

pub fn new( id: TransportExecutionId, delivery_attempt: Option<DomainRecordVersionRef>, ) -> TransportExecution

Source

pub fn install_initial_itinerary( &mut self, revision: ItineraryRevision, ) -> Result<(), TransportError>

Source

pub fn reroute( &mut self, revision: ItineraryRevision, at: SimTime, ) -> Result<(), TransportError>

Source

pub fn begin_saga( &mut self, delivery_attempt: DomainRecordVersionRef, operation_key: String, ) -> Result<(), TransportError>

Source

pub fn start_current_leg(&mut self, at: SimTime) -> Result<(), TransportError>

Source

pub fn complete_current_leg( &mut self, at: SimTime, endpoint: String, ) -> Result<bool, TransportError>

Source

pub fn fail_current_leg( &mut self, reason: String, at: SimTime, ) -> Result<(), TransportError>

Source

pub fn mark_arrival_pending(&mut self) -> Result<(), TransportError>

Source

pub fn record_handoff(&mut self, handoff: Handoff) -> Result<(), TransportError>

Source

pub fn custody_left_itinerary(&self) -> bool

Whether a terminal seizure has taken custody out of the itinerary.

Such an execution cannot fail or reroute a leg, arrive, settle successfully, book capacity, or record another handoff. Its owner closes it: an execution with a delivery saga through Self::reconcile_information with a failure, which leaves it Failed, and one without a saga through Self::cancel.

Source

pub fn request_booking( &mut self, booking: CapacityBooking, ) -> Result<(), TransportError>

Adds one requested capacity booking to this execution.

The booking must name this execution, still be Requested, carry no allocation evidence, and have an identity unique within the execution. A terminal execution accepts no further bookings.

Source

pub fn settle_arrival( &mut self, at: SimTime, endpoint: String, ) -> Result<(), TransportError>

Completes the final departed leg of an execution that carries no delivery attempt and settles it.

A movement that does not complete an information delivery has nothing to reconcile, so arrival is its terminal fact. An execution with a delivery attempt or saga must instead use Self::complete_current_leg, which enters ArrivalPending, and then Self::reconcile_information.

Source

pub fn cancel(&mut self) -> Result<(), TransportError>

Cancels a non-terminal execution whose subject is not travelling.

No leg of the active itinerary may be departed (a leg in progress must first arrive or fail) and an arrival-pending execution must reconcile instead. Unstarted legs of the active itinerary become Cancelled; a delivery saga enters CompensationPending. Bookings are not changed: the caller closes them through CapacityBooking::transition.

Source

pub fn completion_request( &self, ) -> Result<DeliveryCompletionRequest, TransportError>

Source

pub fn reconcile_information( &mut self, outcome: ReconciliationOutcome, ) -> Result<(), TransportError>

Trait Implementations§

Source§

impl Clone for TransportExecution

Source§

fn clone(&self) -> TransportExecution

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TransportExecution

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TransportExecution

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<TransportExecution, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for TransportExecution

Source§

impl PartialEq for TransportExecution

Source§

fn eq(&self, other: &TransportExecution) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for TransportExecution

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for TransportExecution

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<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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.