pub struct Client { /* private fields */ }Expand description
A connection to a home’s runner service.
Implementations§
Source§impl Client
impl Client
Sourcepub async fn record(&self, run: &RunName) -> Result<Option<RunRow>, ClientError>
pub async fn record(&self, run: &RunName) -> Result<Option<RunRow>, ClientError>
Run run’s record; none for a run never recorded.
§Errors
The store couldn’t be read, or the connection ended.
Sourcepub async fn forget(&self, run: &RunName) -> Result<(), ClientError>
pub async fn forget(&self, run: &RunName) -> Result<(), ClientError>
Forgets run run’s record (what it created is left as it is).
§Errors
locked while an operation of the run is queued or running; the store couldn’t be
written, or the connection ended.
Sourcepub async fn expired(&self) -> Result<Vec<RunRow>, ClientError>
pub async fn expired(&self) -> Result<Vec<RunRow>, ClientError>
The recorded runs whose lifetime passed and that may still hold something: a reaper’s
down each.
§Errors
The store couldn’t be read, or the connection ended.
Sourcepub async fn console_command(
&self,
run: &RunName,
target: Option<Target>,
machine: &str,
user: Option<&str>,
) -> Result<ShellCommand, ClientError>
pub async fn console_command( &self, run: &RunName, target: Option<Target>, machine: &str, user: Option<&str>, ) -> Result<ShellCommand, ClientError>
The command that opens an interactive console into machine of run run (target:
where to open it, else as recorded), as user when given, for this client to run in its
own terminal.
§Errors
Where the run’s format has no way in; the connection ended.
Sourcepub async fn native_console(
&self,
run: &RunName,
target: Option<Target>,
options: OpOptions,
machine: &str,
) -> Result<NativeConsole, ClientError>
pub async fn native_console( &self, run: &RunName, target: Option<Target>, options: OpOptions, machine: &str, ) -> Result<NativeConsole, ClientError>
What opens running machine of run run in its hypervisor’s own app, its hypervisor
asked with options’ values and secrets.
§Errors
no_console when the hypervisor has no app or the machine isn’t running; the
connection ended.
Sourcepub async fn graphical_console(
&self,
run: &RunName,
target: Option<Target>,
options: OpOptions,
machine: &str,
) -> Result<HeldConsole, ClientError>
pub async fn graphical_console( &self, run: &RunName, target: Option<Target>, options: OpOptions, machine: &str, ) -> Result<HeldConsole, ClientError>
Running machine‘s graphical console, its hypervisor asked with options’ values and
secrets, on a connection of its own that keeps its tunnel (when one carries it) open until
the HeldConsole is dropped.
§Errors
no_console when the machine has none, or it doesn’t answer; server_auth_failed when
a server refuses the credentials; the service doesn’t answer.
Sourcepub async fn service_endpoints(
&self,
run: &RunName,
target: Option<Target>,
options: OpOptions,
) -> Result<Vec<ServiceEndpoint>, ClientError>
pub async fn service_endpoints( &self, run: &RunName, target: Option<Target>, options: OpOptions, ) -> Result<Vec<ServiceEndpoint>, ClientError>
The service endpoints run run publishes, each where this computer reaches it: as the run
gives it, or at a local forward through its jump host, which the service keeps open. One
whose forward didn’t open says why.
§Errors
The run’s outputs can’t be read; the connection ended.
Sourcepub async fn usage(
&self,
run: &RunName,
target: Option<Target>,
options: OpOptions,
) -> Result<Vec<MachineUsage>, ClientError>
pub async fn usage( &self, run: &RunName, target: Option<Target>, options: OpOptions, ) -> Result<Vec<MachineUsage>, ClientError>
What each running machine of run run uses now (CPU and memory), by name, as its engine
samples it once; none for a format whose tool reports no per-machine figure.
§Errors
The run’s engine doesn’t answer, or its answer can’t be read; the connection ended.
Sourcepub async fn downloads(&self) -> Result<Vec<Download>, ClientError>
pub async fn downloads(&self) -> Result<Vec<Download>, ClientError>
What the runs’ own downloads fetched and the home records (images a pull pulled, boxes an
up added), oldest first, each with its size when it can be read.
§Errors
The store couldn’t be read, or the connection ended.
Sourcepub async fn remove_downloads(
&self,
which: DownloadsToRemove,
) -> Result<Vec<DownloadRemoval>, ClientError>
pub async fn remove_downloads( &self, which: DownloadsToRemove, ) -> Result<Vec<DownloadRemoval>, ClientError>
Removes the recorded downloads which names, each on its own (never forced): how each
went, one its tool refused kept and said, the others removed.
§Errors
The store couldn’t be read or written, or the connection ended.
Sourcepub async fn adopt_downloads(
&self,
adopted: Vec<DownloadToAdopt>,
) -> Result<Vec<Download>, ClientError>
pub async fn adopt_downloads( &self, adopted: Vec<DownloadToAdopt>, ) -> Result<Vec<Download>, ClientError>
Adopts adopted, downloads fetched outside the runs (by an earlier program’s own record),
into the home’s record, each one on this computer now as it was fetched: they are listed
and removed like the runs’ own. The downloads recorded for them, new or not.
§Errors
The engine or Vagrant couldn’t say what they hold (nothing was recorded), the store couldn’t be written, or the connection ended.
Sourcepub async fn address_blocks_in_use(
&self,
except: Option<RunName>,
docker_context: Option<String>,
) -> Result<Vec<String>, ClientError>
pub async fn address_blocks_in_use( &self, except: Option<RunName>, docker_context: Option<String>, ) -> Result<Vec<String>, ClientError>
The IPv4 address blocks (CIDR) the networks of the engine Docker context docker_context
reaches hold (the current one when none is named), but those of run except’s own
networks: what a deployment’s networks must stay clear of.
§Errors
Docker is missing or the engine can’t say, or the connection ended.
Sourcepub async fn public_key(&self) -> Result<String, ClientError>
pub async fn public_key(&self) -> Result<String, ClientError>
The public half of the runner’s SSH key, one line (made when it has none).
§Errors
The key couldn’t be made (tool_missing without ssh-keygen) or read; the connection
ended.
Source§impl Client
impl Client
Sourcepub async fn connect(
home: &Path,
binary: Option<&Path>,
) -> Result<Client, ClientError>
pub async fn connect( home: &Path, binary: Option<&Path>, ) -> Result<Client, ClientError>
Connects to home’s service, starting it (isothrum serve --home <home> --detach:
binary when given, else the isothrum beside this program, else the one on PATH)
when none answers, and waiting up to 30 seconds for it (less once it ended without answering).
§Errors
ClientError::Unavailable when none answers and none could be started (with the end of
its log); ClientError::Protocol when the service speaks another protocol.
Sourcepub async fn connect_exact(
home: &Path,
binary: Option<&Path>,
) -> Result<Client, ClientError>
pub async fn connect_exact( home: &Path, binary: Option<&Path>, ) -> Result<Client, ClientError>
Connects to home’s service of this release (VERSION), protocol and build (of
binary: ServiceInfo::build): the one that runs when it is, else after replacing the one
of another release or build (stopped, or ended when it doesn’t answer), else none; a service it then starts as Client::connect does
(binary: the isothrum of this release). How it replaces a service is in the crate’s
documentation.
§Errors
ClientError::Busy when the service of another release has operations queued or
running: it is left running; ClientError::Version when the service started is another
release (binary isn’t this one’s); ClientError::Unavailable when the service couldn’t
be stopped (it doesn’t answer, and can’t be told from another process, or doesn’t end) or
none could be started; ClientError::Protocol when it refused to stop.
Sourcepub async fn connect_running(home: &Path) -> Result<Client, ClientError>
pub async fn connect_running(home: &Path) -> Result<Client, ClientError>
Connects to home’s service when one runs, starting none.
§Errors
ClientError::Unavailable when none answers.
Sourcepub fn service(&self) -> &ServiceInfo
pub fn service(&self) -> &ServiceInfo
What the service said of itself when it started.
Sourcepub async fn request(&self, command: Command) -> Result<Reply, ClientError>
pub async fn request(&self, command: Command) -> Result<Reply, ClientError>
Sends command, and returns its reply (an error reply as ClientError::Refused).
§Errors
The service refused it, or the connection ended: before command was sent
(ClientError::Io), or after, unanswered (ClientError::Unanswered).
Sourcepub async fn submit(&self, command: Command) -> Result<Accepted, ClientError>
pub async fn submit(&self, command: Command) -> Result<Accepted, ClientError>
Queues the operation command asks for.
§Errors
The service refused it (the run can’t be opened, another operation of the run is queued
or running: ErrorCode::Locked, the service is
stopping), or command isn’t an operation (ClientError::Protocol).
Sourcepub async fn up(
&self,
target: Target,
options: OpOptions,
) -> Result<Accepted, ClientError>
pub async fn up( &self, target: Target, options: OpOptions, ) -> Result<Accepted, ClientError>
Sourcepub async fn down(
&self,
target: Target,
options: OpOptions,
) -> Result<Accepted, ClientError>
pub async fn down( &self, target: Target, options: OpOptions, ) -> Result<Accepted, ClientError>
Sourcepub async fn park(
&self,
target: Target,
options: OpOptions,
mode: Park,
) -> Result<Accepted, ClientError>
pub async fn park( &self, target: Target, options: OpOptions, mode: Park, ) -> Result<Accepted, ClientError>
Sourcepub async fn resume(
&self,
target: Target,
options: OpOptions,
) -> Result<Accepted, ClientError>
pub async fn resume( &self, target: Target, options: OpOptions, ) -> Result<Accepted, ClientError>
Sourcepub async fn update(
&self,
target: Target,
options: OpOptions,
) -> Result<Accepted, ClientError>
pub async fn update( &self, target: Target, options: OpOptions, ) -> Result<Accepted, ClientError>
Sourcepub async fn retire(
&self,
target: Target,
options: OpOptions,
machine: String,
) -> Result<Accepted, ClientError>
pub async fn retire( &self, target: Target, options: OpOptions, machine: String, ) -> Result<Accepted, ClientError>
Sourcepub async fn package(
&self,
target: Target,
options: OpOptions,
machine: String,
output: PathBuf,
) -> Result<Accepted, ClientError>
pub async fn package( &self, target: Target, options: OpOptions, machine: String, output: PathBuf, ) -> Result<Accepted, ClientError>
Sourcepub async fn attach(
&self,
target: Target,
options: OpOptions,
machine: String,
) -> Result<Accepted, ClientError>
pub async fn attach( &self, target: Target, options: OpOptions, machine: String, ) -> Result<Accepted, ClientError>
Sourcepub async fn exec(
&self,
target: Target,
options: OpOptions,
machine: String,
argv: Vec<String>,
) -> Result<Accepted, ClientError>
pub async fn exec( &self, target: Target, options: OpOptions, machine: String, argv: Vec<String>, ) -> Result<Accepted, ClientError>
Sourcepub async fn cancel(&self, operation: OperationId) -> Result<(), ClientError>
pub async fn cancel(&self, operation: OperationId) -> Result<(), ClientError>
Cancels operation: queued, it never begins; running, it is cut short.
§Errors
The service refused (an unknown or ended operation), or the connection ended.
Sourcepub async fn status(
&self,
run: &RunName,
target: Option<Target>,
) -> Result<Status, ClientError>
pub async fn status( &self, run: &RunName, target: Option<Target>, ) -> Result<Status, ClientError>
Run run’s status (target: where to open it, for a run not recorded yet; else as
recorded).
§Errors
The runner couldn’t read it, or the connection ended.
Sourcepub async fn status_with(
&self,
run: &RunName,
target: Option<Target>,
options: OpOptions,
) -> Result<Status, ClientError>
pub async fn status_with( &self, run: &RunName, target: Option<Target>, options: OpOptions, ) -> Result<Status, ClientError>
Client::status, the read’s tools given options’ values and secrets (a Proxmox VE
module’s API token, for its VMs’ states on the server).
§Errors
As Client::status; server_auth_failed when a server refuses the credentials.
Sourcepub async fn variables(
&self,
target: Target,
) -> Result<Vec<InputVariable>, ClientError>
pub async fn variables( &self, target: Target, ) -> Result<Vec<InputVariable>, ClientError>
The input variables the Terraform folder target names declares (name, type, default,
sensitive), read from its files: a sensitive one is given as a secret, which no record
keeps.
§Errors
The folder isn’t a Terraform module (unsupported, project_invalid), or the connection
ended.
Sourcepub async fn operations(
&self,
run: &RunName,
limit: u32,
) -> Result<Vec<OperationRow>, ClientError>
pub async fn operations( &self, run: &RunName, limit: u32, ) -> Result<Vec<OperationRow>, ClientError>
Sourcepub async fn shutdown(&self) -> Result<(), ClientError>
pub async fn shutdown(&self) -> Result<(), ClientError>
Stops the service: its operations are cancelled and their tools stopped.
§Errors
The connection ended before the service answered.
Sourcepub async fn subscribe(
&self,
run: Option<RunName>,
after: Option<EventCursor>,
) -> Result<Subscription, ClientError>
pub async fn subscribe( &self, run: Option<RunName>, after: Option<EventCursor>, ) -> Result<Subscription, ClientError>
The events after after (every one the service keeps when None), then the live ones, of
run run or of every run, on a connection of their own.
§Errors
The service refused, or doesn’t answer.
Sourcepub async fn follow(&self, command: Command) -> Result<Followed, ClientError>
pub async fn follow(&self, command: Command) -> Result<Followed, ClientError>
Queues the operation command asks for and follows it: its events, from its queued to
its ended. The subscription is open before the operation is queued, so none is missed.
§Errors
As Client::submit and Client::subscribe.
Sourcepub async fn follow_again(
&self,
command: Command,
) -> Result<Followed, ClientError>
pub async fn follow_again( &self, command: Command, ) -> Result<Followed, ClientError>
Follows command once more, its first sending unanswered (ClientError::Unanswered):
the service may have queued it. When the run’s newest operation is of command’s kind and
under way in this service (not ended, queued by this service’s process), that one is
followed, from its queued: it is the first sending’s, or another client’s same operation,
which command would only have queued behind. Else command is queued anew
(Client::follow): a service that died with it took it along (one restarted since
recovers it as an operation of its own, under way, which is then the one followed). One
that already ended, and a target that doesn’t name its run, are queued anew too: an
operation run twice brings the run to the same place.
§Errors
As Client::follow, and the run’s operations couldn’t be read.
Sourcepub async fn wait(&self, operation: OperationId) -> Result<Event, ClientError>
pub async fn wait(&self, operation: OperationId) -> Result<Event, ClientError>
Waits for operation operation’s last event: its result, or its error as
ClientError::Operation (a cancel before it began, as one of code cancelled).
§Errors
The operation failed, or the connection ended.