Skip to main content

CollabTransport

Trait CollabTransport 

pub trait CollabTransport: Send {
Show 19 methods // Required methods fn status(&self) -> TransportStatus; fn submit( &mut self, command: TransportCommand, ) -> Result<(), TransportError>; fn drain(&mut self, out: &mut Vec<CollabEvent>); fn take_primary_route_result(&mut self) -> Option<Result<RouteSpec, String>>; fn take_action_directory_requests( &mut self, out: &mut Vec<ActionDirectoryRequest>, ); // Provided methods fn private_window_binding(&self, route: &RouteSpec) -> Option<u64> { ... } fn wait_primary_route_result( &mut self, timeout: Duration, ) -> Option<Result<RouteSpec, String>> { ... } fn publication_barrier( &mut self, ) -> Result<DocumentPublicationReceipt, DocumentPublicationError> { ... } fn set_wake(&mut self, wake: Box<dyn Fn() + Send + Sync>) { ... } fn set_document_owner_routes(&mut self, _routes: Vec<RouteSpec>) { ... } fn finish_event_batch(&mut self) { ... } fn take_action_surface_failed(&mut self) -> bool { ... } fn action_directory_publication_counts(&self) -> Option<(u64, u64)> { ... } fn document_publishable(&self, channel: Option<&str>) -> bool { ... } fn send_native_media( &mut self, channel: String, request_id: u64, command: Request, ) -> bool { ... } fn document_publication_failed(&self) -> bool { ... } fn fail_closed(&self, reason: &'static str) { ... } fn committed_document_required(&self, channel: &str) -> bool { ... } fn prepare_committed_document( &mut self, route: RouteSpec, record_kind: &str, ) -> Option<CommittedDocument> { ... }
}
Expand description

A synchronous, poll-driven collaboration transport. See the module documentation for the contract every implementation upholds.

Required Methods§

fn status(&self) -> TransportStatus

Current liveness; the manager reports it as is_connected.

fn submit(&mut self, command: TransportCommand) -> Result<(), TransportError>

Admit one command without blocking.

§Errors

TransportError::Shed when transient presence was dropped, TransportError::Closed when the transport is (or just became) unavailable, TransportError::Unsupported for a command it does not implement, TransportError::Busy or TransportError::TooLarge for a document mutation it did not admit.

fn drain(&mut self, out: &mut Vec<CollabEvent>)

Move every event that is ready into out, in arrival order.

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

The remote end’s decision about the latest primary Hello, once.

fn take_action_directory_requests( &mut self, out: &mut Vec<ActionDirectoryRequest>, )

Move pending action-directory queries into out. Each carries its own reply channel, answered by the owner thread.

Provided Methods§

fn private_window_binding(&self, route: &RouteSpec) -> Option<u64>

Native private window identity acknowledged by the original broker. Unsupported transports and ordinary document/identity markers grant none.

fn wait_primary_route_result( &mut self, timeout: Duration, ) -> Option<Result<RouteSpec, String>>

Like Self::take_primary_route_result, but a transport that can block its caller may wait up to timeout for the result. A transport that timed the Hello from a deadline it shares with its remote end waits for that deadline instead, so both sides give up together. Used only by blocking constructors; poll-driven transports keep the default.

fn publication_barrier( &mut self, ) -> Result<DocumentPublicationReceipt, DocumentPublicationError>

A receipt that completes once every document mutation submitted so far has been published.

§Errors

DocumentPublicationError::Unsupported unless the transport implements publication completion.

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

Install the callback that schedules the owner’s next frame. A transport that becomes ready outside Self::drain calls it so the events are not left waiting for an unrelated frame.

fn set_document_owner_routes(&mut self, _routes: Vec<RouteSpec>)

Scope delivery capture waits to the App’s reconciled live document owners.

fn finish_event_batch(&mut self)

Release native capture turns after the owner applies its drained batch.

fn take_action_surface_failed(&mut self) -> bool

Whether the remote end refused or failed an action-surface publication since the last call. The owner then republishes its current surface: a refused one must never count as published.

fn action_directory_publication_counts(&self) -> Option<(u64, u64)>

Actual successful/failed pull-directory RPCs for this transport lifetime. None means this transport does not expose the observation. Observing enables an owner wake for later acknowledgements; unobserved callers retain their original scheduling.

fn document_publishable(&self, channel: Option<&str>) -> bool

Whether committed-document custody allows publishing a document mutation on channel (the primary route when None is not yet acknowledged). Transports without committed reads always allow it.

fn send_native_media( &mut self, channel: String, request_id: u64, command: Request, ) -> bool

Hand one native media command for channel to the transport’s media side channel. Returns whether it was admitted.

fn document_publication_failed(&self) -> bool

Whether the transport latched a terminal document publication failure.

fn fail_closed(&self, reason: &'static str)

Withdraw the transport after an unrecoverable publication outcome.

fn committed_document_required(&self, channel: &str) -> bool

Whether the original committed history of channel is required before any local publication on it.

fn prepare_committed_document( &mut self, route: RouteSpec, record_kind: &str, ) -> Option<CommittedDocument>

Join route, whose record holds record_kind, through the existing worker when committed custody needs it, returning the original committed history once it is available.

Implementors§