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>
impl<'a> DeviceJoinTransport<'a>
Sourcepub fn open(
storage: &'a dyn SyncStorage,
bundle: &'a DeviceJoinOfferBundle,
roles: DeviceJoinRoles,
) -> Result<DeviceJoinTransport<'a>, DeviceJoinTransportError>
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.
Sourcepub async fn publish(
&self,
action: &DeviceJoinAction,
) -> Result<(), DeviceJoinTransportError>
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.
Sourcepub async fn read(
&self,
kind: DeviceJoinTransportKind,
) -> Result<Option<DeviceJoinAction>, DeviceJoinTransportError>
pub async fn read( &self, kind: DeviceJoinTransportKind, ) -> Result<Option<DeviceJoinAction>, DeviceJoinTransportError>
Read one kind’s artifact, or None while its slot is still empty.
Sourcepub async fn await_artifact<T>(
&self,
timing: DeviceJoinTransportTiming,
) -> Result<T, DeviceJoinTransportError>where
T: DeviceJoinArtifact,
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.
Sourcepub async fn await_step<T>(
&self,
timing: DeviceJoinTransportTiming,
) -> Result<DeviceJoinStep<T>, DeviceJoinTransportError>where
T: DeviceJoinArtifact,
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.
Sourcepub async fn delete_attempt_slots(&self) -> Result<(), DeviceJoinTransportError>
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§
impl<'a> Freeze for DeviceJoinTransport<'a>
impl<'a> !RefUnwindSafe for DeviceJoinTransport<'a>
impl<'a> Send for DeviceJoinTransport<'a>
impl<'a> Sync for DeviceJoinTransport<'a>
impl<'a> Unpin for DeviceJoinTransport<'a>
impl<'a> UnsafeUnpin for DeviceJoinTransport<'a>
impl<'a> !UnwindSafe for DeviceJoinTransport<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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