Skip to main content

PeerTransport

Trait PeerTransport 

pub trait PeerTransport {
Show 13 methods // Required methods fn is_connected(&self) -> bool; fn send(&mut self, request: CollabRequest) -> Result<(), String>; fn poll(&mut self) -> Vec<CollabEvent<SdkCustody>>; // Provided methods fn connection_snapshot(&self, _: &RouteSpec) -> Option<ConnectionSnapshot> { ... } fn hosts_surface(&self) -> bool { ... } fn action_of( &self, _workspace: &str, _change: &[u8; 32], ) -> Option<CommitHistory> { ... } fn take_primary_route_result(&mut self) -> Option<Result<RouteSpec, String>> { ... } fn join_route(&mut self, _: RouteSpec, _: RecordKind) -> Result<(), String> { ... } fn send_to_route( &mut self, _: RouteSpec, _: CollabRequest, ) -> Result<(), String> { ... } fn publish_action_directory(&mut self, _: String) -> Result<(), String> { ... } fn take_action_directory_requests(&mut self) -> Vec<ActionDirectoryRequest> { ... } fn install_document_encryption( &mut self, _: RouteSpec, _: ChannelGroup, ) -> Result<(), String> { ... } fn set_wake(&mut self, _wake: Box<dyn Fn() + Send + Sync>) { ... }
}
Expand description

Transport adapters must authenticate ordinary peer joins and verify inbound envelopes before publishing events. Installing this adapter grants no model, action, HostContext, or storage authority. Queue failures are fail-closed.

Required Methods§

fn is_connected(&self) -> bool

fn send(&mut self, request: CollabRequest) -> Result<(), String>

fn poll(&mut self) -> Vec<CollabEvent<SdkCustody>>

Provided Methods§

fn connection_snapshot(&self, _: &RouteSpec) -> Option<ConnectionSnapshot>

Authenticated connection provenance from the host, never app model state.

fn hosts_surface(&self) -> bool

Whether this app is a surface of the desktop it speaks to, rather than an app of a document: what it offers lives with that desktop, so no document history custodies its actions.

fn action_of( &self, _workspace: &str, _change: &[u8; 32], ) -> Option<CommitHistory>

The whole action the change change was part of, when the peer keeps the index of the actions it carries in workspace: every unit the action wrote, which is what one undo takes back.

fn take_primary_route_result(&mut self) -> Option<Result<RouteSpec, String>>

The real broker acknowledgement of the latest Hello, never an optimistic echo.

fn join_route(&mut self, _: RouteSpec, _: RecordKind) -> Result<(), String>

Join route, whose record holds record_kind. The kind is what a host needs to create the record on this device’s first change.

fn send_to_route( &mut self, _: RouteSpec, _: CollabRequest, ) -> Result<(), String>

fn publish_action_directory(&mut self, _: String) -> Result<(), String>

fn take_action_directory_requests(&mut self) -> Vec<ActionDirectoryRequest>

fn install_document_encryption( &mut self, _: RouteSpec, _: ChannelGroup, ) -> Result<(), String>

fn set_wake(&mut self, _wake: Box<dyn Fn() + Send + Sync>)

Install the callback that schedules this owner’s next frame, as super::CollabTransport::set_wake does for a host-supplied transport: a peer answered on a thread of its own calls it, so what it carries is not left waiting for an unrelated frame.

Implementors§