GlobalConfigPatch
load()
save()
GlobalConfig
Resolved settings after layering. UseLocalContext::config() to read the effective configuration for a backend.
LocalContext
config()
Runtime paths
Inspect the active config and resolve runtime paths with the same precedence used by sandbox startup:Example
Example
Example
Example
LocalContext has two plain constructors alongside the builder. LocalContext::lazy()? is synchronous and defers opening (and migrating) the local sandbox database until the first operation; it is what backend resolution uses when no backend is set explicitly. LocalContext::new().await? opens the database up front, so startup fails fast if the database is unusable. All constructors read, layer, and validate global configuration before returning a backend; only database setup is lazy. Proxy settings are validated after sandbox options and managed overrides are composed, before network use.
LocalContextBuilder::build() now returns Result<LocalContext>. It replaces try_build(), and LocalContext no longer implements Default; use LocalContext::lazy()? instead.
For a long-lived process, construct a new context to pick up configuration changes. Bind subsequent work with Sandbox::ctx(&context) or the context’s collections. Existing collections, builders and resources retain their original destination and settings.
LocalContextBuilder
config_path()
MSB_CONFIG_PATH. Managed settings still apply. The builder’s home() selects data storage; it does not select the configuration file. Backend-selection helpers and synchronous constructors remain synchronous.
Example
Example
deployment_profile()
ssh_inactivity_timeout_secs()
Sandbox configuration patches
UseSandboxBuilder::overlay() to override individual settings or explicitly clear an inherited working directory. These choices survive SandboxBuilder::from(config) and local database reloads. Without saved caller overrides, workdir: None still means omitted.
Edit settings through builder setters, overlay(), or sandbox modification APIs; saved overrides can overwrite direct edits to a resolved SandboxConfig. See configuration layering for precedence and backend differences.
Context
sandboxes(), volumes(), snapshots()
Example
Example
clone_shared()
LocalContext clones share configuration, database initialization and control state. RemoteContext clones share their HTTP client and captured configuration. Context binding accepts &dyn Context; callers do not need to allocate an Arc themselves.
Resource and builder context()
Sandbox, Volume, Snapshot and their builders expose their connection through this synchronous accessor. It returns the existing connection without allocating or contacting the backend. Use it to select another collection on the same destination.
RemoteContext
new() / with_url()
new(api_key) uses MSB_API_URL or the hosted endpoint. Use with_url(url, api_key) to specify both.
builder()
build() validates and captures its settings. Resource requests happen through its collections or Resource::ctx(&context).
Example
Example
to_builder()
Example
Example
RemoteContextBuilder
compute_type()
Standard or Shared for new sandboxes and snapshot restores. Omission uses the server default. Existing sandboxes keep their type. See compute types.
Example
Example