Skip to main content

DeviceJoinTransport

Struct DeviceJoinTransport 

Source
pub struct DeviceJoinTransport<'a> { /* private fields */ }
Expand description

One attempt’s slot namespace, bound to the roles this device plays in it.

Implementations§

Source§

impl<'a> DeviceJoinTransport<'a>

Source

pub fn open( storage: &'a dyn SyncStorage, bundle: &'a DeviceJoinOfferBundle, roles: DeviceJoinRoles, ) -> Result<DeviceJoinTransport<'a>, DeviceJoinTransportError>

Open the transport described by bundle against storage, for the roles this device plays. It may publish only the kinds those roles produce; it may read every kind.

Source

pub async fn publish( &self, action: &DeviceJoinAction, ) -> Result<(), DeviceJoinTransportError>

Seal an artifact and create it at its slot.

Republishing an artifact already at its slot succeeds — that is what a crash between the durable journal advance and the create resumes into. The seal draws a fresh nonce per call, so sameness is decided on the artifact, not on the stored ciphertext; the first write’s bytes stay. A different artifact at an occupied slot is refused: a counterpart may already have read what is there.

Source

pub async fn read( &self, kind: DeviceJoinTransportKind, ) -> Result<Option<DeviceJoinAction>, DeviceJoinTransportError>

Read one kind’s artifact, or None while its slot is still empty.

Source

pub async fn await_artifact<T>( &self, timing: DeviceJoinTransportTiming, ) -> Result<T, DeviceJoinTransportError>
where T: DeviceJoinArtifact,

Poll for the counterpart’s artifact of type T until the deadline. The timeout names the role that never published, so a host can tell the user which device it is waiting on.

Source

pub async fn await_step<T>( &self, timing: DeviceJoinTransportTiming, ) -> Result<DeviceJoinStep<T>, DeviceJoinTransportError>
where T: DeviceJoinArtifact,

Poll for the next artifact of type T, or for the owner’s abandonment of the whole attempt, whichever appears first.

The owner may give up on an attempt while the joining device is waiting for the next step, so every joiner wait watches both slots. A wait that watched only its own kind would sit until its deadline against an abandonment already published.

Source

pub async fn delete_attempt_slots(&self) -> Result<(), DeviceJoinTransportError>

Remove every slot this attempt reserved.

Called once the exchange has reached an end the joining device has consumed — its completed join, its accepted abandonment, or its accepted cleanup activation. The joining device is the last reader on all three, which is why the deletion is its to make: the owner has no artifact by which it could learn that the joiner read the last thing it published. There is no sweep behind this — an attempt that reaches none of those ends keeps its slots until its cancellation removes them.

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,