Skip to main content

Channel

Struct Channel 

Source
pub struct Channel {
    pub id: ChannelId,
    pub transport: TransportProtocol,
    pub communication_info: HashMap<String, String>,
    pub status: ChannelStatus,
    pub created_at: u64,
    pub role: SenderKind,
    pub replica_id: Option<u64>,
}
Expand description

A channel — the post-pairing representation of a peer.

Stored by crate::protocol::DeRecChannelStore and returned by its channels() method.

Serialize / Deserialize are derived for the FFI and WASM bridges, which ship channels to host languages as JSON over the language boundary. Library consumers writing a Rust DeRecChannelStore see only the typed value and never observe the serde representation; the wire format is not part of the public API and may change independently. #[serde(default)] annotations let bridges decode legacy bytes that predate later-added fields without erroring.

Fields§

§id: ChannelId

Unique identifier for this channel.

§transport: TransportProtocol

The peer’s transport endpoint.

§communication_info: HashMap<String, String>

Application-level identity metadata for the peer on this channel.

Free-form key/value pairs — the protocol treats this as opaque and never inspects keys or values. Anything an app wants to remember about who is on the other end (display name, account id, avatar URI, …) lives here. App-level identity logic (e.g. auto-linking by display name) reads from this map; the protocol does not.

On the initiator side, this is whatever the caller supplied when starting crate::protocol::DeRecFlow::Pairing. On the responder side, it is the peer’s own communication_info extracted from the wire pair-request — the same map that surfaces in crate::protocol::DeRecEvent::PairingCompleted::peer_communication_info.

§status: ChannelStatus

Lifecycle status. Messages on Pending channels are ignored.

§created_at: u64

Unix timestamp (seconds) when the channel was created.

§role: SenderKind

This node’s role on this channel, fixed at pairing time.

The orchestrator enforces flow directionality against this value: an Owner may initiate ProtectSecret / VerifyShares / Discovery / RecoverSecret; a Helper may not. Inbound messages are gated the other way around — a StoreShareRequest is only honored on a channel where this node is the Helper, and so on.

§replica_id: Option<u64>

The peer’s replica identity, populated only when role is ReplicaSource or ReplicaDestination.

Extracted from the peer’s derec.replica_id entry in CommunicationInfo during the pair handshake. None on Helper/Owner channels and as a defensive default on freshly-paired Replica channels where the peer did not advertise one.

Trait Implementations§

Source§

impl Clone for Channel

Source§

fn clone(&self) -> Channel

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 Channel

Source§

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

Formats the value using the given formatter. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

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

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

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

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

Source§

fn vzip(self) -> V