pub struct Current { /* private fields */ }Expand description
The server’s current workspace.
Implementations§
Source§impl Current
impl Current
Sourcepub fn new(
ctx: &'static AppContext,
host: Arc<WorkspaceHost>,
sync: Option<Arc<SyncRuntime>>,
file: SelectionFile,
) -> Current
pub fn new( ctx: &'static AppContext, host: Arc<WorkspaceHost>, sync: Option<Arc<SyncRuntime>>, file: SelectionFile, ) -> Current
The current workspace of host, synced by sync if there is one, remembered in
file.
Sourcepub fn host(&self) -> &Arc<WorkspaceHost> ⓘ
pub fn host(&self) -> &Arc<WorkspaceHost> ⓘ
The host holding the open workspace.
Sourcepub fn sync(&self) -> Option<&Arc<SyncRuntime>>
pub fn sync(&self) -> Option<&Arc<SyncRuntime>>
The sync runtime, when this server syncs.
Sourcepub async fn select(&self, dir: &Path) -> Result<CurrentWorkspace>
pub async fn select(&self, dir: &Path) -> Result<CurrentWorkspace>
Make the workspace at dir current. Sync is on for it when it has a sync id.
Sourcepub async fn init(&self, dir: &Path) -> Result<WorkspaceInitResult>
pub async fn init(&self, dir: &Path) -> Result<WorkspaceInitResult>
Create this app’s workspace at dir — the marker and the marker registry’s entry,
idempotently — and make it current.
Sourcepub async fn map(&self, selector: &str, dir: &Path) -> Result<GrainId>
pub async fn map(&self, selector: &str, dir: &Path) -> Result<GrainId>
Place the workgroup workspace selector at dir, make it current and sync it.
Sourcepub async fn relocate(&self, dir: &Path) -> Result<CurrentWorkspace>
pub async fn relocate(&self, dir: &Path) -> Result<CurrentWorkspace>
Move the current workspace’s folder to dir, which must not exist yet, and keep
serving it from there, syncing as before.
The replica’s state moves with it, so sync carries on as the same replica rather than meeting its own files as strangers. The search index does not — it records absolute paths — and is rebuilt in the background.
Sourcepub async fn remove(&self, delete: bool) -> Result<()>
pub async fn remove(&self, delete: bool) -> Result<()>
Stop serving the current workspace; with delete, delete its folder and its cache
too. Sync stops for this host only: the workgroup and the other devices keep it.
Sourcepub async fn enable_sync(&self) -> Result<GrainId>
pub async fn enable_sync(&self) -> Result<GrainId>
Start syncing the current workspace, and remember that.
Sourcepub async fn disable_sync(&self) -> Result<()>
pub async fn disable_sync(&self) -> Result<()>
Stop syncing the current workspace, and remember that.
Sourcepub async fn status(&self) -> SyncStatusResult
pub async fn status(&self) -> SyncStatusResult
The current workspace’s sync state; not synced when there is none.
Sourcepub async fn describe(&self) -> Option<CurrentWorkspace>
pub async fn describe(&self) -> Option<CurrentWorkspace>
The current workspace as workspace.current reports it.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Current
impl !RefUnwindSafe for Current
impl !UnwindSafe for Current
impl Send for Current
impl Sync for Current
impl Unpin for Current
impl UnsafeUnpin for Current
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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