pub trait Vfs {
Show 23 methods
// Required methods
fn get_file<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 VfsFileId,
) -> Pin<Box<dyn Future<Output = Result<Option<VfsFile>, BackendApiError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn upsert_file<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 VfsFileId,
data: Bytes,
retries: usize,
) -> Pin<Box<dyn Future<Output = Result<Empty, BackendApiError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn delete_file<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 VfsFileId,
) -> Pin<Box<dyn Future<Output = Result<Empty, BackendApiError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn list_directory<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 VfsDirectory,
) -> Pin<Box<dyn Future<Output = Result<VfsDirectoryList, BackendApiError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn encrypt_json<T>(&self, file_id: VfsFileId, value: &T) -> VfsFile
where T: Serialize;
fn encrypt_ldk_writeable<W>(
&self,
file_id: VfsFileId,
writeable: &W,
) -> VfsFile
where W: Writeable;
fn encrypt_bytes(
&self,
file_id: VfsFileId,
plaintext_bytes: &[u8],
) -> VfsFile;
fn decrypt_file(
&self,
expected_file_id: &VfsFileId,
file: VfsFile,
) -> Result<Vec<u8>, Error>;
// Provided methods
fn get_directory<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 VfsDirectory,
) -> Pin<Box<dyn Future<Output = Result<Vec<VfsFile>, BackendApiError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait { ... }
fn read_json<'life0, 'life1, 'async_trait, T>(
&'life0 self,
file_id: &'life1 VfsFileId,
) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait + DeserializeOwned,
Self: Sync + 'async_trait { ... }
fn read_dir_json<'life0, 'life1, 'async_trait, T>(
&'life0 self,
dir: &'life1 VfsDirectory,
) -> Pin<Box<dyn Future<Output = Result<Vec<(VfsFileId, T)>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait + DeserializeOwned,
Self: Sync + 'async_trait { ... }
fn read_readableargs<'life0, 'life1, 'async_trait, T, A>(
&'life0 self,
file_id: &'life1 VfsFileId,
read_args: A,
) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
T: ReadableArgs<A> + 'async_trait,
A: Send + 'async_trait,
Self: Sync + 'async_trait { ... }
fn read_dir_maybereadable<'life0, 'life1, 'async_trait, T>(
&'life0 self,
dir: &'life1 VfsDirectory,
) -> Pin<Box<dyn Future<Output = Result<Vec<(VfsFileId, T)>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait + MaybeReadable,
Self: Sync + 'async_trait { ... }
fn read_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 VfsFileId,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait { ... }
fn read_dir_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 VfsDirectory,
) -> Pin<Box<dyn Future<Output = Result<Vec<(VfsFileId, Vec<u8>)>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait { ... }
fn read_file<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 VfsFileId,
) -> Pin<Box<dyn Future<Output = Result<Option<VfsFile>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait { ... }
fn read_dir_files<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 VfsDirectory,
) -> Pin<Box<dyn Future<Output = Result<Vec<VfsFile>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait { ... }
fn deser_readableargs<T, A>(
file_id: &VfsFileId,
bytes: &[u8],
read_args: A,
) -> Result<T, Error>
where T: ReadableArgs<A>,
A: Send { ... }
fn persist_json<'life0, 'life1, 'async_trait, T>(
&'life0 self,
file_id: VfsFileId,
value: &'life1 T,
retries: usize,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait + Serialize + Send + Sync,
Self: Sync + 'async_trait { ... }
fn persist_ldk_writeable<'life0, 'life1, 'async_trait, W>(
&'life0 self,
file_id: VfsFileId,
writeable: &'life1 W,
retries: usize,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
W: 'async_trait + Writeable + Send + Sync,
Self: Sync + 'async_trait { ... }
fn persist_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: VfsFileId,
plaintext_bytes: &'life1 [u8],
retries: usize,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait { ... }
fn persist_file<'life0, 'async_trait>(
&'life0 self,
file: VfsFile,
retries: usize,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: Sync + 'async_trait { ... }
fn remove_file<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 VfsFileId,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait { ... }
}Expand description
Lexe’s async persistence interface.
Required Methods§
Sourcefn get_file<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 VfsFileId,
) -> Pin<Box<dyn Future<Output = Result<Option<VfsFile>, BackendApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_file<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 VfsFileId,
) -> Pin<Box<dyn Future<Output = Result<Option<VfsFile>, BackendApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Fetch the given VfsFile from the backend.
Prefer Vfs::read_file which adds logging and error context.
Sourcefn upsert_file<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 VfsFileId,
data: Bytes,
retries: usize,
) -> Pin<Box<dyn Future<Output = Result<Empty, BackendApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn upsert_file<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 VfsFileId,
data: Bytes,
retries: usize,
) -> Pin<Box<dyn Future<Output = Result<Empty, BackendApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Upsert the given file to the backend with the given # of retries.
Prefer Vfs::persist_file which adds logging and error context.
Sourcefn delete_file<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 VfsFileId,
) -> Pin<Box<dyn Future<Output = Result<Empty, BackendApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn delete_file<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 VfsFileId,
) -> Pin<Box<dyn Future<Output = Result<Empty, BackendApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Deletes the VfsFile with the given VfsFileId from the backend.
Prefer Vfs::remove_file which adds logging and error context.
Sourcefn list_directory<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 VfsDirectory,
) -> Pin<Box<dyn Future<Output = Result<VfsDirectoryList, BackendApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn list_directory<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 VfsDirectory,
) -> Pin<Box<dyn Future<Output = Result<VfsDirectoryList, BackendApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
List all filenames in the given VfsDirectory.
Returns a VfsDirectoryList containing the directory name and all
filenames.
Sourcefn encrypt_json<T>(&self, file_id: VfsFileId, value: &T) -> VfsFilewhere
T: Serialize,
fn encrypt_json<T>(&self, file_id: VfsFileId, value: &T) -> VfsFilewhere
T: Serialize,
Serialize T then encrypt it to a file under the VFS master key.
Sourcefn encrypt_ldk_writeable<W>(&self, file_id: VfsFileId, writeable: &W) -> VfsFilewhere
W: Writeable,
fn encrypt_ldk_writeable<W>(&self, file_id: VfsFileId, writeable: &W) -> VfsFilewhere
W: Writeable,
Serialize a LDK Writeable then encrypt it under the VFS master key.
Sourcefn encrypt_bytes(&self, file_id: VfsFileId, plaintext_bytes: &[u8]) -> VfsFile
fn encrypt_bytes(&self, file_id: VfsFileId, plaintext_bytes: &[u8]) -> VfsFile
Encrypt plaintext bytes to a file under the VFS master key.
Prefer Vfs::encrypt_json and Vfs::encrypt_ldk_writeable, since
those avoid the need to write to an intermediate plaintext buffer.
Provided Methods§
Sourcefn get_directory<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 VfsDirectory,
) -> Pin<Box<dyn Future<Output = Result<Vec<VfsFile>, BackendApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn get_directory<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 VfsDirectory,
) -> Pin<Box<dyn Future<Output = Result<Vec<VfsFile>, BackendApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Fetches all files in the given VfsDirectory from the backend.
Prefer Vfs::read_dir_files which adds logging and error context.
Sourcefn read_json<'life0, 'life1, 'async_trait, T>(
&'life0 self,
file_id: &'life1 VfsFileId,
) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait + DeserializeOwned,
Self: Sync + 'async_trait,
fn read_json<'life0, 'life1, 'async_trait, T>(
&'life0 self,
file_id: &'life1 VfsFileId,
) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait + DeserializeOwned,
Self: Sync + 'async_trait,
Reads, decrypts, and JSON-deserializes a type T from the DB.
Sourcefn read_dir_json<'life0, 'life1, 'async_trait, T>(
&'life0 self,
dir: &'life1 VfsDirectory,
) -> Pin<Box<dyn Future<Output = Result<Vec<(VfsFileId, T)>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait + DeserializeOwned,
Self: Sync + 'async_trait,
fn read_dir_json<'life0, 'life1, 'async_trait, T>(
&'life0 self,
dir: &'life1 VfsDirectory,
) -> Pin<Box<dyn Future<Output = Result<Vec<(VfsFileId, T)>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait + DeserializeOwned,
Self: Sync + 'async_trait,
Reads, decrypts, and JSON-deserializes a VfsDirectory of type T.
Sourcefn read_readableargs<'life0, 'life1, 'async_trait, T, A>(
&'life0 self,
file_id: &'life1 VfsFileId,
read_args: A,
) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: ReadableArgs<A> + 'async_trait,
A: Send + 'async_trait,
Self: Sync + 'async_trait,
fn read_readableargs<'life0, 'life1, 'async_trait, T, A>(
&'life0 self,
file_id: &'life1 VfsFileId,
read_args: A,
) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: ReadableArgs<A> + 'async_trait,
A: Send + 'async_trait,
Self: Sync + 'async_trait,
Reads, decrypts, and deserializes a LDK ReadableArgs of type T
with read args A from the DB.
Sourcefn read_dir_maybereadable<'life0, 'life1, 'async_trait, T>(
&'life0 self,
dir: &'life1 VfsDirectory,
) -> Pin<Box<dyn Future<Output = Result<Vec<(VfsFileId, T)>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait + MaybeReadable,
Self: Sync + 'async_trait,
fn read_dir_maybereadable<'life0, 'life1, 'async_trait, T>(
&'life0 self,
dir: &'life1 VfsDirectory,
) -> Pin<Box<dyn Future<Output = Result<Vec<(VfsFileId, T)>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait + MaybeReadable,
Self: Sync + 'async_trait,
Reads, decrypts, and deserializes a VfsDirectory of LDK
MaybeReadables from the DB, along with their VfsFileIds.
None values are omitted from the result.
Sourcefn read_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 VfsFileId,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn read_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 VfsFileId,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Reads and decrypts VfsFile bytes from the DB.
Sourcefn read_dir_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 VfsDirectory,
) -> Pin<Box<dyn Future<Output = Result<Vec<(VfsFileId, Vec<u8>)>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn read_dir_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 VfsDirectory,
) -> Pin<Box<dyn Future<Output = Result<Vec<(VfsFileId, Vec<u8>)>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Reads and decrypts all files in the given VfsDirectory from the DB,
returning the VfsFileId and plaintext bytes for each file.
Sourcefn read_file<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 VfsFileId,
) -> Pin<Box<dyn Future<Output = Result<Option<VfsFile>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn read_file<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 VfsFileId,
) -> Pin<Box<dyn Future<Output = Result<Option<VfsFile>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Wraps Vfs::get_file to add logging and error context.
Sourcefn read_dir_files<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 VfsDirectory,
) -> Pin<Box<dyn Future<Output = Result<Vec<VfsFile>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn read_dir_files<'life0, 'life1, 'async_trait>(
&'life0 self,
dir: &'life1 VfsDirectory,
) -> Pin<Box<dyn Future<Output = Result<Vec<VfsFile>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Wraps Vfs::get_directory to add logging and error context.
Sourcefn deser_readableargs<T, A>(
file_id: &VfsFileId,
bytes: &[u8],
read_args: A,
) -> Result<T, Error>where
T: ReadableArgs<A>,
A: Send,
fn deser_readableargs<T, A>(
file_id: &VfsFileId,
bytes: &[u8],
read_args: A,
) -> Result<T, Error>where
T: ReadableArgs<A>,
A: Send,
Deserializes a LDK ReadableArgs of type T from bytes.
Sourcefn persist_json<'life0, 'life1, 'async_trait, T>(
&'life0 self,
file_id: VfsFileId,
value: &'life1 T,
retries: usize,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
fn persist_json<'life0, 'life1, 'async_trait, T>( &'life0 self, file_id: VfsFileId, value: &'life1 T, retries: usize, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
JSON-serializes, encrypts, then persists a type T to the DB.
Sourcefn persist_ldk_writeable<'life0, 'life1, 'async_trait, W>(
&'life0 self,
file_id: VfsFileId,
writeable: &'life1 W,
retries: usize,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
fn persist_ldk_writeable<'life0, 'life1, 'async_trait, W>( &'life0 self, file_id: VfsFileId, writeable: &'life1 W, retries: usize, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
Serializes, encrypts, then persists a LDK Writeable to the DB.
Sourcefn persist_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: VfsFileId,
plaintext_bytes: &'life1 [u8],
retries: usize,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn persist_bytes<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: VfsFileId,
plaintext_bytes: &'life1 [u8],
retries: usize,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Encrypts plaintext bytes then persists them to the DB.
Prefer Vfs::persist_json and Vfs::persist_ldk_writeable, since
those avoid the need to write to an intermediate plaintext buffer.
Sourcefn persist_file<'life0, 'async_trait>(
&'life0 self,
file: VfsFile,
retries: usize,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn persist_file<'life0, 'async_trait>(
&'life0 self,
file: VfsFile,
retries: usize,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
Wraps Vfs::upsert_file to add logging and error context.
Sourcefn remove_file<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 VfsFileId,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn remove_file<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 VfsFileId,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Wraps Vfs::delete_file to add logging and error context.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".