Skip to main content

Client

Struct Client 

Source
pub struct Client { /* private fields */ }
Expand description

A configured Sail client. Cheap to clone; shares transport across clones.

Implementations§

Source§

impl Client

Source

pub fn builder(api_key: impl Into<String>) -> ClientBuilder

Start a ClientBuilder.

Source

pub fn from_env() -> Result<Client, SailError>

Build a client from the environment (SAIL_MODE, SAIL_API_KEY, …).

Source

pub fn from_config(config: Config) -> Result<Client, SailError>

Build a client from an already-resolved Config.

Source

pub fn config(&self) -> &Config

The resolved configuration.

Source

pub async fn create_sailbox( &self, req: &CreateSailboxRequest, timeout: Option<Duration>, ) -> Result<Sailbox, SailError>

Create a sailbox. timeout bounds each attempt of the synchronous create (which the scheduler can block on for minutes); the call retries with one idempotency key so the backend can dedupe rather than duplicate, and gives up after roughly max_attempts * timeout. An interrupted or re-invoked create is a new request and may leave a prior box behind under the same name. 10 minutes is a good default; None leaves each attempt unbounded. If the budget is exhausted the box may still be coming up server-side; find or terminate it by name.

Source

pub async fn list_sailboxes( &self, query: &ListSailboxesQuery, ) -> Result<SailboxPage, SailError>

List sailboxes in the current org.

Source

pub async fn create_from_checkpoint( &self, checkpoint_id: &str, name: Option<&str>, timeout: Option<Duration>, ) -> Result<Sailbox, SailError>

Create a new sailbox from a checkpoint.

Source

pub async fn org_ssh_ca_public_key(&self) -> Result<String, SailError>

The caller org’s SSH CA public key (created on first use).

Source

pub async fn issue_user_cert( &self, public_key: &str, timeout: Option<Duration>, ) -> Result<IssuedUserCert, SailError>

Sign public_key into a short-lived org-CA certificate (principal root). timeout (seconds) bounds a single no-retry attempt; None retries.

Source

pub async fn get_volume( &self, name: &str, mint_if_missing: bool, ) -> Result<VolumeInfo, SailError>

Look up (optionally minting) an NFS volume by name.

Source

pub async fn list_volumes( &self, max_objects: Option<i64>, ) -> Result<Vec<VolumeInfo>, SailError>

List NFS volumes in the current org.

Source

pub async fn delete_volume( &self, volume_id: &str, allow_missing: bool, ) -> Result<Option<VolumeInfo>, SailError>

Delete a volume by id.

Source

pub async fn find_app( &self, name: &str, mint_if_missing: bool, ) -> Result<App, SailError>

Find an app by name on the central API, optionally minting it.

Source

pub async fn list_apps(&self) -> Result<Vec<App>, SailError>

Every app the current org owns, newest first, from the central app index.

Source§

impl Client

Source

pub async fn prepare_local_file_upload( &self, content_sha256: &str, content_length: u64, ) -> Result<LocalFileUploadPlan, SailError>

The server’s plan for uploading a content-addressed local file.

Source

pub async fn build_image( &self, spec: &ImageSpec, retry_timeout_secs: f64, ) -> Result<ImageBuild, SailError>

Submit or resume a custom image build. Poll Client::get_image_build_status until the status is ready or failed, or use Client::build_image_definition for the whole pipeline.

Source

pub async fn get_image_build_status( &self, image_id: &str, retry_timeout_secs: f64, ) -> Result<ImageBuild, SailError>

Poll one custom image build’s status.

Source

pub async fn resolve_local_file_step( &self, local_path: &Path, remote_path: &str, mode: Option<u32>, ) -> Result<AddLocalFile, SailError>

Resolve one local file into a content-addressed addLocalFile step, uploading its bytes if the server does not already have them.

Source

pub async fn resolve_local_dir_step( &self, local_path: &Path, remote_path: &str, ignore: &[String], ignore_file: Option<&Path>, ) -> Result<AddLocalDir, SailError>

Resolve one local directory into a content-addressed addLocalDir step: walk it with gitignore-style matching, hash every file, and upload content the server does not already have.

Source

pub async fn resolve_image( &self, def: &ImageDefinition, ) -> Result<ImageSpec, SailError>

Resolve an ImageDefinition into a content-addressed ImageSpec: walk local directories, hash every file, and upload content the server does not already have.

Source

pub async fn build_spec_with_timeout( &self, spec: &ImageSpec, timeout: Duration, ) -> Result<ImageBuild, SailError>

Build an already-resolved spec to ready, bounded by timeout (an unrepresentably large value waits indefinitely). The envelope both bridges and Client::build_image_definition share.

Source

pub async fn build_image_definition( &self, def: &ImageDefinition, timeout: Duration, ) -> Result<ImageSpec, SailError>

Resolve an ImageDefinition and build it to ready, returning the content-addressed ImageSpec to create sailboxes from. A bare builtin base skips the build. timeout bounds the whole pipeline (hashing, uploads, and the build); 30 minutes is a good default, and Duration::MAX waits indefinitely.

Source

pub async fn build_spec_to_ready( &self, spec: &ImageSpec, deadline: Option<Instant>, ) -> Result<ImageBuild, SailError>

Build an already-resolved spec to ready (submit + poll).

Source§

impl Client

Source

pub fn sailbox(&self, sailbox_id: impl Into<String>) -> Sailbox

Bind an existing sailbox id to this client without a network call, giving the method-style surface over it.

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more