Skip to main content

FileServiceClient

Struct FileServiceClient 

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

Client for an active fileservice session.

Implementations§

Source§

impl FileServiceClient

Source

pub async fn connect( control: XpcClient, domain: Domain, identifier: impl AsRef<str>, ) -> Result<Self, FileServiceError>

Create a new fileservice session in the requested domain.

Source

pub fn with_session(control: XpcClient, session_id: impl Into<String>) -> Self

Build a client from an existing session ID.

Source

pub fn session_id(&self) -> &str

Return the CoreDevice session identifier.

Source

pub async fn list_directory( &mut self, path: &str, ) -> Result<Vec<String>, FileServiceError>

List child names for path within the active session domain.

Source

pub async fn retrieve_file_ticket( &mut self, path: &str, ) -> Result<FileTransferTicket, FileServiceError>

Request a data-plane ticket for downloading path.

Source

pub async fn download_file<S>( &mut self, path: &str, data_stream: &mut S, ) -> Result<Bytes, FileServiceError>
where S: AsyncRead + AsyncWrite + Unpin,

Download path into memory through the data service stream.

Source

pub async fn download_file_to_writer<S, W>( &mut self, path: &str, data_stream: &mut S, writer: &mut W, ) -> Result<u64, FileServiceError>

Download path directly into an async writer through the data service stream.

Source

pub async fn propose_empty_file( &mut self, path: &str, options: FileWriteOptions, ) -> Result<(), FileServiceError>

Create an empty remote file with the supplied metadata.

Source

pub async fn remove_item( &mut self, path: &str, recursive: bool, ) -> Result<(), FileServiceError>

Remove a remote item.

Set recursive for directories. The device enforces the permissions of the selected session domain.

Source

pub async fn create_directory( &mut self, path: &str, options: FileWriteOptions, ) -> Result<(), FileServiceError>

Create a directory with the supplied metadata.

Source

pub async fn rename_item( &mut self, from: &str, to: &str, ) -> Result<(), FileServiceError>

Rename or move an item within the active session domain.

Source

pub async fn upload_inline_file( &mut self, path: &str, data: Bytes, options: FileWriteOptions, ) -> Result<(), FileServiceError>

Upload a small file by embedding its bytes in the control-plane request.

Source

pub async fn propose_file_upload( &mut self, path: &str, file_size: u64, options: FileWriteOptions, ) -> Result<FileTransferTicket, FileServiceError>

Request a data-plane upload ticket for a large file.

Source

pub async fn upload_file_data<S, R>( &mut self, data_stream: &mut S, ticket: &FileTransferTicket, reader: &mut R, file_size: u64, ) -> Result<(), FileServiceError>

Stream large file bytes to the data service using a previously issued ticket.

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, 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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: 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> 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