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§

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.
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.
ProcessInfo
Metadata for one sandbox process.
ProcessSocket
Streaming WebSocket connection to the sandbox process runtime.
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.
SandboxMetrics
Runtime metrics returned for a sandbox.
SnapshotInfo
Watasu checkpoint metadata exposed with snapshot naming.
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.

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.
encode_runtime_data
Encode stdin bytes for the sandbox runtime protocol.

Type Aliases§

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