FileTransferServiceImpl

Struct FileTransferServiceImpl 

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

Default file transfer service implementation.

Implementations§

Source§

impl FileTransferServiceImpl

Source

pub async fn new( source_node: NodeId, backend: Arc<dyn MessageBackend>, stream_opener: Arc<dyn ChunkStreamOpener>, config: FileTransferConfig, ) -> Result<FileTransferServiceImpl, FileTransferError>

Creates a new service and starts internal control handling.

§Errors

Returns FileTransferError::Transport if subscribing to the backend fails.

§Panics

This method does not panic.

Source

pub fn control(&self) -> Arc<ControlDispatcher>

Returns the control dispatcher for sending/receiving control messages.

§Panics

This method does not panic.

Source

pub fn receive_handler(&self) -> Arc<ReceiveHandler>

Returns the receive handler for incoming transfer data.

§Panics

This method does not panic.

Source

pub fn path_validator(&self) -> &PathValidator

Returns the path validator used for file operations.

§Panics

This method does not panic.

Trait Implementations§

Source§

impl FileTransferService for FileTransferServiceImpl

Source§

fn send_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, target: NodeId, source_path: &'life1 Path, dest_path: &'life2 Path, options: TransferOptions, ) -> Pin<Box<dyn Future<Output = Result<TransferHandle, FileTransferError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, FileTransferServiceImpl: 'async_trait,

Sends a file to a target node. Read more
Source§

fn broadcast_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, source_path: &'life1 Path, dest_path: &'life2 Path, options: TransferOptions, ) -> Pin<Box<dyn Future<Output = Result<BroadcastHandle, FileTransferError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, FileTransferServiceImpl: 'async_trait,

Sends a file to all connected peers. Read more
Source§

fn sync_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, local_path: &'life1 Path, remote_path: &'life2 Path, targets: Option<Vec<NodeId>>, options: SyncOptions, ) -> Pin<Box<dyn Future<Output = Result<SyncHandle, FileTransferError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, FileTransferServiceImpl: 'async_trait,

Synchronizes a local path with a remote path. Read more
Source§

fn exists<'life0, 'life1, 'async_trait>( &'life0 self, target: NodeId, path: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<bool, FileTransferError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, FileTransferServiceImpl: 'async_trait,

Checks if a path exists on a target node. Read more
Source§

fn remove<'life0, 'life1, 'async_trait>( &'life0 self, target: NodeId, path: &'life1 Path, options: RemoveOptions, ) -> Pin<Box<dyn Future<Output = Result<(), FileTransferError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, FileTransferServiceImpl: 'async_trait,

Removes a file or directory on a target node. Read more
Source§

fn metadata<'life0, 'life1, 'async_trait>( &'life0 self, target: NodeId, path: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<FileMetadata, FileTransferError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, FileTransferServiceImpl: 'async_trait,

Fetches metadata for a file or directory on a target node. Read more
Source§

fn list_files<'life0, 'life1, 'async_trait>( &'life0 self, target: NodeId, dir_path: &'life1 Path, options: ListOptions, ) -> Pin<Box<dyn Future<Output = Result<Vec<FileInfo>, FileTransferError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, FileTransferServiceImpl: 'async_trait,

Lists files within a directory on a target node. Read more
Source§

fn cancel_transfer<'life0, 'async_trait>( &'life0 self, session_id: TransferSessionId, ) -> Pin<Box<dyn Future<Output = Result<(), FileTransferError>> + Send + 'async_trait>>
where 'life0: 'async_trait, FileTransferServiceImpl: 'async_trait,

Cancels an active transfer by session id. Read more
Source§

fn pause_transfer<'life0, 'async_trait>( &'life0 self, session_id: TransferSessionId, ) -> Pin<Box<dyn Future<Output = Result<(), FileTransferError>> + Send + 'async_trait>>
where 'life0: 'async_trait, FileTransferServiceImpl: 'async_trait,

Pauses an active transfer by session id. Read more
Source§

fn resume_transfer<'life0, 'async_trait>( &'life0 self, session_id: TransferSessionId, ) -> Pin<Box<dyn Future<Output = Result<TransferHandle, FileTransferError>> + Send + 'async_trait>>
where 'life0: 'async_trait, FileTransferServiceImpl: 'async_trait,

Resumes a paused transfer by session id. Read more
Source§

fn active_transfers(&self) -> Vec<TransferSessionInfo>

Returns a snapshot of active transfer sessions. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

Source§

type Output = T

Should always be Self
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> 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
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
Source§

impl<T> OptionalSend for T
where T: Send + ?Sized,

Source§

impl<T> OptionalSync for T
where T: Sync + ?Sized,