cua-spacesd-client
The async cua-spacesd client crate (native gRPC or gRPC-Web).
The async cua-spacesd client crate (native gRPC or gRPC-Web).
Public API of the cua-spacesd-client crate (cua_spacesd_client). Summaries and declarations only (cargo doc -p cua-spacesd-client --open in libs/cua has the full comments); see Rust crates for stability.
Ergonomic async client for cua-spacesd (cua.env.v1).
diagnose: SystemService.Diagnose: client calls, and the ...error: Typed errors.expect: --expect COMPONENT=WANT: fail a doctor report unless ...manifest: /etc/cua-image/manifest.json: what an image claims.transport: Channel construction: native gRPC (HTTP/2, h2c or TLS) ...tunnel: Client side of TunnelService.Forward: a loopback TCP ...BearerProvider#Supplies the Fleet gateway bearer (for example ...
pub trait BearerProvider: Send + Sync {
fn bearer(&self, force_refresh: bool) -> Pin<Box<dyn Future<Output = Result<String, BoxError>> + Send + '_>>;
fn extra_headers(&self) -> Pin<Box<dyn Future<Output = Result<ExtraHeaders, BoxError>> + Send + '_>>;
}ChannelError#Transport-level failure of a GrpcChannel call.
pub struct ChannelError(pub BoxError);Command#A command to run.
pub struct Command {
pub program: String,
pub args: Vec<String>,
pub env: BTreeMap<String, String>,
pub cwd: Option<String>,
pub user: Option<String>,
pub timeout: Option<Duration>,
pub tag: Option<String>,
pub stdin: bool,
pub pty: Option<(u32, u32)>,
pub scrollback_bytes: u64,
pub kill_on_disconnect: bool,
pub keepalive: Option<Duration>,
}
impl Command {
fn new(program: impl Into<String>) -> Self;
fn shell(line: impl Into<String>) -> Self;
fn arg(self, a: impl Into<String>) -> Self;
fn args<I, S>(self, args: I) -> Self where I: IntoIterator<Item = S>, S: Into<String>;
fn env(self, k: impl Into<String>, v: impl Into<String>) -> Self;
fn cwd(self, cwd: impl Into<String>) -> Self;
fn user(self, user: impl Into<String>) -> Self;
fn timeout(self, t: Duration) -> Self;
fn tag(self, tag: impl Into<String>) -> Self;
fn stdin(self, on: bool) -> Self;
fn pty(self, cols: u32, rows: u32) -> Self;
fn keepalive(self, interval: Duration) -> Self;
fn scrollback(self, bytes: u64) -> Self;
}ConnectOptions#Options for SpacesdClient::connect.
pub struct ConnectOptions {
pub endpoint: Endpoint,
pub token: Option<String>,
pub principal: Option<Principal>,
pub transport: TransportPreference,
pub gateway: Option<GatewayAuth>,
pub connect_timeout: Duration,
pub probe_timeout: Duration,
pub keepalive: Keepalive,
pub retry: RetryPolicy,
pub probe: bool,
}
impl ConnectOptions {
fn new(endpoint: Endpoint) -> Self;
fn parse(endpoint: &str) -> Result<Self>;
fn token(self, token: impl Into<String>) -> Self;
fn principal(self, principal: Principal) -> Self;
fn transport(self, transport: TransportPreference) -> Self;
fn fleet_gateway(self, bearer: Arc<dyn BearerProvider>, claim: Option<String>) -> Self;
fn retry(self, retry: RetryPolicy) -> Self;
fn keepalive(self, keepalive: Keepalive) -> Self;
fn probe_timeout(self, timeout: Duration) -> Self;
fn probe(self, probe: bool) -> Self;
}DesktopReadiness#Desktop readiness, from SpacesdClie ...
pub struct DesktopReadiness {
pub ready: bool,
pub detail: String,
pub reported: bool,
}diagnose::Artifact#Evidence produced by a check.
pub struct Artifact {
pub name: String,
pub media_type: String,
pub data: Vec<u8>,
pub path: String,
}diagnose::Check#The result of one check.
pub struct Check {
pub id: String,
pub group: String,
pub status: Status,
pub severity: Severity,
pub claimed_by: Vec<String>,
pub message: String,
pub remediation: String,
pub duration_ms: u32,
pub facts: BTreeMap<String, String>,
pub artifacts: Vec<Artifact>,
}
impl Check {
fn new(id: impl Into<String>, status: Status, message: impl Into<String>) -> Self;
fn fact(self, key: impl Into<String>, value: impl ToString) -> Self;
fn fix(self, remediation: impl Into<String>) -> Self;
fn skip_reason(self, reason: &str) -> Self;
fn to_pb(&self) -> DiagnoseCheck;
}diagnose::Effects#Which checks may act on the guest.
pub enum Effects {
None,
VirtualOnly,
}
impl Effects {
fn parse(value: &str) -> Option<Self>;
fn to_pb(self) -> DiagnoseEffects;
fn from_pb(value: i32) -> Self;
}diagnose::Environment#Where the guest runs.
pub struct Environment {
pub runtime: String,
pub runtime_detail: String,
pub arch: String,
pub init: String,
pub display_server: String,
pub os: String,
}diagnose::Fidelity#Facts that change task behaviour between variants.
pub struct Fidelity {
pub display: String,
pub fonts_sha256: String,
pub tz: String,
pub locale: String,
pub clock_skew_ms: i64,
pub encoder: String,
pub a11y_backend: String,
pub audio_backend: String,
pub cpu_model: String,
pub cpu_count: u32,
pub memory_mib: u64,
pub gpu: String,
pub kernel: String,
pub runtime: String,
pub init: String,
pub packages_sha256: String,
pub app_versions: BTreeMap<String, String>,
pub tool_versions: BTreeMap<String, String>,
pub simulator_runtimes: Vec<String>,
}
impl Fidelity {
fn flatten(&self) -> BTreeMap<String, String>;
}diagnose::Image#The image under test.
pub struct Image {
pub name: String,
pub reference: String,
pub variant: String,
pub os: String,
pub manifest_sha256: String,
pub manifest_source: String,
}diagnose::Report#A whole report, JSON schema version 1.
pub struct Report {
pub schema_version: u32,
pub producer: String,
pub started_at: Option<Timestamp>,
pub spacesd: Option<Spacesd>,
pub image: Image,
pub environment: Environment,
pub summary: Summary,
pub checks: Vec<Check>,
pub fidelity: Fidelity,
}
impl Report {
fn from_json(text: &str) -> Result<Self, String>;
fn to_json(&self) -> String;
fn from_pb(report: DiagnoseReport) -> Self;
fn to_pb(&self) -> DiagnoseReport;
fn finalize(&mut self, strict: bool, duration: Duration);
fn exit_code(&self) -> i32;
fn to_human(&self) -> String;
fn to_junit(&self) -> String;
}diagnose::Severity#How much a check matters for the image, from its ...
pub enum Severity {
Required,
Recommended,
Info,
}
impl Severity {
fn as_str(self) -> &'static str;
}diagnose::Spacesd#The daemon that ran the checks.
pub struct Spacesd {
pub version: String,
pub protocol_revision: u32,
pub git_sha: String,
pub cua_driver_version: String,
}diagnose::Status#Outcome of one check.
pub enum Status {
Pass,
Warn,
Fail,
Skip,
}
impl Status {
fn as_str(self) -> &'static str;
}diagnose::Summary#Totals.
pub struct Summary {
pub status: Status,
pub pass: u32,
pub warn: u32,
pub fail: u32,
pub skip: u32,
pub duration_ms: u32,
pub strict: bool,
}DownloadOptions#Download options.
pub struct DownloadOptions {
pub offset: u64,
pub length: u64,
pub chunk_size: u32,
pub progress: Option<Arc<AtomicU64>>,
}DownloadResult#Result of a download to a sink.
pub struct DownloadResult {
pub size: u64,
pub sha256: String,
pub resumes: u32,
}DownloadSink#Destination of a download.
pub trait DownloadSink: Send {
fn write(&mut self, chunk: Bytes) -> impl Future<Output = Result<()>> + Send;
}Endpoint#A parsed spacesd endpoint: an absolute base URL ...
pub struct Endpoint { /* private fields */ }
impl Endpoint {
fn parse(input: &str) -> Result<Self>;
fn fleet_service(fleet_base_url: &str, namespace: &str, sandbox: &str, service: &str) -> Result<Self>;
fn base_url(&self) -> &Url;
fn kind(&self) -> &EndpointKind;
fn path_prefix(&self) -> &str;
fn is_tls(&self) -> bool;
fn host(&self) -> &str;
fn port(&self) -> u16;
fn origin(&self) -> String;
fn http_url(&self, path: &str) -> String;
fn ws_url(&self, path: &str) -> String;
}EndpointKind#How the endpoint is reached.
pub enum EndpointKind {
Direct,
FleetGateway { namespace: String, service: String },
Relay { machine_id: String },
}Error#Every error the env client can return.
pub enum Error {
InvalidEndpoint(String),
Transport(String),
SpacesdNotAvailable { endpoint: String, reason: String },
Unauthenticated(ErrorDetails),
FeatureUnsupported { feature: String, details: ErrorDetails },
PermissionDenied(ErrorDetails),
StaleHandle(ErrorDetails),
StaleGeometry(ErrorDetails),
StaleSnapshot(ErrorDetails),
WouldRequireActivation(ErrorDetails),
TargetUnavailable(ErrorDetails),
DeliveryFailed(ErrorDetails),
ProcessNotFound(ErrorDetails),
PathNotFound(ErrorDetails),
PathExists(ErrorDetails),
NotADirectory(ErrorDetails),
IsADirectory(ErrorDetails),
DiskFull(ErrorDetails),
ChecksumMismatch { expected: String, actual: String },
SessionNotFound(ErrorDetails),
OffsetMismatch { expected_offset: Option<u64>, details: ErrorDetails },
SequenceGap { expected_sequence: Option<u64>, details: ErrorDetails },
RateLimited { retry_after: Option<Duration>, details: ErrorDetails },
LimitExceeded(ErrorDetails),
NotInitialized(ErrorDetails),
Internal(ErrorDetails),
Rpc(ErrorDetails),
Timeout(Duration),
DesktopNotReady(String),
Protocol(String),
Io(Error),
}
impl Error {
fn code(&self) -> Option<Code>;
fn details(&self) -> Option<&ErrorDetails>;
fn is_retryable(&self) -> bool;
}error::RpcStatus#google.rpc.Status (the payload of ...
pub struct RpcStatus {
pub code: i32,
pub message: String,
pub details: Vec<Any>,
}ErrorDetails#Context shared by every RPC error variant.
pub struct ErrorDetails {
pub code: i32,
pub message: String,
pub metadata: HashMap<String, String>,
}ExitStatus#How a process ended.
pub struct ExitStatus {
pub code: Option<i32>,
pub signal: Option<Signal>,
pub timed_out: bool,
pub error: Option<String>,
}
impl ExitStatus {
fn success(&self) -> bool;
}expect::Expectation#One COMPONENT=WANT.
pub struct Expectation {
pub component: String,
pub want: Want,
}expect::Instance#One running build of a component, as the guest reported ...
pub struct Instance {
pub label: String,
pub version: String,
pub git_sha: String,
pub exe_sha256: String,
}expect::Want#What to compare.
pub enum Want {
Sha256(String),
Git(String),
Version(String),
}ForwardOptions#Options for SpacesdClient::forward_tcp.
pub struct ForwardOptions {
pub port: u16,
pub host: String,
pub bind: SocketAddr,
pub ttl: Option<Duration>,
pub max_connections: usize,
}
impl ForwardOptions {
fn new(port: u16) -> Self;
fn bind(self, bind: SocketAddr) -> Self;
}ForwardStats#Counters of a TcpForward.
pub struct ForwardStats {
pub connections: AtomicU64,
pub active: AtomicU64,
pub bytes_to_guest: AtomicU64,
pub bytes_from_guest: AtomicU64,
pub failed: AtomicU64,
}GatewayAuth#Fleet gateway credentials: the gateway bearer and the ...
pub struct GatewayAuth {
pub bearer: Arc<dyn BearerProvider>,
pub claim: Option<String>,
}HttpCall#One HTTP request to the spacesd.
pub struct HttpCall {
pub method: String,
pub path: String,
pub headers: Vec<(String, String)>,
pub body: Vec<u8>,
pub timeout: Option<Duration>,
pub max_response_bytes: Option<usize>,
}HttpReply#The spacesd's answer.
pub struct HttpReply {
pub status: u16,
pub headers: Vec<(String, String)>,
pub body: Vec<u8>,
}Keepalive#Connection-level keepalive settings.
pub struct Keepalive {
pub interval: Duration,
pub timeout: Duration,
}KeySpec#A key: named ("enter", "KEY_ENTER" ...
pub enum KeySpec {
Named(Key),
Char(String),
}
impl KeySpec {
fn parse(name: &str) -> Result<Self>;
}manifest::AudioClaim#Audio plumbing.
pub struct AudioClaim {
pub server: String,
pub default_sink: String,
pub default_source: String,
pub uplink_input_sink: String,
}manifest::CompatLink#A compatibility alias.
pub struct CompatLink {
pub path: String,
pub target: String,
pub unit_alias: String,
pub unit: String,
}manifest::DisplayClaim#The desktop session.
pub struct DisplayClaim {
pub name: String,
pub resolution: String,
pub user: String,
}
impl DisplayClaim {
fn size(&self) -> Option<(u32, u32)>;
}manifest::Fixtures#Conformance fixtures shipped in the image.
pub struct Fixtures {
pub root: String,
pub apps: Vec<String>,
}
impl Fixtures {
fn has(&self, name: &str) -> bool;
}manifest::LaunchApp#The app LaunchApp must start.
pub struct LaunchApp {
pub app: String,
pub args: Vec<String>,
pub window_match: String,
pub timeout_s: u32,
pub limits: Vec<LaunchAppLimit>,
}
impl LaunchApp {
fn limit_for(&self, runtime: &str, arch: &str) -> Option<&LaunchAppLimit>;
}manifest::LaunchAppLimit#A runtime and architecture where LaunchApp::app ...
pub struct LaunchAppLimit {
pub runtime: String,
pub arch: String,
pub reason: String,
pub instead: Option<Box<LaunchApp>>,
}manifest::Loaded#A loaded manifest with its provenance.
pub struct Loaded {
pub manifest: Manifest,
pub source: String,
pub sha256: String,
pub error: Option<String>,
}
impl Loaded {
fn present(&self) -> bool;
fn parse(bytes: &[u8], source: &str) -> Self;
fn read(path: &Path) -> Self;
fn severity(&self, claims: &[&str]) -> Severity;
}manifest::Manifest#The image's claims.
pub struct Manifest {
pub schema_version: u32,
pub name: String,
pub aliases: Vec<String>,
pub os: String,
pub variant: String,
pub init: String,
pub arch: String,
pub reference: String,
pub source_revision: String,
pub annotations: BTreeMap<String, String>,
pub spacesd: SpacesdClaim,
pub features_required: Vec<String>,
pub features_optional: Vec<String>,
pub feature_attributes: BTreeMap<String, BTreeMap<String, String>>,
pub codecs_required: Vec<String>,
pub auth_modes: Vec<String>,
pub services: Vec<ServiceClaim>,
pub units: Vec<String>,
pub unit_processes: BTreeMap<String, String>,
pub display: DisplayClaim,
pub fixtures: Fixtures,
pub audio: AudioClaim,
pub compat_links: Vec<CompatLink>,
pub tier: String,
pub apps: BTreeMap<String, SoftwareClaim>,
pub tools: BTreeMap<String, SoftwareClaim>,
pub simulator_runtimes: Vec<String>,
pub launch_app: Option<LaunchApp>,
pub parity: Parity,
pub resources: Resources,
pub tz: String,
pub locale: String,
pub dns_probe: String,
pub av_skew_budget_ms: BTreeMap<String, u32>,
}
impl Manifest {
fn is_named(&self, name: &str) -> bool;
fn requires(&self, feature: &str) -> bool;
fn allows(&self, feature: &str) -> bool;
fn lists(&self, feature: &str) -> bool;
fn av_skew_budget(&self, runtime: &str) -> u32;
}manifest::Parity#Parity settings.
pub struct Parity {
pub expected_diff: Vec<String>,
}manifest::Resources#Resource floors.
pub struct Resources {
pub min_disk_gib: f64,
pub min_shm_mib: u64,
pub min_memory_mib: u64,
}manifest::ServiceClaim#A network service the image serves.
pub struct ServiceClaim {
pub name: String,
pub port: u16,
pub protocol: String,
pub component: String,
pub readiness: String,
}manifest::SoftwareClaim#A claimed app or tool: its version command, as a bare ...
pub enum SoftwareClaim {
Argv(Vec<String>),
Spec { argv: Vec<String>, expect: String },
}
impl SoftwareClaim {
fn argv(&self) -> &[String];
fn expect(&self) -> &str;
}manifest::SpacesdClaim#The baked cua-spacesd, from cua-spacesd build-info at ...
pub struct SpacesdClaim {
pub present: bool,
pub source: String,
pub path: String,
pub version: String,
pub protocol_revision: u32,
pub git_sha: String,
pub cua_driver_version: String,
pub tools_sha256: String,
pub tools_count: u32,
pub codecs_compiled: Vec<String>,
}MediaOptions#Options for SpacesdClient::open_media.
pub struct MediaOptions {
pub display: Option<String>,
pub window: Option<WindowRef>,
pub codecs: Vec<MediaCodec>,
pub max_fps: u32,
pub max_dimension: u32,
pub ticket_ttl: Option<Duration>,
pub prefer_quic: bool,
pub audio: Option<AudioOptions>,
pub disable_video: bool,
}MediaSession#A media session ready for the rcdp wire.
pub struct MediaSession {
pub session_id: String,
pub ticket: String,
pub ws_url: String,
pub raw: OpenMediaResponse,
}Output#Collected result of SpacesdClient::run.
pub struct Output {
pub status: ExitStatus,
pub stdout: Vec<u8>,
pub stderr: Vec<u8>,
pub pty: Vec<u8>,
}
impl Output {
fn success(&self) -> bool;
fn stdout_str(&self) -> String;
fn stderr_str(&self) -> String;
}ProcessEvent#One output chunk or the exit.
pub enum ProcessEvent {
Stdout { offset: u64, data: Bytes },
Stderr { offset: u64, data: Bytes },
Pty { offset: u64, data: Bytes },
Exit(ExitStatus),
}ProcessHandle#A running (or exited) guest process.
pub struct ProcessHandle { /* private fields */ }
impl ProcessHandle {
fn pid(&self) -> u32;
fn tag(&self) -> Option<&str>;
fn keepalives_seen(&self) -> u64;
fn reconnects(&self) -> u64;
fn output_offset(&self) -> u64;
async fn next_event(&mut self) -> Result<Option<ProcessEvent>>;
async fn wait(self) -> Result<Output>;
fn detach(self);
async fn write_stdin(&self, data: impl Into<Bytes>) -> Result<()>;
async fn write_pty(&self, data: impl Into<Bytes>) -> Result<()>;
async fn close_stdin(&self) -> Result<()>;
async fn signal(&self, signal: Signal) -> Result<()>;
async fn kill(&self) -> Result<()>;
async fn resize(&self, cols: u32, rows: u32) -> Result<()>;
}ProcessRef#Identifies a process to attach to.
pub enum ProcessRef {
Pid(u32),
Tag(String),
}Replay#Scrollback replay when attaching.
pub enum Replay {
None,
LastBytes(u64),
All,
FromOffset(u64),
}RetryPolicy#Exponential backoff for reconnects and idempotent ...
pub struct RetryPolicy {
pub max_attempts: u32,
pub initial_backoff: Duration,
pub max_backoff: Duration,
}
impl RetryPolicy {
fn backoff(&self, attempt: u32) -> Duration;
async fn run<T, F, Fut>(&self, op: F) -> Result<T> where F: FnMut(u32) -> Fut, Fut: Future<Output = Result<T>>;
}Screenshot#A captured screenshot.
pub struct Screenshot {
pub image: Bytes,
pub format: ImageFormat,
pub width: u32,
pub height: u32,
pub scale: f64,
pub screenshot_id: String,
pub raw: ScreenshotResponse,
}ScreenshotOptions#Screenshot options.
pub struct ScreenshotOptions {
pub display: Option<String>,
pub format: ImageFormat,
pub quality: u32,
pub max_dimension: u32,
pub include_cursor: bool,
}SpacesdClient#Async client for one cua-spacesd.
pub struct SpacesdClient { /* private fields */ }
impl SpacesdClient {
async fn connect_url(endpoint: &str, token: Option<String>) -> Result<Self>;
async fn connect(options: ConnectOptions) -> Result<Self>;
fn token(&self) -> Option<&str>;
fn endpoint(&self) -> &Endpoint;
fn transport(&self) -> Transport;
fn retry_policy(&self) -> RetryPolicy;
fn channel(&self) -> GrpcChannel;
fn system(&self) -> SystemServiceClient<GrpcChannel>;
fn process(&self) -> ProcessServiceClient<GrpcChannel>;
fn filesystem(&self) -> FilesystemServiceClient<GrpcChannel>;
fn computer(&self) -> ComputerServiceClient<GrpcChannel>;
fn windows(&self) -> WindowsServiceClient<GrpcChannel>;
fn accessibility(&self) -> AccessibilityServiceClient<GrpcChannel>;
fn driver(&self) -> DriverServiceClient<GrpcChannel>;
fn stream(&self) -> StreamServiceClient<GrpcChannel>;
fn presence(&self) -> PresenceServiceClient<GrpcChannel>;
fn teleport(&self) -> TeleportServiceClient<GrpcChannel>;
fn tunnel(&self) -> TunnelServiceClient<GrpcChannel>;
fn volume(&self) -> VolumeServiceClient<GrpcChannel>;
fn host_spaces(&self) -> HostSpacesServiceClient<GrpcChannel>;
async fn capabilities(&self) -> Result<GetCapabilitiesResponse>;
async fn refresh_capabilities(&self) -> Result<GetCapabilitiesResponse>;
async fn machine_seal_public_key(&self) -> Result<Option<[u8; 32]>>;
async fn has_feature(&self, feature: &str) -> Result<bool>;
async fn init(&self, request: InitRequest) -> Result<InitResponse>;
async fn health(&self) -> Result<HealthResponse>;
async fn metrics(&self) -> Result<MetricsResponse>;
async fn chunk_limits(&self) -> (usize, usize);
async fn screenshot(&self, options: ScreenshotOptions) -> Result<Screenshot>;
async fn pointer(&self, target: Option<InputTarget>, action: PtrAction) -> Result<PointerResponse>;
async fn click(&self, x: f64, y: f64) -> Result<PointerResponse>;
async fn double_click(&self, x: f64, y: f64) -> Result<PointerResponse>;
async fn right_click(&self, x: f64, y: f64) -> Result<PointerResponse>;
async fn click_with(&self, x: f64, y: f64, button: MouseButton, count: u32) -> Result<PointerResponse>;
async fn move_to(&self, x: f64, y: f64) -> Result<PointerResponse>;
async fn scroll(&self, dx: f64, dy: f64) -> Result<PointerResponse>;
async fn drag(&self, from: (f64, f64), to: (f64, f64)) -> Result<PointerResponse>;
async fn keyboard(&self, target: Option<InputTarget>, action: KbAction) -> Result<KeyboardResponse>;
async fn type_text(&self, text: &str) -> Result<KeyboardResponse>;
async fn press(&self, key: impl TryInto<KeySpec, Error = Error>) -> Result<KeyboardResponse>;
async fn hotkey(&self, keys: &[&str]) -> Result<KeyboardResponse>;
async fn get_clipboard(&self) -> Result<Option<String>>;
async fn set_clipboard(&self, text: &str) -> Result<u64>;
async fn cursor_position(&self) -> Result<(f64, f64)>;
async fn displays(&self) -> Result<Vec<Display>>;
async fn desktop_readiness(&self) -> Result<DesktopReadiness>;
async fn wait_desktop_ready(&self, timeout: Duration) -> Result<DesktopReadiness>;
async fn open_media(&self, options: MediaOptions) -> Result<MediaSession>;
async fn diagnose(&self, options: DiagnoseOptions) -> Result<DiagnoseStream>;
async fn diagnose_once(&self, options: DiagnoseOptions) -> Result<Report>;
async fn diagnose_report(&self, options: DiagnoseOptions, on_check: impl FnMut(&Check)) -> Result<Report>;
async fn upload(&self, path: &str, source: impl Into<UploadSource>, options: UploadOptions) -> Result<UploadResult>;
async fn download(&self, path: &str) -> Result<Bytes>;
async fn download_to_file(&self, path: &str, local: &Path, options: DownloadOptions) -> Result<DownloadResult>;
async fn download_with<S: DownloadSink>(&self, path: &str, options: DownloadOptions, sink: &mut S) -> Result<DownloadResult>;
async fn stat(&self, path: &str) -> Result<EntryInfo>;
async fn list_dir(&self, path: &str, depth: u32) -> Result<Vec<EntryInfo>>;
async fn make_dir(&self, path: &str) -> Result<EntryInfo>;
async fn remove(&self, path: &str, recursive: bool) -> Result<()>;
async fn http(&self, call: HttpCall) -> Result<HttpReply>;
async fn spawn(&self, cmd: impl Into<Command>) -> Result<ProcessHandle>;
async fn run(&self, cmd: impl Into<Command>) -> Result<Output>;
async fn attach(&self, selector: ProcessRef, replay: Replay) -> Result<ProcessHandle>;
async fn list_processes(&self, include_exited: bool) -> Result<Vec<ProcessInfo>>;
async fn supports_tunnel_forward(&self) -> Result<bool>;
async fn forward_tcp(&self, options: ForwardOptions) -> Result<TcpForward>;
async fn open_websocket(&self, ws_path: &str) -> Result<WebSocketStream<MaybeTlsStream<TcpStream>>>;
}StaticBearer#A static bearer.
pub struct StaticBearer(pub String);TcpForward#A running TCP forward.
pub struct TcpForward { /* private fields */ }
impl TcpForward {
fn local_addr(&self) -> SocketAddr;
fn guest_port(&self) -> u16;
async fn forward_id(&self) -> String;
fn stats(&self) -> &ForwardStats;
async fn close(self) -> Result<()>;
}Transport#The protocol a connected client actually uses.
pub enum Transport {
Native,
GrpcWeb,
}transport::GrpcWebFrames#Re-chunks a binary gRPC-Web response body so every ...
pub struct GrpcWebFrames<B> { /* private fields */ }TransportPreference#Wire protocol.
pub enum TransportPreference {
Auto,
Native,
GrpcWeb,
}UploadOptions#Upload options.
pub struct UploadOptions {
pub mode: WriteMode,
pub permissions: u32,
pub create_parents: bool,
pub chunk_size: usize,
pub resumable: Option<bool>,
pub upload_id: Option<String>,
pub ttl: Option<Duration>,
pub progress: Option<Arc<AtomicU64>>,
}UploadResult#Result of an upload.
pub struct UploadResult {
pub entry: Option<EntryInfo>,
pub sha256: String,
pub size: u64,
pub resumable: bool,
pub resumes: u32,
}UploadSource#What to upload.
pub enum UploadSource {
Bytes(Bytes),
File(PathBuf),
}// mod diagnose
/// Encodes artifact bytes for display ...
pub fn encode_artifact(data: &[u8]) -> String
/// SHA-256 over the tool registry's ...
pub fn tools_sha256(tools: &[ToolInfo]) -> String
// mod error
/// Decodes `ErrorInfo` from a status, if ...
pub fn error_info(status: &Status) -> Option<ErrorInfo>
/// Maps a `tonic::Status` into a typed ...
pub fn from_status(status: &Status) -> Error
/// One human-readable line for a status ...
pub fn status_text(status: &Status) -> String
/// Builds a `tonic::Status` carrying ...
pub fn status_with_info(code: Code, info: ErrorInfo) -> Status
/// Shorthand for `status_with_info` with a ...
pub fn status_with_reason(code: Code, reason: ErrorReason, message: impl Into<String>, metadata: impl IntoIterator<Item = (String, String)>) -> Status
/// The innermost cause of a status raised ...
pub fn transport_cause(status: &Status) -> Option<String>
// mod expect
/// Appends one required `expect.*` check ...
pub fn apply(report: &mut Report, expectations: &[Expectation])
/// The expect.<compone ...
pub fn evaluate_one(report: &Report, expectation: &Expectation) -> Check
/// The running instances of `component` ...
pub fn instances(report: &Report, component: &str) -> Vec<Instance>
/// Parses every spec, failing on the first ...
pub fn parse_all(specs: &[String]) -> Result<Vec<Expectation>, String>
// mod manifest
/// Where an image built for this platform ...
pub fn local_path() -> &'static str
// mod transport
/// Install rustls' `ring` provider as the ...
pub fn ensure_crypto_provider()/// Default chunk size for bulk transfer ...
pub const DEFAULT_CHUNK_BYTES: usize = _;
/// Default cap on a response body.
pub const DEFAULT_HTTP_RESPONSE_LIMIT: usize = _;
/// Timeout when the caller sets none.
pub const DEFAULT_HTTP_TIMEOUT: Duration = _;
/// Default server-side keepalive interval ...
pub const DEFAULT_PROCESS_KEEPALIVE: Duration = _;
/// Name of the `SystemService.Health` ...
pub const DESKTOP_COMPONENT: &str = "desktop";
/// Largest request body ...
pub const MAX_HTTP_REQUEST_BYTES: usize = _;
/// Largest message the client accepts ...
pub const MAX_MESSAGE_BYTES: usize = _;
/// Capability name a spacesd advertises ...
pub const TUNNEL_FORWARD_FEATURE: &str = "tunnel.forward";
// mod diagnose
/// Most events a `Diagnose` stream may ...
pub const MAX_EVENTS: usize = 10_000;
/// Largest artifact inlined into a report ...
pub const MAX_INLINE_ARTIFACT_BYTES: usize = _;
/// `DiagnoseReport.schema_version` this ...
pub const SCHEMA_VERSION: u32 = cua_proto::DIAGNOSE_REPORT_SCHEMA_VERSION;
/// Skip reasons that `strict` accepts on a ...
pub const STRICT_ALLOWED_SKIPS: &[&str] = _;
// mod error
/// Type URL of a packed ...
pub const ERROR_INFO_TYPE_URL: &str = "type.googleapis.com/cua.env.v1.ErrorInfo";
// mod expect
/// The id of the guest check that carries ...
pub const IDENTITY_CHECK: &str = "build.identity";
// mod manifest
/// Default location inside a Linux or ...
pub const DEFAULT_PATH: &str = "/etc/cua-image/manifest.json";
/// Manifest schema version this doctor ...
pub const SCHEMA_VERSION: u32 = 1;
/// Location inside a Windows image ...
pub const WINDOWS_PATH: &str = r"C:\ProgramData\cua-image\manifest.json";
// mod transport
/// Header carrying the spacesd token when ...
pub const ENV_TOKEN_HEADER: &str = "x-cua-env-authorization";
/// Header carrying the Fleet claim for ...
pub const FLEET_CLAIM_HEADER: &str = "x-cua-fleet-claim";
// mod tunnel
/// Default cap on concurrently relayed ...
pub const DEFAULT_MAX_CONNECTIONS: usize = 256;
/// Largest WebSocket message accepted from ...
pub const MAX_TUNNEL_MESSAGE_BYTES: usize = _;
/// Bytes read from the local socket per ...
pub const RELAY_CHUNK_BYTES: usize = _;/// Extra request headers a ...
pub type ExtraHeaders = Vec<(String, String)>;
/// The boxed channel every generated ...
pub type GrpcChannel = BoxCloneSyncService<Request<Body>, Response<Body>, ChannelError>;
/// Result alias.
pub type Result<T, E = Error> = Result<T, E>;
// mod diagnose
/// A server-streamed `Diagnose` run.
pub type DiagnoseStream = Streaming<DiagnoseResponse>;
// mod error
/// Boxed error used by transports.
pub type BoxError = Box<dyn Error + Send + Sync + 'static>;cua_proto::env::v1.