Skip to main content

Crate watasu

Crate watasu 

Source
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§

BuildInfo
Information returned when a template build starts.
BuildStatusReason
Reason for a build status, usually populated for errors.
CommandExit
Non-zero command exit information.
CommandHandle
Live handle for one sandbox process stream.
CommandOptions
Options for starting a sandbox command.
CommandResult
Completed command output.
Commands
Command runner for a sandbox data-plane session.
ConnectionConfig
Resolved connection settings used by control-plane and data-plane clients.
ConnectionOptions
Optional connection overrides accepted by SDK entrypoints.
CreateOptions
Options for Sandbox::create.
CreateSnapshotOptions
Options for creating a Watasu checkpoint.
EntryInfo
Metadata for one sandbox filesystem entry.
FileReadOptions
Options for bounded file reads.
FileUrlInfo
Signed file URL metadata.
FileUrlOptions
Options for signed file URL creation.
Filesystem
Filesystem helper for a sandbox data-plane session.
FilesystemEvent
Filesystem event returned by a watch stream.
Git
Git helper backed by sandbox data-plane routes.
GitAddOptions
Options for staging files.
GitBranches
Branch list returned by Git::branches.
GitCloneOptions
Options for Git clone.
GitCommandResult
Result returned by a sandbox Git command.
GitCommitOptions
Options for committing files.
GitConfigOptions
Options for Git config operations.
GitConfigureUserOptions
Options for configuring Git user identity.
GitCredentialOptions
Options for Git credentials stored in the sandbox credential helper.
GitDeleteBranchOptions
Options for deleting a Git branch.
GitFileStatus
Parsed status entry for one repository file.
GitInitOptions
Options for initializing a Git repository.
GitRemoteAddOptions
Options for adding a Git remote.
GitRemoteOperationOptions
Options for pulling or pushing.
GitRequestOptions
Options shared by Git repository operations.
GitResetOptions
Options for resetting Git state.
GitRestoreOptions
Options for restoring Git paths.
GitStatus
Parsed repository status.
ListOptions
Options for Sandbox::list.
LogEntry
Build log entry.
NetworkUpdateOptions
Options for atomically replacing a sandbox network policy.
ProcessInfo
Metadata for one sandbox process.
ProcessResult
Completed typed process output with byte-preserving captured output.
ProcessRunOptions
Options for running a typed sandbox process with bounded output capture.
ProcessSocket
Streaming WebSocket connection to the sandbox process runtime.
ProcessStartOptions
Options for starting a typed sandbox process.
Pty
PTY helper backed by the sandbox process WebSocket runtime.
PtyCreateOptions
Options for creating a PTY.
PtySize
PTY terminal size.
RestoreOptions
Options for restoring a checkpoint.
Sandbox
Running Watasu sandbox with ready commands and files helpers.
SandboxInfo
Control-plane metadata for a sandbox.
SandboxInfoLifecycle
Timeout lifecycle policy returned by sandbox info.
SandboxLifecycle
Timeout lifecycle policy used when creating a sandbox.
SandboxListPage
One page of sandbox list results.
SandboxListQuery
Query filters for listing sandboxes.
SandboxMetrics
Runtime metrics returned for a sandbox.
SandboxTemplateCreateOptions
Options for creating a sandbox template through /sandbox_templates.
SandboxTemplateInfo
Sandbox template metadata returned by /sandbox_templates.
SandboxTemplateRuntimeBaseline
Runtime baseline for a sandbox template version.
SandboxTemplateVersionBuildLogs
Build logs for a sandbox template version.
SandboxTemplateVersionCreateOptions
Options for creating a sandbox template version.
SandboxTemplateVersionInfo
Sandbox template version metadata returned by /sandbox_templates/:id/versions.
SnapshotInfo
Watasu checkpoint metadata exposed with snapshot naming.
SnapshotListOptions
Options for listing snapshots.
SnapshotListPage
One page of snapshot list results.
Template
Template build API.
TemplateBuildOptions
Options for starting a template build.
TemplateBuildStatusOptions
Options for querying build status.
TemplateBuildStatusResponse
Response from querying template build status.
TemplateBuilder
Chainable package-spec template builder.
TemplateTag
A single template tag.
TemplateTagInfo
Information about assigned tags.
Volume
Persistent volume that can be mounted into sandboxes and edited while detached.
VolumeCreateOptions
Options for creating a persistent volume.
VolumeEntryStat
File or directory metadata returned by volume content operations.
VolumeInfo
Control-plane metadata for a persistent Watasu volume.
VolumeListOptions
Options for listing persistent volumes.
VolumeMount
A persistent volume mounted at a guest path when a sandbox starts.
VolumeWriteOptions
Options for writing a file or creating a directory in a detached volume.
WatchHandle
Live filesystem watch stream.
WatchOptions
Options for Filesystem::watch_dir.
WriteEntry
File path and bytes used by Filesystem::write_files.

Enums§

Error
Error type returned by Watasu SDK operations.
FileType
File type returned by sandbox filesystem metadata.
TemplateBuildStatus
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.

Type Aliases§

Result
SDK result type.
WriteInfo
Metadata returned by write operations.