Skip to main content

IpcClient

Struct IpcClient 

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

A client for sending requests to the daemon.

Implementations§

Source§

impl IpcClient

Source

pub fn new(data_dir: &Path) -> Self

Source

pub const fn from_socket_path(socket_path: PathBuf) -> Self

Source

pub fn socket_path(&self) -> &Path

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub async fn share( &self, namespace: String, blob: Option<String>, options: ShareOptions, ) -> Result<String>

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.

Source

pub async fn share_list(&self) -> Result<String>

List persisted shares.

§Errors

Returns an error if the daemon request fails or returns an unexpected response.

Source

pub async fn unshare( &self, namespace: String, blob: Option<String>, writable: bool, ) -> Result<String>

Remove a folder share or one of its blob shares.

§Errors

Returns an error if the daemon request fails or returns an unexpected response.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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§

Source§

impl Clone for IpcClient

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IpcClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more