Skip to main content

DeviceJoinTransport

Struct DeviceJoinTransport 

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

One attempt’s slot namespace, bound to the side of the exchange this device is on.

Implementations§

Source§

impl<'a> DeviceJoinTransport<'a>

Source

pub fn open( storage: &'a dyn CloudSyncObjectStorage, bundle: &'a DeviceJoinOfferBundle, role: DeviceJoinRole, ) -> Result<Self, DeviceJoinTransportError>

Open the transport described by bundle against storage, for the role this device plays. It may publish only the kinds that role produces; 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: DeviceJoinArtifact>( &self, timing: DeviceJoinTransportTiming, ) -> Result<T, DeviceJoinTransportError>

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 observe_artifact<T: DeviceJoinArtifact>( &self, timing: DeviceJoinTransportTiming, ) -> Result<T, DeviceJoinTransportError>

Observe one artifact without imposing a phase deadline. A concurrent operation owns the deadline; this observation exists to interrupt that operation when a terminal artifact appears.

This is the longest-running wait in a join and the one least likely to find anything: it watches for the owner cancelling, for the whole join, alongside the snapshot download and the install. At the asked-for cadence that is a provider read every hundred milliseconds for minutes to answer “not yet” — which is exactly what the poll backoff was introduced to stop for the phase waits, and this one was left behind because it takes a bare interval rather than a timing. It takes the timing now and backs off like the others: the first look is immediate, so a cancellation still interrupts promptly, and the cadence settles at the same ceiling instead of running flat out under a several-second download.

Source

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

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 everything under this attempt’s namespace.

Called once the exchange has reached an end the joining device has consumed — its completed join or its accepted abandonment. The joining device is the last reader on both, which is why the deletion is its to make: the admitting device has no artifact by which it could learn that the joiner read the last thing it published. There is no sweep behind this.

The namespace is listed rather than probed kind by kind. Probing asks for every name this build knows and so leaves behind anything written under a name it does not — an artifact from a different version, or from anyone else who can write to the provider. A listing names what is actually there, which is what “remove the namespace” has to mean.

Each object is still deleted by the exact reference its own stored bytes produce, so a delete cannot race a concurrent write: the reference carries the size and hash observed, and the delete refuses if what sits there no longer matches. Nothing is opened — this is removing a namespace, not reading it, and an object this device cannot decrypt is exactly as much garbage as one it can.

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<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

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