Skip to main content

CollaborationManager

Struct CollaborationManager 

pub struct CollaborationManager { /* private fields */ }

Implementations§

§

impl CollaborationManager

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>

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>

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>

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>

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>

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

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

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

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

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

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

Where the connection stands. Cheap; call it every frame.

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

Whether requests currently reach peers: Self::state is CollaborationState::Ready.

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)

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>

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

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>

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>

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>)

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)

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>

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)

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>

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>

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

§

fn default() -> CollaborationManager

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Fruit for T
where T: Send + Downcast,

§

impl<T> WasmNotSend for T
where T: Send,