pub struct FileServiceClient { /* private fields */ }Expand description
Client for an active fileservice session.
Implementations§
Source§impl FileServiceClient
impl FileServiceClient
Sourcepub async fn connect(
control: XpcClient,
domain: Domain,
identifier: impl AsRef<str>,
) -> Result<Self, FileServiceError>
pub async fn connect( control: XpcClient, domain: Domain, identifier: impl AsRef<str>, ) -> Result<Self, FileServiceError>
Create a new fileservice session in the requested domain.
Sourcepub fn with_session(control: XpcClient, session_id: impl Into<String>) -> Self
pub fn with_session(control: XpcClient, session_id: impl Into<String>) -> Self
Build a client from an existing session ID.
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
Return the CoreDevice session identifier.
Sourcepub async fn list_directory(
&mut self,
path: &str,
) -> Result<Vec<String>, FileServiceError>
pub async fn list_directory( &mut self, path: &str, ) -> Result<Vec<String>, FileServiceError>
List child names for path within the active session domain.
Sourcepub async fn retrieve_file_ticket(
&mut self,
path: &str,
) -> Result<FileTransferTicket, FileServiceError>
pub async fn retrieve_file_ticket( &mut self, path: &str, ) -> Result<FileTransferTicket, FileServiceError>
Request a data-plane ticket for downloading path.
Sourcepub async fn download_file<S>(
&mut self,
path: &str,
data_stream: &mut S,
) -> Result<Bytes, FileServiceError>
pub async fn download_file<S>( &mut self, path: &str, data_stream: &mut S, ) -> Result<Bytes, FileServiceError>
Download path into memory through the data service stream.
Sourcepub async fn download_file_to_writer<S, W>(
&mut self,
path: &str,
data_stream: &mut S,
writer: &mut W,
) -> Result<u64, FileServiceError>
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.
Sourcepub async fn propose_empty_file(
&mut self,
path: &str,
options: FileWriteOptions,
) -> Result<(), FileServiceError>
pub async fn propose_empty_file( &mut self, path: &str, options: FileWriteOptions, ) -> Result<(), FileServiceError>
Create an empty remote file with the supplied metadata.
Sourcepub async fn remove_item(
&mut self,
path: &str,
recursive: bool,
) -> Result<(), FileServiceError>
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.
Sourcepub async fn create_directory(
&mut self,
path: &str,
options: FileWriteOptions,
) -> Result<(), FileServiceError>
pub async fn create_directory( &mut self, path: &str, options: FileWriteOptions, ) -> Result<(), FileServiceError>
Create a directory with the supplied metadata.
Sourcepub async fn rename_item(
&mut self,
from: &str,
to: &str,
) -> Result<(), FileServiceError>
pub async fn rename_item( &mut self, from: &str, to: &str, ) -> Result<(), FileServiceError>
Rename or move an item within the active session domain.
Sourcepub async fn upload_inline_file(
&mut self,
path: &str,
data: Bytes,
options: FileWriteOptions,
) -> Result<(), FileServiceError>
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.
Sourcepub async fn propose_file_upload(
&mut self,
path: &str,
file_size: u64,
options: FileWriteOptions,
) -> Result<FileTransferTicket, FileServiceError>
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.
Sourcepub async fn upload_file_data<S, R>(
&mut self,
data_stream: &mut S,
ticket: &FileTransferTicket,
reader: &mut R,
file_size: u64,
) -> Result<(), FileServiceError>
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.