pub struct VmgsClient { /* private fields */ }
Expand description
Client to interact with a backend-agnostic VMGS instance.
Implementations§
Source§impl VmgsClient
impl VmgsClient
Sourcepub async fn get_file_info(
&self,
file_id: FileId,
) -> Result<VmgsFileInfo, VmgsClientError>
pub async fn get_file_info( &self, file_id: FileId, ) -> Result<VmgsFileInfo, VmgsClientError>
Get allocated and valid bytes from File Control Block for file_id.
Sourcepub async fn read_file(
&self,
file_id: FileId,
) -> Result<Vec<u8>, VmgsClientError>
pub async fn read_file( &self, file_id: FileId, ) -> Result<Vec<u8>, VmgsClientError>
Reads the specified file_id
.
Sourcepub async fn write_file(
&self,
file_id: FileId,
buf: Vec<u8>,
) -> Result<(), VmgsClientError>
pub async fn write_file( &self, file_id: FileId, buf: Vec<u8>, ) -> Result<(), VmgsClientError>
Writes buf
to a file_id.
NOTE: It is an error to overwrite a previously encrypted FileId with plaintext data.
Sourcepub async fn write_file_encrypted(
&self,
file_id: FileId,
buf: Vec<u8>,
) -> Result<(), VmgsClientError>
pub async fn write_file_encrypted( &self, file_id: FileId, buf: Vec<u8>, ) -> Result<(), VmgsClientError>
If VMGS has been configured with encryption, encrypt + write bug
to
the specified file_id
. Otherwise, perform a regular plaintext write
instead.
Sourcepub async fn save(&self) -> Result<SavedVmgsState, VmgsClientError>
pub async fn save(&self) -> Result<SavedVmgsState, VmgsClientError>
Save the in-memory VMGS file metadata.
This saved state can be used alongside open_from_saved
to obtain a
new Vmgs
instance without needing to invoke any IOs on the
underlying storage.
Trait Implementations§
Source§impl Clone for VmgsClient
impl Clone for VmgsClient
Source§fn clone(&self) -> VmgsClient
fn clone(&self) -> VmgsClient
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for VmgsClient
impl !RefUnwindSafe for VmgsClient
impl Send for VmgsClient
impl Sync for VmgsClient
impl Unpin for VmgsClient
impl !UnwindSafe for VmgsClient
Blanket Implementations§
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
Mutably borrows from an owned value. Read more