Skip to main content

Module workspace_sync

Module workspace_sync 

Expand description

Whether the workspace an app’s window is in has synced with its host, as the shell tells the app (crate::floating_surface::FloatingSurfaceHostMessage::Appearance).

An empty workspace and a workspace this device has not reached yet look the same to an app: no content. Saying “Nothing has been said here yet” about a workspace that never synced is a lie the person acts on. So until the workspace’s first sync completes, every empty state the framework paints (crate::widget::EmptyState) says what is really going on instead: “Connecting to {workspace}…” with a spinner while this device is reaching the workspace’s host; that the host cannot be reached, once a try failed; or that the workspace’s host (or this device) has to update before anything syncs. While the host cannot be reached the person works on what this device has, and the empty state keeps the app’s own action: their changes stay here and sync once the host is reached. An app’s own empty state shows only once the workspace has synced, or in a window whose workspace syncs with no host at all (the shell says nothing then).

What the workspace holds is also a read (holdings): a view over a record this device has not got yet shows it arriving from the workspace’s host until the workspace’s first sync, and the record (or that there is none) once it completed.

Structs§

WorkspaceSync
The workspace a window is in, and where it stands with its host.

Enums§

WorkspaceSyncState
Where this device stands with the host of the workspace a window is in.
WorkspaceUnreachable
Why what the workspace holds cannot arrive: nothing syncs until one side updates.

Functions§

before_first_sync
Whether the window’s workspace has not synced yet: its content may be missing, not absent.
current
What the shell last said about this window’s workspace.
follow_participation
Let permissions, a workspace launch’s, follow the workspace’s grants: when the shell says the app may write the workspace now, or may not any more, they become an author’s or a viewer’s at once (WorkspaceSync::writable).
holdings
What the workspace this window is in holds, as a read: pending (from this device, briefly) until the shell hosting the window said where the workspace stands, then from the workspace’s host until the workspace’s first sync completed; failed while one side has to update first; ready once it synced, in a workspace with no host, or while its host cannot be reached (the person works on what this device has). A record this device lacks once it is ready is one the workspace does not have. Every call shares one read.
hosted_by_shell
A shell hosts this window: what its workspace holds waits for the shell to say where the workspace stands. A window no shell hosts holds what this device has.
set
What the shell says now about the workspace this app’s window is in; None: the window’s workspace syncs with no host (or the shell said nothing). Answers whether that changed what the app shows.
shell_lost
The shell hosting this window went away. A shell says where the workspace stands in its first message to a window (every shell does: the app and the shell speak one shell-ui version, or do not connect), so a window still waiting for that word never gets it: what the workspace holds cannot arrive, and the window says so (WorkspaceUnreachable::ShellGone). Whether that changed what the window shows.
source
Where what this window’s workspace holds and this device lacks comes from: the workspace’s host, by the workspace’s name, when the workspace has one; otherwise the workspace’s other devices, which no one names here.
unsynced_status
What the window says while this device holds writes to its workspace that are not yet synced (WorkspaceSync::unsynced_writes), or cannot keep them on disk (WorkspaceSync::cannot_keep_writes); None while neither.