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: ChannelIdUnique identifier for this channel.
transport: TransportProtocolThe 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: ChannelStatusLifecycle status. Messages on Pending channels are ignored.
created_at: u64Unix timestamp (seconds) when the channel was created.
role: SenderKindThis 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§
Auto Trait Implementations§
impl Freeze for Channel
impl RefUnwindSafe for Channel
impl Send for Channel
impl Sync for Channel
impl Unpin for Channel
impl UnsafeUnpin for Channel
impl UnwindSafe for Channel
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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