Struct RouteDocument
pub struct RouteDocument { /* private fields */ }Expand description
A record a host holds by its route alone, as a plain document of its own, without a window or a record store: a workspace’s shared desktop, which its windows’ host keeps.
Its changes go out on the route as a window’s do, signed, end-to-end
encrypted where the route is, and retained by the workspace’s hosts for
devices that join later: the route’s first publication in a session is
the whole document, every later one what changed since. What other
holders write comes back in, each write once, with its author, for the
holder to decide before it is merged (RouteDocument::pump); what a
workspace’s governor already decided (its committed history) is merged as
it comes. A write that arrives before the changes it builds on waits
until they are here. Nothing here waits on a timer: a write the route
did not take is offered again when the route takes writes again, and
the whole document again once the connection was lost.
Implementations§
§impl RouteDocument
impl RouteDocument
pub fn connect(
connector: HostSessionConnector,
route: RouteSpec,
kind: Option<String>,
wake: impl Fn() + Send + Sync + 'static,
) -> RouteDocument
pub fn connect( connector: HostSessionConnector, route: RouteSpec, kind: Option<String>, wake: impl Fn() + Send + Sync + 'static, ) -> RouteDocument
Hold route, reaching the broker through the host’s connector as
the app whose record it is, joined as a record of kind. wake
runs, on whatever thread, whenever the broker sent something: the
holder then pumps.
pub fn connect_with(
manager: impl FnOnce() -> CollaborationManager,
route: RouteSpec,
wake: impl Fn() + Send + Sync + 'static,
) -> RouteDocument
pub fn connect_with( manager: impl FnOnce() -> CollaborationManager, route: RouteSpec, wake: impl Fn() + Send + Sync + 'static, ) -> RouteDocument
Self::connect for a host that reaches the broker its own way:
manager makes the connection to route, inside the scope wake
runs from, as Self::connect’s connector’s is.
pub fn publishable(&self) -> bool
pub fn publishable(&self) -> bool
Whether the route takes this holder’s writes now.
pub fn pump(
&mut self,
doc: &mut AutoCommit,
admit: &mut dyn FnMut(&mut AutoCommit, Arrival<'_>) -> Result<Admission, String>,
) -> Pumped
pub fn pump( &mut self, doc: &mut AutoCommit, admit: &mut dyn FnMut(&mut AutoCommit, Arrival<'_>) -> Result<Admission, String>, ) -> Pumped
Merge into doc what arrived on the route, each write another
holder made only as admit decides (it merges the write into the
document it is given, or refuses it and leaves that as it was), and
publish what doc holds that the route does not. Call it whenever
doc changed here and whenever the broker woke the holder.
Auto Trait Implementations§
impl Freeze for RouteDocument
impl !RefUnwindSafe for RouteDocument
impl Send for RouteDocument
impl !Sync for RouteDocument
impl Unpin for RouteDocument
impl UnsafeUnpin for RouteDocument
impl !UnwindSafe for RouteDocument
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> 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>, which can then be
downcast into Box<dyn 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>, which 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> DowncastSend for T
impl<T> DowncastSend for T
§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