Skip to main content

HostDeliveryRecord

Struct HostDeliveryRecord 

Source
pub struct HostDeliveryRecord { /* private fields */ }
Expand description

One item’s journey to one host destination, as the ledger holds it.

Immutable: every transition returns a new record. The ledger decides whether a transition is allowed and writes the result, so the rules about what may follow what live in one place and an adapter cannot invent a shortcut through them.

Implementations§

Source§

impl HostDeliveryRecord

Source

pub fn queued( item: HostDeliveryItem, target: HostDeliveryTarget, policy: HostDeliveryPolicy, created_at: OffsetDateTime, ) -> Result<Self, DomainError>

A new delivery, queued, with its identity derived from what it is.

Source

pub const fn id(&self) -> &HostDeliveryId

Source

pub const fn item(&self) -> &HostDeliveryItem

Source

pub const fn target(&self) -> &HostDeliveryTarget

Source

pub const fn policy(&self) -> &HostDeliveryPolicy

Source

pub const fn state(&self) -> &HostDeliveryState

Source

pub const fn attempt(&self) -> DeliveryAttempt

Source

pub const fn created_at(&self) -> OffsetDateTime

Source

pub const fn updated_at(&self) -> OffsetDateTime

Source

pub const fn history(&self) -> &DeliveryHistory

Source

pub fn is_offerable_at(&self, now: OffsetDateTime) -> bool

Whether a host could be handed this delivery at now.

A live lease excludes everyone else; an expired one does not, and that is the whole of the exclusion rule. A delivery an activation adapter already pushed stays offerable, because reaching a host is not the same as the host having answered.

Source

pub fn live_lease_at(&self, now: OffsetDateTime) -> Option<&HostDeliveryLease>

The lease currently excluding other holders, if one still does.

Source

pub fn leased(&self, lease: HostDeliveryLease, now: OffsetDateTime) -> Self

Handed out exclusively.

Source

pub fn delivered( &self, receipt: HostActivationReceipt, now: OffsetDateTime, ) -> Self

Pushed to the host by an activation adapter.

Source

pub fn acknowledged( &self, observation: HostDeliveryObservation, now: OffsetDateTime, ) -> Self

The host said what it saw.

Source

pub fn processed(&self, action: ProcessedActionRef, now: OffsetDateTime) -> Self

The host acted, and named the act.

Source

pub fn failed(&self, reason: DeliveryFailureReason, now: OffsetDateTime) -> Self

Given up on, with the attempt that gave up counted.

Source

pub fn requeued(&self, now: OffsetDateTime) -> Self

Back in the queue after a failed attempt, which is counted.

Source

pub fn released(&self, now: OffsetDateTime) -> Self

Back in the queue because a holder gave up its lease, uncounted.

Releasing is not failing: a host that hands work back untouched has not used up one of the delivery’s chances.

Source

pub fn expired(&self, cause: DeliveryExpiryCause, now: OffsetDateTime) -> Self

No longer worth making.

Source

pub fn superseded( &self, by: Option<HostDeliveryId>, now: OffsetDateTime, ) -> Self

Closed because its destination was replaced.

by is the delivery opened in its place, when the work follows.

Source

pub fn re_addressed( &self, target: HostDeliveryTarget, now: OffsetDateTime, ) -> Result<Self, DomainError>

The same delivery offered to a different destination.

A new identity, because the destination is part of what a delivery is: the replacement can be superseded, acknowledged and counted on its own without disturbing the record it follows.

Trait Implementations§

Source§

impl Clone for HostDeliveryRecord

Source§

fn clone(&self) -> Self

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 HostDeliveryRecord

Source§

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

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

impl<'de> Deserialize<'de> for HostDeliveryRecord

Source§

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

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

impl Eq for HostDeliveryRecord

Source§

impl PartialEq for HostDeliveryRecord

Source§

fn eq(&self, other: &Self) -> 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 HostDeliveryRecord

Source§

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

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

impl StructuralPartialEq for HostDeliveryRecord

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.