MutantClient

Struct MutantClient 

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

A client for interacting with the Mutant Daemon over WebSocket (Cross-platform implementation).

Implementations§

Source§

impl MutantClient

Source

pub async fn send_request( &mut self, request: Request, ) -> Result<(), ClientError>

Sends a request over the WebSocket.

Source§

impl MutantClient

Source

pub fn process_response( response: Response, tasks: &Arc<Mutex<HashMap<TaskId, Task>>>, task_channels: &Arc<Mutex<HashMap<TaskId, (Sender<Result<TaskResult, ClientError>>, UnboundedSender<Result<TaskProgress, ClientError>>)>>>, pending_requests: &Arc<Mutex<HashMap<PendingRequestKey, PendingSender>>>, )

Processes a deserialized response from the server

Source

pub async fn next_response(&mut self) -> Option<Result<Response, ClientError>>

Source§

impl MutantClient

Source

pub fn new() -> Self

Creates a new client instance but does not connect yet.

Source

pub async fn connect(&mut self, addr: &str) -> Result<(), ClientError>

Establishes a WebSocket connection to the Mutant Daemon.

Source

pub async fn put<'a>( &'a mut self, user_key: &str, source_path: &str, mode: StorageMode, public: bool, no_verify: bool, ) -> Result<(impl Future<Output = Result<TaskResult, ClientError>> + 'a, ProgressReceiver), ClientError>

Source

pub async fn get( &mut self, user_key: &str, destination_path: &str, public: bool, ) -> Result<(impl Future<Output = Result<TaskResult, ClientError>> + '_, ProgressReceiver), ClientError>

Source

pub async fn sync( &mut self, push_force: bool, ) -> Result<(impl Future<Output = Result<TaskResult, ClientError>> + '_, ProgressReceiver), ClientError>

Source

pub async fn purge( &mut self, aggressive: bool, ) -> Result<(impl Future<Output = Result<TaskResult, ClientError>> + '_, ProgressReceiver), ClientError>

Source

pub async fn health_check( &mut self, key_name: &str, recycle: bool, ) -> Result<(impl Future<Output = Result<TaskResult, ClientError>> + '_, ProgressReceiver), ClientError>

Source

pub async fn list_keys(&mut self) -> Result<Vec<KeyDetails>, ClientError>

Retrieves a list of all stored keys from the daemon.

Source

pub async fn rm(&mut self, user_key: &str) -> Result<(), ClientError>

Source

pub async fn list_tasks(&mut self) -> Result<Vec<TaskListEntry>, ClientError>

Source

pub async fn query_task(&mut self, task_id: TaskId) -> Result<Task, ClientError>

Source

pub async fn get_stats(&mut self) -> Result<StatsResponse, ClientError>

Source

pub async fn import( &mut self, file_path: &str, ) -> Result<ImportResult, ClientError>

Source

pub async fn export( &mut self, destination_path: &str, ) -> Result<ExportResult, ClientError>

Source

pub async fn stop_task( &mut self, task_id: TaskId, ) -> Result<TaskStoppedResponse, ClientError>

Stops a running task on the daemon.

Source

pub fn get_task_status(&self, task_id: TaskId) -> Option<TaskStatus>

Source

pub fn get_task_result(&self, task_id: TaskId) -> Option<TaskResult>

Source§

impl MutantClient

Source

pub fn partial_take_receiver(&mut self) -> Self

Trait Implementations§

Source§

impl Clone for MutantClient

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · 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<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, 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> 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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T