Skip to main content

Crate sapphire_sync_server

Crate sapphire_sync_server 

Source
Expand description

sapphire-sync’s app server: what sapphire-sync serve runs, in either edition. A library, not a binary of its own: the server is set up with the same sapphire-sync command that runs it (sapphire-sync-cli), so there is no separate server command to tell from the client’s.

Two builders, bridge-less for one-shot verbs and sync-mounted for serve, because the bridge connection belongs to the serve path only (the review of 0acb194 ruled the one-shot verbs bridge-less):

  • build_oneshot hands every one-shot framework verb that needs a server (service, update) a bare AppServer — dispatch needs only the app name and the service spec, and a CLI invocation must not open a bridge or fail with a bridge error. A status on a host without a server answers the framework’s “no sapphire-sync server is running” and exits 1; a workspace init likewise reports the absent server. Neither touches the bridge.
  • build_serve additionally mounts a SyncRuntime that reaches the bridge itself (the daemon is always service-managed) with AppServer::sync, plus the app’s own status rows with AppServer::status_rows: one row per synced workspace, rendered per report from the live runtime. The runtime is connect-only — nothing starts a bridge on demand (the framework’s global constraint) — and the framework connects when the server runs, and again whenever the bridge restarts (sapphire-framework#244). serve on a host whose bridge is not running yet serves without sync until it is; meanwhile sync.* answers “not connected to sapphire-bridge”. A bridge of another API version still stops the start. serve calls it once per round of serve_restarting, so a server.restart gets a fresh runtime.

The IPC endpoint, the stop channel and the signals are run()’s business in both paths; the app installs nothing there.

ManagedBy is the transport’s, which SyncRuntime takes.

Enums§

Edition
Which edition runs the server: the release file update installs is the edition’s own.

Constants§

VERSION
The version the server reports, and the command line’s clients name: the editions and this library share it (release-plz.toml).

Functions§

build_oneshot
The app’s server for one-shot verbs: an AppServer with nothing mounted.
build_serve
The app’s embedded server: sync runtime, AppServer.
status_rows
The status rows the app’s server reports, for the framework’s AppServer::status_rows.