pub struct Client { /* private fields */ }Expand description
Client for communicating with the vm-pool service.
Implementations§
Source§impl Client
impl Client
Sourcepub async fn connect(path: impl AsRef<Path>) -> Result<Self, ClientError>
pub async fn connect(path: impl AsRef<Path>) -> Result<Self, ClientError>
Connect to the vm-pool service at the given Unix socket path.
Sourcepub async fn status(&mut self) -> Result<PoolStatus, ClientError>
pub async fn status(&mut self) -> Result<PoolStatus, ClientError>
Get pool status.
Sourcepub async fn allocate(
&mut self,
image: &str,
config: VmConfig,
) -> Result<VmId, ClientError>
pub async fn allocate( &mut self, image: &str, config: VmConfig, ) -> Result<VmId, ClientError>
Allocate a new VM. Returns the VM ID.
Sourcepub async fn deallocate(&mut self, vm_id: &VmId) -> Result<(), ClientError>
pub async fn deallocate(&mut self, vm_id: &VmId) -> Result<(), ClientError>
Deallocate a VM.
Sourcepub async fn send_command(
&mut self,
vm_id: &VmId,
command: VmCommand,
) -> Result<ServiceEvent, ClientError>
pub async fn send_command( &mut self, vm_id: &VmId, command: VmCommand, ) -> Result<ServiceEvent, ClientError>
Send a command to a VM.
Sourcepub async fn snapshot(
&mut self,
vm_id: &VmId,
name: &str,
) -> Result<(), ClientError>
pub async fn snapshot( &mut self, vm_id: &VmId, name: &str, ) -> Result<(), ClientError>
Save a snapshot of a VM.
Sourcepub async fn restore(
&mut self,
vm_id: &VmId,
snapshot: &str,
) -> Result<(), ClientError>
pub async fn restore( &mut self, vm_id: &VmId, snapshot: &str, ) -> Result<(), ClientError>
Restore a VM from a snapshot.
Sourcepub async fn tail_logs(
&mut self,
vm_id: &VmId,
lines: usize,
) -> Result<Vec<LogLine>, ClientError>
pub async fn tail_logs( &mut self, vm_id: &VmId, lines: usize, ) -> Result<Vec<LogLine>, ClientError>
Tail log lines from a VM.
Sourcepub async fn subscribe_logs(
&mut self,
vm_id: Option<&VmId>,
) -> Result<(), ClientError>
pub async fn subscribe_logs( &mut self, vm_id: Option<&VmId>, ) -> Result<(), ClientError>
Subscribe to logs from a specific VM (or all VMs if None).
Sourcepub async fn unsubscribe_logs(&mut self) -> Result<(), ClientError>
pub async fn unsubscribe_logs(&mut self) -> Result<(), ClientError>
Unsubscribe from log streaming.
Sourcepub async fn next_event(&mut self) -> Option<ServiceEvent>
pub async fn next_event(&mut self) -> Option<ServiceEvent>
Receive the next event (for streaming/subscriptions). Returns None if the connection is closed.
Auto Trait Implementations§
impl Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more