Skip to main content

sail/
lib.rs

1//! `sail-core`: the canonical, typed Sail SDK.
2//!
3//! [`Client`] is the entry point: a cheap-to-clone async handle that owns
4//! configuration and transport (HTTP for lifecycle/app, gRPC for the
5//! per-sailbox worker proxy). Bindings (the Python extension, the CLI) are thin
6//! layers over it.
7//!
8//! As a library, `sail-core` documents its whole public API and never writes to
9//! the process streams or exits: callers decide how to surface output and
10//! errors.
11//!
12//! The transport plumbing the bindings reach into lives under the hidden
13//! [`internal`] module; it is not part of the public API and carries no
14//! stability guarantee.
15#![deny(missing_docs)]
16#![deny(clippy::print_stdout, clippy::print_stderr, clippy::exit)]
17
18pub mod app;
19pub mod client;
20pub mod config;
21pub mod error;
22pub mod exec;
23pub mod image;
24pub mod sailbox;
25pub mod worker;
26
27mod channels;
28pub(crate) mod credentials;
29pub(crate) mod http;
30pub(crate) mod imagebuilder;
31pub(crate) mod retry;
32pub(crate) mod runtime;
33
34pub use client::{Client, ClientBuilder};
35pub use runtime::block_on;
36
37/// Re-export of the [`time`] crate, whose [`OffsetDateTime`](time::OffsetDateTime)
38/// appears in public types (sailbox/volume timestamps). Re-exported so callers
39/// name the same version the SDK was built against.
40pub use time;
41
42/// Generated protobuf/gRPC code for the sailbox services. The proto files are
43/// the source of truth for these types, so the generated members carry no
44/// hand-written docs and are exempt from our lint policy (the server stubs,
45/// emitted only under `test-fakes`, are pure codegen we never hand-edit).
46#[allow(missing_docs, clippy::all, clippy::pedantic)]
47pub(crate) mod pb {
48    pub mod workerproxy {
49        pub mod v1 {
50            tonic::include_proto!("workerproxy.v1");
51        }
52    }
53    pub mod imagebuilder {
54        pub mod v1 {
55            tonic::include_proto!("imagebuilder.v1");
56        }
57    }
58    pub mod image {
59        pub mod v1 {
60            tonic::include_proto!("image.v1");
61        }
62    }
63}
64
65/// Unstable, binding-only surface shared with the first-party CLI and Python
66/// bindings (and this crate's own integration tests): the raw transport, the
67/// credential store, and the generated protobuf code. Not part of the public
68/// API and not covered by semantic versioning; do not depend on it from outside
69/// this workspace.
70#[doc(hidden)]
71pub mod internal {
72    pub mod credentials {
73        pub use crate::credentials::*;
74    }
75    pub mod http {
76        pub use crate::http::*;
77    }
78    pub mod pb {
79        pub use crate::pb::*;
80    }
81    pub mod retry {
82        pub use crate::retry::*;
83    }
84
85    pub use crate::runtime::runtime;
86    pub use crate::sailbox::api::SailboxApi;
87}