Struct CollaborationManager
pub struct CollaborationManager { /* private fields */ }Implementations§
§impl CollaborationManager
impl CollaborationManager
pub fn for_route(
app_id: impl Into<String>,
cluster_id: Uuid,
record: Option<String>,
handle: Option<String>,
) -> Result<CollaborationManager, NotAvailable>
pub fn for_route( app_id: impl Into<String>, cluster_id: Uuid, record: Option<String>, handle: Option<String>, ) -> Result<CollaborationManager, NotAvailable>
Connect to the launcher-inherited typed collaboration service and
announce an explicit route. Headless participants use this instead of
relying on process-wide QUICK_APP_ID / TILO_WORKSPACE_ID variables.
§Errors
Returns [runtime_portal::NotAvailable] when the launcher did not
hand down a collab service connection.
pub fn for_route_fd(
fd: i32,
app_id: impl Into<String>,
cluster_id: Uuid,
record: Option<String>,
handle: Option<String>,
) -> Result<CollaborationManager, NotAvailable>
pub fn for_route_fd( fd: i32, app_id: impl Into<String>, cluster_id: Uuid, record: Option<String>, handle: Option<String>, ) -> Result<CollaborationManager, NotAvailable>
Explicit typed endpoint for in-process and headless transport
harnesses. Takes ownership of fd. It uses an ephemeral signer; a
production broker rejects the uncertified join, so this cannot bypass
workspace admission.
§Errors
Returns [runtime_portal::NotAvailable] when fd does not bootstrap
a working collab service connection.
pub fn for_route_fd_with_identity(
fd: i32,
app_id: impl Into<String>,
cluster_id: Uuid,
record: Option<String>,
handle: Option<String>,
identity: CertifiedEndpointIdentity,
) -> Result<CollaborationManager, NotAvailable>
pub fn for_route_fd_with_identity( fd: i32, app_id: impl Into<String>, cluster_id: Uuid, record: Option<String>, handle: Option<String>, identity: CertifiedEndpointIdentity, ) -> Result<CollaborationManager, NotAvailable>
Connect to an explicit endpoint with a certified device presentation. This is the headless equivalent of the launcher-provided identity path.
§Errors
Returns [runtime_portal::NotAvailable] when fd cannot bootstrap a
collaboration service connection.
pub fn for_agent_route(
app_id: impl Into<String>,
cluster_id: Uuid,
record: Option<String>,
agent_id: impl Into<String>,
) -> Result<CollaborationManager, NotAvailable>
pub fn for_agent_route( app_id: impl Into<String>, cluster_id: Uuid, record: Option<String>, agent_id: impl Into<String>, ) -> Result<CollaborationManager, NotAvailable>
Connect a headless participant as a first-class workspace agent. Its friendly id is both the visible handle and the principal whose scoped capabilities the broker evaluates.
§Errors
Returns [runtime_portal::NotAvailable] when the collaboration
service or certified join identity is unavailable.
pub fn for_agent_route_fd(
fd: i32,
app_id: impl Into<String>,
cluster_id: Uuid,
record: Option<String>,
agent_id: impl Into<String>,
) -> Result<CollaborationManager, NotAvailable>
pub fn for_agent_route_fd( fd: i32, app_id: impl Into<String>, cluster_id: Uuid, record: Option<String>, agent_id: impl Into<String>, ) -> Result<CollaborationManager, NotAvailable>
Explicit-socket counterpart to Self::for_agent_route. Production
still requires a certified endpoint identity; this method merely
preserves the agent principal kind for diagnostic transports.
§Errors
Returns [runtime_portal::NotAvailable] when the socket cannot be
joined or the route identity cannot be established.
pub fn for_agent_route_fd_with_identity(
fd: i32,
app_id: impl Into<String>,
cluster_id: Uuid,
record: Option<String>,
agent_id: impl Into<String>,
identity: CertifiedEndpointIdentity,
) -> Result<CollaborationManager, NotAvailable>
pub fn for_agent_route_fd_with_identity( fd: i32, app_id: impl Into<String>, cluster_id: Uuid, record: Option<String>, agent_id: impl Into<String>, identity: CertifiedEndpointIdentity, ) -> Result<CollaborationManager, NotAvailable>
Certified explicit-socket agent connection used by out-of-process runtimes that do not inherit the launcher’s service descriptor.
§Errors
Returns [runtime_portal::NotAvailable] when the socket or certified
route join fails.
pub fn for_route_host_in_background(
connector: HostSessionConnector,
route: RouteSpec,
record_kind: Option<String>,
) -> CollaborationManager
pub fn for_route_host_in_background( connector: HostSessionConnector, route: RouteSpec, record_kind: Option<String>, ) -> CollaborationManager
A manager on route, reached through the host’s connector as an
app it launched, connecting in the background: the manager reports
super::CollaborationState::Connecting until the broker
acknowledges the route. For a host showing an app inside its own
process.
§impl CollaborationManager
impl CollaborationManager
pub fn with_transport(
transport: Box<dyn CollabTransport>,
) -> CollaborationManager
pub fn with_transport( transport: Box<dyn CollabTransport>, ) -> CollaborationManager
Speak to an explicitly supplied transport.
The manager announces nothing on its own: send a
CollabRequest::Hello to name the primary route. The route becomes
Self::primary_route only once the transport reports the remote
end’s acknowledgement through
CollabTransport::take_primary_route_result, observed by
Self::poll. The transport is handed a wake callback that schedules
this owner’s next frame.
pub fn new() -> CollaborationManager
pub fn new() -> CollaborationManager
Connects to the launcher-inherited collaboration service when this build has one, entering Disabled mode when it is unavailable.
Returns at once: the connection is made in the background and its
progress is reported by Self::state. Nothing here waits on the
service, so this is safe to call on a UI thread before the first
frame.
Both modes auto-send Hello announcing no record (one document
per (app, room)); use Self::for_record for apps that have
adopted records.
§impl CollaborationManager
impl CollaborationManager
pub fn for_record(checkout: &RecordCheckout) -> CollaborationManager
pub fn for_record(checkout: &RecordCheckout) -> CollaborationManager
A manager scoped to one record — one document, one change graph,
one channel — so two people editing different files in one room
don’t get handed each other’s state. A process with several records
open holds several managers; tilo_ui::App swaps its manager on checkout
change.
pub fn with_peer_transport(
transport: impl PeerTransport + 'static,
) -> CollaborationManager
pub fn with_peer_transport( transport: impl PeerTransport + 'static, ) -> CollaborationManager
Inject a host-owned ordinary authenticated peer transport. Joins remain pending until the adapter supplies the broker’s matching acknowledgement.
pub fn state(&self) -> CollaborationState
pub fn state(&self) -> CollaborationState
Where the connection stands. Cheap; call it every frame.
pub fn take_state_change(&mut self) -> Option<CollaborationState>
pub fn take_state_change(&mut self) -> Option<CollaborationState>
The current state when it differs from the one this method last returned (initially, the state the manager was constructed in). Lets an owner run connect-time work once, when the manager becomes ready.
pub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Whether requests currently reach peers: Self::state is
CollaborationState::Ready.
pub fn with_identity(self, identity: SigningIdentity) -> CollaborationManager
pub fn with_identity(self, identity: SigningIdentity) -> CollaborationManager
Bind a signing identity, builder-style for chaining at boot. Replaces any previous identity.
pub fn set_identity(&mut self, identity: SigningIdentity)
pub fn set_identity(&mut self, identity: SigningIdentity)
Replace the bound identity in place, e.g. when the user switches identities in the chrome’s identity picker without tearing down the manager.
pub fn has_identity(&self) -> bool
pub fn send_signed_op(
&mut self,
payload: Vec<u8>,
artifact: ArtifactId,
kind: OpKind,
) -> Result<(), SignedSendError>
pub fn send_signed_op( &mut self, payload: Vec<u8>, artifact: ArtifactId, kind: OpKind, ) -> Result<(), SignedSendError>
Sign and send a CRDT mutation envelope. Best-effort like
Self::send: an unsent frame isn’t retried, but the next live
edit republishes state, bounding the loss to one round-trip.
§Errors
Returns SignedSendError::NoIdentity when no signing identity is
bound, SignedSendError::SequenceExhausted before a sequence could
be reused, or SignedSendError::Canonical when payload fails to
canonicalize for signing.
pub fn send(&mut self, req: CollabRequest) -> bool
pub fn send(&mut self, req: CollabRequest) -> bool
Fire-and-forget and non-blocking on every backend. Presence may be
shed under saturation; any other durable enqueue failure visibly
disconnects the manager, so callers never continue under the illusion
it was sent. Document mutations never disconnect: see
Self::try_send for why one was not sent.
While the manager is CollaborationState::Connecting only a
Hello is accepted: there is no acknowledged primary route to carry
anything else, so other requests return false exactly as they do
offline. Owners re-publish their state once the manager is ready.
pub fn try_send(&mut self, req: CollabRequest) -> Result<(), CollabSendError>
pub fn try_send(&mut self, req: CollabRequest) -> Result<(), CollabSendError>
Self::send with the reason a request was not handed off. A
document mutation larger than one signed frame is split into signed
segments by the transport; one above
[collab_types::MAX_DOCUMENT_TRANSFER_BYTES] is refused with
CollabSendError::TooLarge and nothing is sent.
§Errors
Returns CollabSendError when the request was not queued, and
CollabSendError::Unavailable for anything but a Hello while the
manager is still connecting.
pub fn begin_document_publication_barrier(
&mut self,
) -> Result<DocumentPublicationReceipt, DocumentPublicationError>
pub fn begin_document_publication_barrier( &mut self, ) -> Result<DocumentPublicationReceipt, DocumentPublicationError>
Ask the transport for a completion receipt covering every document mutation submitted before this call. The receipt reports that the transport finished publishing them, not that peers applied them.
§Errors
Returns DocumentPublicationError::Unavailable without a transport,
or the transport’s own refusal (including
DocumentPublicationError::Unsupported).
pub fn publish_action_directory(&mut self, app_id: impl Into<String>)
pub fn publish_action_directory(&mut self, app_id: impl Into<String>)
Register the UI-owned pull directory on the primary broker route. Re-registering is harmless: the broker atomically replaces the old capability for this live connection.
pub fn join_route(&mut self, route: RouteSpec)
pub fn join_route(&mut self, route: RouteSpec)
Join and subscribe to an additional route without publishing traffic. Repeated joins of the same route are idempotent.
pub fn install_document_encryption(
&mut self,
route: RouteSpec,
group: ChannelGroup,
) -> Result<(), String>
pub fn install_document_encryption( &mut self, route: RouteSpec, group: ChannelGroup, ) -> Result<(), String>
Install an already-provisioned MLS endpoint for route.
From this point the route is fail-closed: locally generated document
mutations are encrypted and encrypted inbound envelopes are decrypted
before becoming CollabEvent::Document. The channel id must be the
deterministic id for the exact app/workspace/record route. Group
provisioning and durable secret storage intentionally remain outside
the UI process; callers should obtain the group from the workspace
identity service and must reinstall it after a process restart.
§Errors
Returns an error for a route/channel mismatch, an unavailable or stopped collaboration worker, or a route that cannot be joined.
pub fn send_to_route(&mut self, route: RouteSpec, req: CollabRequest)
pub fn send_to_route(&mut self, route: RouteSpec, req: CollabRequest)
Publish on an explicitly named additional route. The route is joined
lazily and retained, and its inbound streams feed this manager’s normal
Self::poll queue.
Like Self::send, this sends nothing while the manager is still
connecting.
pub fn try_send_to_route(
&mut self,
route: RouteSpec,
req: CollabRequest,
) -> Result<(), CollabSendError>
pub fn try_send_to_route( &mut self, route: RouteSpec, req: CollabRequest, ) -> Result<(), CollabSendError>
Self::send_to_route with the reason a request was not handed off.
This is the exact local enqueue outcome: the transport’s later
publication barrier still owns durable acknowledgement.
§Errors
Returns CollabSendError when the request was not queued.
pub fn poll(&mut self) -> Vec<CollabEvent>
pub fn poll(&mut self) -> Vec<CollabEvent>
Drain every event pending on the current backend. Non-blocking.
Also records a primary-route acknowledgement the transport reported since the last poll.
While the manager is CollaborationState::Connecting, this is also
where it settles: a primary-route acknowledgement makes it ready; a
refusal or a closed connection takes it offline.
Trait Implementations§
§impl Default for CollaborationManager
impl Default for CollaborationManager
§fn default() -> CollaborationManager
fn default() -> CollaborationManager
Auto Trait Implementations§
impl Freeze for CollaborationManager
impl !RefUnwindSafe for CollaborationManager
impl Send for CollaborationManager
impl !Sync for CollaborationManager
impl Unpin for CollaborationManager
impl UnsafeUnpin for CollaborationManager
impl !UnwindSafe for CollaborationManager
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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