pub struct IpcClient { /* private fields */ }Expand description
A client for sending requests to the daemon.
Implementations§
Source§impl IpcClient
impl IpcClient
pub fn new(data_dir: &Path) -> Self
pub const fn from_socket_path(socket_path: PathBuf) -> Self
pub fn socket_path(&self) -> &Path
Sourcepub async fn send(&self, request: IpcRequest) -> Result<IpcResponse>
pub async fn send(&self, request: IpcRequest) -> Result<IpcResponse>
Send one newline-delimited JSON request and await its response.
§Errors
Returns an error when the socket is unavailable, the operation times out, or either JSON message is malformed.
Sourcepub async fn status(&self) -> Result<DaemonStatus>
pub async fn status(&self) -> Result<DaemonStatus>
Request the daemon status.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn list_folders(&self) -> Result<Vec<FolderStatus>>
pub async fn list_folders(&self) -> Result<Vec<FolderStatus>>
List all folders and public subscriptions managed by the daemon.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn add_folder(
&self,
namespace: String,
path: PathBuf,
) -> Result<String>
pub async fn add_folder( &self, namespace: String, path: PathBuf, ) -> Result<String>
Register a folder with the daemon.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn watch_start(
&self,
namespace: String,
path: PathBuf,
exclude: Vec<String>,
filter: Option<FilterConfig>,
) -> Result<String>
pub async fn watch_start( &self, namespace: String, path: PathBuf, exclude: Vec<String>, filter: Option<FilterConfig>, ) -> Result<String>
Register a folder with the daemon for continuous watching, including the filesystem exclude globs and optional per-folder filter override.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn trigger_sync(&self, namespace: Option<String>) -> Result<String>
pub async fn trigger_sync(&self, namespace: Option<String>) -> Result<String>
Ask the daemon to trigger synchronization.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn set_log_level(&self, level: String) -> Result<String>
pub async fn set_log_level(&self, level: String) -> Result<String>
Set the daemon log level.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn reload_config(&self) -> Result<String>
pub async fn reload_config(&self) -> Result<String>
Ask the daemon to reload its configuration.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn shutdown(&self, force: bool) -> Result<String>
pub async fn shutdown(&self, force: bool) -> Result<String>
Ask the daemon to shut down.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn download(
&self,
namespace: String,
strategy: FetchStrategy,
) -> Result<u64>
pub async fn download( &self, namespace: String, strategy: FetchStrategy, ) -> Result<u64>
Download selected folder content and return the transferred byte count.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn materialize_transfers(
&self,
namespace: Option<String>,
) -> Result<(u64, u64)>
pub async fn materialize_transfers( &self, namespace: Option<String>, ) -> Result<(u64, u64)>
Materialize pending transfer jobs and return completed and failed counts.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn import_files(
&self,
namespace: Option<String>,
path: PathBuf,
) -> Result<u64>
pub async fn import_files( &self, namespace: Option<String>, path: PathBuf, ) -> Result<u64>
Import files into a managed folder and return the imported entry count.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn watch_once(
&self,
namespace: Option<String>,
path: PathBuf,
filter: Option<FilterConfig>,
exclude: Vec<String>,
) -> Result<(u64, Vec<String>)>
pub async fn watch_once( &self, namespace: Option<String>, path: PathBuf, filter: Option<FilterConfig>, exclude: Vec<String>, ) -> Result<(u64, Vec<String>)>
One-shot filtered scan/import for watch --once. Returns the imported
entry count and the folder-relative paths rejected by the filter.
§Errors
Returns an error when the daemon request fails or returns an unexpected response.
Sourcepub async fn fetch_blob(
&self,
hash: String,
tickets: Vec<String>,
export_path: Option<PathBuf>,
) -> Result<String>
pub async fn fetch_blob( &self, hash: String, tickets: Vec<String>, export_path: Option<PathBuf>, ) -> Result<String>
Fetch and pin a content blob through the daemon and return its hash.
§Errors
Returns an error when the daemon request fails or returns an unexpected response.
Sourcepub async fn link_publish(
&self,
namespace: String,
link: String,
) -> Result<String>
pub async fn link_publish( &self, namespace: String, link: String, ) -> Result<String>
Publish a stable link into a managed folder through the daemon.
§Errors
Returns an error when the daemon request fails or returns an unexpected response.
Sourcepub async fn import_archive(
&self,
input: PathBuf,
target: PathBuf,
filter: Option<FilterConfig>,
) -> Result<DropImportResult>
pub async fn import_archive( &self, input: PathBuf, target: PathBuf, filter: Option<FilterConfig>, ) -> Result<DropImportResult>
Import an archive and return its resulting collection.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn export_archive(
&self,
namespace: String,
version: Option<String>,
output: PathBuf,
) -> Result<DropExportResult>
pub async fn export_archive( &self, namespace: String, version: Option<String>, output: PathBuf, ) -> Result<DropExportResult>
Export a managed folder as an archive.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn export_collection_archive(
&self,
collection: String,
version: Option<String>,
output: PathBuf,
filter: Option<FilterConfig>,
) -> Result<DropExportResult>
pub async fn export_collection_archive( &self, collection: String, version: Option<String>, output: PathBuf, filter: Option<FilterConfig>, ) -> Result<DropExportResult>
Export a collection found in a daemon-managed folder as an archive.
§Errors
Returns an error when the daemon request fails or returns an unexpected response.
Sourcepub async fn join(
&self,
ticket: String,
path: PathBuf,
mode: SyncMode,
filters: SubscribeFilters,
options: JoinOptions,
) -> Result<String>
pub async fn join( &self, ticket: String, path: PathBuf, mode: SyncMode, filters: SubscribeFilters, options: JoinOptions, ) -> Result<String>
Join a folder from a ticket.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn set_subscribe(
&self,
namespace: String,
enabled: bool,
filters: Option<SubscribeFilters>,
) -> Result<String>
pub async fn set_subscribe( &self, namespace: String, enabled: bool, filters: Option<SubscribeFilters>, ) -> Result<String>
Enable or disable subscription for a managed folder.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn subscribe_public(&self, ticket: String) -> Result<String>
pub async fn subscribe_public(&self, ticket: String) -> Result<String>
Subscribe to a public blob ticket.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn create_folder(
&self,
path: PathBuf,
mode: String,
indexing: bool,
) -> Result<String>
pub async fn create_folder( &self, path: PathBuf, mode: String, indexing: bool, ) -> Result<String>
Create a managed folder and return the daemon’s creation message.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn stats_files(&self, folder: PathBuf) -> Result<FileStatsReport>
pub async fn stats_files(&self, folder: PathBuf) -> Result<FileStatsReport>
Collect file statistics for a managed folder.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn list_entries(
&self,
folder: String,
enrich: bool,
) -> Result<Vec<EntryRow>>
pub async fn list_entries( &self, folder: String, enrich: bool, ) -> Result<Vec<EntryRow>>
List the metadata entries in a managed folder.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn verify_integrity(
&self,
path: PathBuf,
hash: Vec<String>,
path_filter: Option<String>,
glob_filter: Option<String>,
fix: bool,
from: Vec<String>,
) -> Result<String>
pub async fn verify_integrity( &self, path: PathBuf, hash: Vec<String>, path_filter: Option<String>, glob_filter: Option<String>, fix: bool, from: Vec<String>, ) -> Result<String>
Verify the integrity of a managed folder.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn unsubscribe(&self, namespace: String) -> Result<String>
pub async fn unsubscribe(&self, namespace: String) -> Result<String>
Remove a public blob subscription.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn leave_folder(
&self,
namespace: String,
delete_files: bool,
) -> Result<String>
pub async fn leave_folder( &self, namespace: String, delete_files: bool, ) -> Result<String>
Leave a managed folder.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Share a folder or one of its blobs and return the resulting message.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
List persisted shares.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Remove a folder share or one of its blob shares.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn snapshot_create(
&self,
path: PathBuf,
description: Option<String>,
threads: usize,
) -> Result<String>
pub async fn snapshot_create( &self, path: PathBuf, description: Option<String>, threads: usize, ) -> Result<String>
Create a snapshot and return its identifier message.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn snapshot_list(&self, path: PathBuf) -> Result<Vec<SnapshotInfo>>
pub async fn snapshot_list(&self, path: PathBuf) -> Result<Vec<SnapshotInfo>>
List snapshots for a folder.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn snapshot_delete(&self, id: String) -> Result<String>
pub async fn snapshot_delete(&self, id: String) -> Result<String>
Delete a snapshot.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn snapshot_diff(
&self,
path: PathBuf,
first: String,
second: String,
) -> Result<SnapshotDiffReport>
pub async fn snapshot_diff( &self, path: PathBuf, first: String, second: String, ) -> Result<SnapshotDiffReport>
Compare two snapshots.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn snapshot_restore(
&self,
path: PathBuf,
snapshot: String,
) -> Result<String>
pub async fn snapshot_restore( &self, path: PathBuf, snapshot: String, ) -> Result<String>
Restore a snapshot.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn collection_publish(
&self,
path: PathBuf,
namespace: String,
sequence: u64,
bootstrap: Vec<String>,
manifest_bytes: Option<Vec<u8>>,
) -> Result<String>
pub async fn collection_publish( &self, path: PathBuf, namespace: String, sequence: u64, bootstrap: Vec<String>, manifest_bytes: Option<Vec<u8>>, ) -> Result<String>
Publish a collection and return the daemon’s result message.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn enrich_sort(&self, path: PathBuf) -> Result<HashMap<String, usize>>
pub async fn enrich_sort(&self, path: PathBuf) -> Result<HashMap<String, usize>>
Return peer enrichment counts for a folder.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn network_invite(
&self,
network_id: String,
device: String,
) -> Result<String>
pub async fn network_invite( &self, network_id: String, device: String, ) -> Result<String>
Invite a device to a network.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn network_kick(
&self,
network_id: String,
device: String,
) -> Result<String>
pub async fn network_kick( &self, network_id: String, device: String, ) -> Result<String>
Remove a device from a network.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn network_leave(&self, network_id: String) -> Result<String>
pub async fn network_leave(&self, network_id: String) -> Result<String>
Leave a network.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn network_create(
&self,
name: String,
label: String,
invite_only: bool,
doc_ticket: Option<String>,
) -> Result<(String, String)>
pub async fn network_create( &self, name: String, label: String, invite_only: bool, doc_ticket: Option<String>, ) -> Result<(String, String)>
Create a network and return its structured identity.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn network_join(&self, ticket: String) -> Result<String>
pub async fn network_join(&self, ticket: String) -> Result<String>
Join a network from an invite ticket.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn peer_availability(
&self,
folder: String,
) -> Result<PeerAvailabilityReport>
pub async fn peer_availability( &self, folder: String, ) -> Result<PeerAvailabilityReport>
Report peer availability for a folder.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn package_info(
&self,
ticket: Option<String>,
hash: Option<String>,
node_id: Option<String>,
) -> Result<PackageInfoResult>
pub async fn package_info( &self, ticket: Option<String>, hash: Option<String>, node_id: Option<String>, ) -> Result<PackageInfoResult>
Inspect a package manifest.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn package_install(&self, ticket: String) -> Result<(String, String)>
pub async fn package_install(&self, ticket: String) -> Result<(String, String)>
Install a package and return its collection identity.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn indexing_enable(&self, namespace: String) -> Result<String>
pub async fn indexing_enable(&self, namespace: String) -> Result<String>
Enable indexing for a folder.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub async fn indexing_publish(
&self,
namespace: String,
catalog: String,
tags: Vec<String>,
) -> Result<String>
pub async fn indexing_publish( &self, namespace: String, catalog: String, tags: Vec<String>, ) -> Result<String>
Publish an indexing catalog and return the daemon’s result message.
§Errors
Returns an error if the daemon request fails or returns an unexpected response.
Sourcepub fn status_sync(&self) -> Result<DaemonStatus>
pub fn status_sync(&self) -> Result<DaemonStatus>
Perform a bounded synchronous status probe for routing decisions.
§Errors
Returns an error when the daemon does not answer a status request.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IpcClient
impl RefUnwindSafe for IpcClient
impl Send for IpcClient
impl Sync for IpcClient
impl Unpin for IpcClient
impl UnsafeUnpin for IpcClient
impl UnwindSafe for IpcClient
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more