Trait CollabTransport
pub trait CollabTransport: Send {
Show 28 methods
// Required methods
fn status(&self) -> TransportStatus;
fn submit(
&mut self,
command: TransportCommand,
) -> Result<(), TransportError>;
fn drain(&mut self, out: &mut Vec<CollabEvent<SdkCustody>>);
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 connection_snapshot(
&self,
route: &RouteSpec,
) -> Option<ConnectionSnapshot> { ... }
fn private_window_binding(&self, route: &RouteSpec) -> Option<u64> { ... }
fn wait_primary_route_result(&mut self) -> Option<Result<RouteSpec, String>> { ... }
fn join_hold(&self) -> Option<JoinHold> { ... }
fn publication_barrier(
&mut self,
) -> Result<DocumentPublicationReceipt, DocumentPublicationError> { ... }
fn set_wake(&mut self, wake: Box<dyn Fn() + Send + Sync>) { ... }
fn action_of(
&self,
_workspace: &str,
_change: &[u8; 32],
) -> Option<CommitHistory> { ... }
fn set_document_owner_routes(
&mut self,
_routes: Vec<RouteSpec>,
_document_generation: u64,
) { ... }
fn invocation_owner_current(&mut self, _id: u64) -> bool { ... }
fn hosts_surface(&mut self) -> bool { ... }
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 joined_record_kind(&self, channel: &str) -> Option<RecordKind> { ... }
fn route_join_failure(&self, channel: &str) -> Option<String> { ... }
fn send_native_media(
&mut self,
channel: String,
request_id: u64,
command: Request,
) -> bool { ... }
fn document_publication_failed(&self) -> bool { ... }
fn publication_outcome(&self) -> Option<DocumentPublicationError> { ... }
fn refused_change(&self) -> Option<String> { ... }
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
fn status(&self) -> TransportStatus
Current liveness; the manager reports it as is_connected.
fn submit(&mut self, command: TransportCommand) -> Result<(), TransportError>
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<SdkCustody>>)
fn drain(&mut self, out: &mut Vec<CollabEvent<SdkCustody>>)
Move every event that is ready into out, in arrival order.
fn take_primary_route_result(&mut self) -> Option<Result<RouteSpec, String>>
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>,
)
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 connection_snapshot(&self, route: &RouteSpec) -> Option<ConnectionSnapshot>
fn connection_snapshot(&self, route: &RouteSpec) -> Option<ConnectionSnapshot>
Inert authenticated recovery provenance; unsupported transports supply none.
fn private_window_binding(&self, route: &RouteSpec) -> Option<u64>
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) -> Option<Result<RouteSpec, String>>
fn wait_primary_route_result(&mut self) -> Option<Result<RouteSpec, String>>
Like Self::take_primary_route_result, but a transport that can
block its caller waits for the remote end’s decision, or for the end
of whatever would have delivered it (None). No clock ends the
wait. Used only by blocking constructors, never on a window’s thread;
poll-driven transports keep the default, which does not wait.
fn join_hold(&self) -> Option<JoinHold>
fn join_hold(&self) -> Option<JoinHold>
What holds up the join of the latest primary Hello while it is
pending, as the remote end reports it. Transports that report
nothing keep the default.
fn publication_barrier(
&mut self,
) -> Result<DocumentPublicationReceipt, DocumentPublicationError>
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>)
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 action_of(
&self,
_workspace: &str,
_change: &[u8; 32],
) -> Option<CommitHistory>
fn action_of( &self, _workspace: &str, _change: &[u8; 32], ) -> Option<CommitHistory>
The whole action the change change was part of, when this transport
keeps the index of the actions it carries in workspace: every unit
the action wrote, which is what one undo takes back. Transports with no
such index answer none.
fn set_document_owner_routes(
&mut self,
_routes: Vec<RouteSpec>,
_document_generation: u64,
)
fn set_document_owner_routes( &mut self, _routes: Vec<RouteSpec>, _document_generation: u64, )
Scope delivery capture waits to the App’s reconciled live document owners, for the App’s current document generation.
fn invocation_owner_current(&mut self, _id: u64) -> bool
fn invocation_owner_current(&mut self, _id: u64) -> bool
Whether the document owner invocation id (from the drained batch)
arrived for is still current. A job whose document was reopened or
replaced since must be refused, not run in the new document.
fn hosts_surface(&mut self) -> bool
fn hosts_surface(&mut 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 finish_event_batch(&mut self)
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
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)>
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
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 joined_record_kind(&self, channel: &str) -> Option<RecordKind>
fn joined_record_kind(&self, channel: &str) -> Option<RecordKind>
The kind of record channel was joined with, when the owner’s join
named it. A change that arrives before the route’s join resolved
re-joins naming this kind, so a host creating the record knows what
it holds.
fn route_join_failure(&self, channel: &str) -> Option<String>
fn route_join_failure(&self, channel: &str) -> Option<String>
Why the last join of channel failed, until a join of it succeeds.
fn send_native_media(
&mut self,
channel: String,
request_id: u64,
command: Request,
) -> bool
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
fn document_publication_failed(&self) -> bool
Whether the transport latched a terminal document publication failure.
fn publication_outcome(&self) -> Option<DocumentPublicationError>
fn publication_outcome(&self) -> Option<DocumentPublicationError>
The last publication outcome this transport reported, for telling a refusal of one change apart from a lost connection.
fn refused_change(&self) -> Option<String>
fn refused_change(&self) -> Option<String>
The last change the peer answered but would not accept, while nothing
later has gone through. A refusal fails that change alone: the
transport stays open and the owner reconciles its local copy. None
when no change is waiting on a refusal.
fn fail_closed(&self, reason: &'static str)
fn fail_closed(&self, reason: &'static str)
Withdraw the transport after an unrecoverable publication outcome.
fn committed_document_required(&self, channel: &str) -> bool
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>
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.