Expand description
Rust SDK for Watasu.
The crate exposes a small async API for creating sandboxes, running
commands, and reading/writing files. Sandbox::create and
Sandbox::connect return only after the Watasu API has supplied a usable
data-plane session, so callers do not need to poll sandbox readiness.
use watasu::{CreateOptions, Sandbox};
let sandbox = Sandbox::create(CreateOptions::default()).await?;
sandbox.files.write("/home/user/a.py", "print(2 + 2)").await?;
let result = sandbox.commands.run("python /home/user/a.py").await?;
assert_eq!(result.stdout.trim(), "4");
sandbox.kill().await?;Structs§
- Build
Info - Information returned when a template build starts.
- Build
Status Reason - Reason for a build status, usually populated for errors.
- Command
Exit - Non-zero command exit information.
- Command
Handle - Live handle for one sandbox process stream.
- Command
Options - Options for starting a sandbox command.
- Command
Result - Completed command output.
- Commands
- Command runner for a sandbox data-plane session.
- Connection
Config - Resolved connection settings used by control-plane and data-plane clients.
- Connection
Options - Optional connection overrides accepted by SDK entrypoints.
- Create
Options - Options for
Sandbox::create. - Create
Snapshot Options - Options for creating a Watasu checkpoint.
- Entry
Info - Metadata for one sandbox filesystem entry.
- File
Read Options - Options for bounded file reads.
- File
UrlInfo - Signed file URL metadata.
- File
UrlOptions - Options for signed file URL creation.
- Filesystem
- Filesystem helper for a sandbox data-plane session.
- Filesystem
Event - Filesystem event returned by a watch stream.
- Git
- Git helper backed by sandbox data-plane routes.
- GitAdd
Options - Options for staging files.
- GitBranches
- Branch list returned by
Git::branches. - GitClone
Options - Options for Git clone.
- GitCommand
Result - Result returned by a sandbox Git command.
- GitCommit
Options - Options for committing files.
- GitConfig
Options - Options for Git config operations.
- GitConfigure
User Options - Options for configuring Git user identity.
- GitCredential
Options - Options for Git credentials stored in the sandbox credential helper.
- GitDelete
Branch Options - Options for deleting a Git branch.
- GitFile
Status - Parsed status entry for one repository file.
- GitInit
Options - Options for initializing a Git repository.
- GitRemote
AddOptions - Options for adding a Git remote.
- GitRemote
Operation Options - Options for pulling or pushing.
- GitRequest
Options - Options shared by Git repository operations.
- GitReset
Options - Options for resetting Git state.
- GitRestore
Options - Options for restoring Git paths.
- GitStatus
- Parsed repository status.
- List
Options - Options for
Sandbox::list. - LogEntry
- Build log entry.
- Network
Update Options - Options for atomically replacing a sandbox network policy.
- Process
Info - Metadata for one sandbox process.
- Process
Result - Completed typed process output with byte-preserving captured output.
- Process
RunOptions - Options for running a typed sandbox process with bounded output capture.
- Process
Socket - Streaming WebSocket connection to the sandbox process runtime.
- Process
Start Options - Options for starting a typed sandbox process.
- Pty
- PTY helper backed by the sandbox process WebSocket runtime.
- PtyCreate
Options - Options for creating a PTY.
- PtySize
- PTY terminal size.
- Restore
Options - Options for restoring a checkpoint.
- Sandbox
- Running Watasu sandbox with ready
commandsandfileshelpers. - Sandbox
Info - Control-plane metadata for a sandbox.
- Sandbox
Info Lifecycle - Timeout lifecycle policy returned by sandbox info.
- Sandbox
Lifecycle - Timeout lifecycle policy used when creating a sandbox.
- Sandbox
List Page - One page of sandbox list results.
- Sandbox
List Query - Query filters for listing sandboxes.
- Sandbox
Metrics - Runtime metrics returned for a sandbox.
- Sandbox
Template Create Options - Options for creating a sandbox template through
/sandbox_templates. - Sandbox
Template Info - Sandbox template metadata returned by
/sandbox_templates. - Sandbox
Template Runtime Baseline - Runtime baseline for a sandbox template version.
- Sandbox
Template Version Build Logs - Build logs for a sandbox template version.
- Sandbox
Template Version Create Options - Options for creating a sandbox template version.
- Sandbox
Template Version Info - Sandbox template version metadata returned by
/sandbox_templates/:id/versions. - Snapshot
Info - Watasu checkpoint metadata exposed with snapshot naming.
- Snapshot
List Options - Options for listing snapshots.
- Snapshot
List Page - One page of snapshot list results.
- Template
- Template build API.
- Template
Build Options - Options for starting a template build.
- Template
Build Status Options - Options for querying build status.
- Template
Build Status Response - Response from querying template build status.
- Template
Builder - Chainable package-spec template builder.
- Template
Tag - A single template tag.
- Template
TagInfo - Information about assigned tags.
- Volume
- Persistent volume that can be mounted into sandboxes and edited while detached.
- Volume
Create Options - Options for creating a persistent volume.
- Volume
Entry Stat - File or directory metadata returned by volume content operations.
- Volume
Info - Control-plane metadata for a persistent Watasu volume.
- Volume
List Options - Options for listing persistent volumes.
- Volume
Mount - A persistent volume mounted at a guest path when a sandbox starts.
- Volume
Write Options - Options for writing a file or creating a directory in a detached volume.
- Watch
Handle - Live filesystem watch stream.
- Watch
Options - Options for
Filesystem::watch_dir. - Write
Entry - File path and bytes used by
Filesystem::write_files.
Enums§
- Error
- Error type returned by Watasu SDK operations.
- File
Type - File type returned by sandbox filesystem metadata.
- Template
Build Status - Template build status.
Constants§
- KEEPALIVE_
PING_ INTERVAL_ SECS - WebSocket keepalive interval used by command streams.
Functions§
- decode_
runtime_ data - Decode base64 stdout/stderr frame data from the sandbox runtime protocol as UTF-8 text.
- decode_
runtime_ data_ bytes - Decode base64 stdout/stderr frame data from the sandbox runtime protocol as bytes.
- encode_
runtime_ data - Encode stdin bytes for the sandbox runtime protocol.