pub struct PwrClient { /* private fields */ }Expand description
A connected and authenticated client session with the pwr server.
Implementations§
Source§impl PwrClient
impl PwrClient
Sourcepub fn connect(config: &PwrConfig, tls: bool) -> ClientResult<Self>
pub fn connect(config: &PwrConfig, tls: bool) -> ClientResult<Self>
Connect to the server with retry logic for transient failures.
Retries up to 3 times with exponential backoff (1s, 2s, 4s). TLS handshake failures and authentication errors are not retried since they indicate configuration problems rather than transient network issues.
Sourcepub fn archive_project(
&mut self,
project_uuid: &Uuid,
project_name: &str,
archive_data: &[u8],
archive_hash: &str,
) -> ClientResult<()>
pub fn archive_project( &mut self, project_uuid: &Uuid, project_name: &str, archive_data: &[u8], archive_hash: &str, ) -> ClientResult<()>
Archive a project: send the encrypted archive blob to the server.
archive_data is the fully encrypted tar.gz.age blob.
archive_hash is its SHA-256 hex hash for server-side verification.
An optional progress callback receives bytes sent so far and total.
Sourcepub fn archive_project_with_progress(
&mut self,
project_uuid: &Uuid,
project_name: &str,
archive_data: &[u8],
archive_hash: &str,
progress: Option<&dyn Fn(u64, u64)>,
) -> ClientResult<()>
pub fn archive_project_with_progress( &mut self, project_uuid: &Uuid, project_name: &str, archive_data: &[u8], archive_hash: &str, progress: Option<&dyn Fn(u64, u64)>, ) -> ClientResult<()>
Archive with progress callback: fn(bytes_sent, total_bytes).
Sourcepub fn restore_project(&mut self, project_uuid: &Uuid) -> ClientResult<Vec<u8>>
pub fn restore_project(&mut self, project_uuid: &Uuid) -> ClientResult<Vec<u8>>
Restore a project: request the server send back the archive blob.
Returns the encrypted archive data that can then be decrypted and extracted locally.
Sourcepub fn restore_project_with_progress(
&mut self,
project_uuid: &Uuid,
progress: Option<&dyn Fn(u64, u64)>,
) -> ClientResult<Vec<u8>>
pub fn restore_project_with_progress( &mut self, project_uuid: &Uuid, progress: Option<&dyn Fn(u64, u64)>, ) -> ClientResult<Vec<u8>>
Restore with progress callback: fn(bytes_received, total_bytes).
Sourcepub fn get_status(
&mut self,
project_uuid: Option<&Uuid>,
) -> ClientResult<Vec<ProjectInfo>>
pub fn get_status( &mut self, project_uuid: Option<&Uuid>, ) -> ClientResult<Vec<ProjectInfo>>
Query the server for project status.