pub struct MutantClient { /* private fields */ }Expand description
A client for interacting with the Mutant Daemon over WebSocket (Cross-platform implementation).
Implementations§
Source§impl MutantClient
impl MutantClient
Sourcepub async fn send_request(
&mut self,
request: Request,
) -> Result<(), ClientError>
pub async fn send_request( &mut self, request: Request, ) -> Result<(), ClientError>
Sends a request over the WebSocket.
Source§impl MutantClient
impl MutantClient
Sourcepub 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>>>,
)
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
pub async fn next_response(&mut self) -> Option<Result<Response, ClientError>>
Source§impl MutantClient
impl MutantClient
Sourcepub async fn connect(&mut self, addr: &str) -> Result<(), ClientError>
pub async fn connect(&mut self, addr: &str) -> Result<(), ClientError>
Establishes a WebSocket connection to the Mutant Daemon.
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>
pub async fn get( &mut self, user_key: &str, destination_path: &str, public: bool, ) -> Result<(impl Future<Output = Result<TaskResult, ClientError>> + '_, ProgressReceiver), ClientError>
pub async fn sync( &mut self, push_force: bool, ) -> Result<(impl Future<Output = Result<TaskResult, ClientError>> + '_, ProgressReceiver), ClientError>
pub async fn purge( &mut self, aggressive: bool, ) -> Result<(impl Future<Output = Result<TaskResult, ClientError>> + '_, ProgressReceiver), ClientError>
pub async fn health_check( &mut self, key_name: &str, recycle: bool, ) -> Result<(impl Future<Output = Result<TaskResult, ClientError>> + '_, ProgressReceiver), ClientError>
Sourcepub async fn list_keys(&mut self) -> Result<Vec<KeyDetails>, ClientError>
pub async fn list_keys(&mut self) -> Result<Vec<KeyDetails>, ClientError>
Retrieves a list of all stored keys from the daemon.
pub async fn rm(&mut self, user_key: &str) -> Result<(), ClientError>
pub async fn list_tasks(&mut self) -> Result<Vec<TaskListEntry>, ClientError>
pub async fn query_task(&mut self, task_id: TaskId) -> Result<Task, ClientError>
pub async fn get_stats(&mut self) -> Result<StatsResponse, ClientError>
pub async fn import( &mut self, file_path: &str, ) -> Result<ImportResult, ClientError>
pub async fn export( &mut self, destination_path: &str, ) -> Result<ExportResult, ClientError>
Sourcepub async fn stop_task(
&mut self,
task_id: TaskId,
) -> Result<TaskStoppedResponse, ClientError>
pub async fn stop_task( &mut self, task_id: TaskId, ) -> Result<TaskStoppedResponse, ClientError>
Stops a running task on the daemon.
pub fn get_task_status(&self, task_id: TaskId) -> Option<TaskStatus>
pub fn get_task_result(&self, task_id: TaskId) -> Option<TaskResult>
Source§impl MutantClient
impl MutantClient
pub fn partial_take_receiver(&mut self) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MutantClient
impl RefUnwindSafe for MutantClient
impl Send for MutantClient
impl !Sync for MutantClient
impl Unpin for MutantClient
impl UnwindSafe for MutantClient
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