pub trait StorageFileImportExt {
// Required methods
fn import_dir_recursively<P: AsRef<Path>>(
&self,
base_dir: P,
namespace: Option<&[u8]>,
) -> Result<Vec<(Vec<u8>, u64)>>;
fn read_file_entry<P: AsRef<Path>>(
&self,
rel_path: P,
namespace: Option<&[u8]>,
) -> Result<Option<EntryHandle>>;
fn open_file_stream<P: AsRef<Path>>(
&self,
rel_path: P,
namespace: Option<&[u8]>,
) -> Result<Option<EntryStream>>;
}
Expand description
Recursively walks a directory and imports files into the DataStore.
Keys are the relative Unix-style paths from base_dir
.
Required Methods§
Sourcefn import_dir_recursively<P: AsRef<Path>>(
&self,
base_dir: P,
namespace: Option<&[u8]>,
) -> Result<Vec<(Vec<u8>, u64)>>
fn import_dir_recursively<P: AsRef<Path>>( &self, base_dir: P, namespace: Option<&[u8]>, ) -> Result<Vec<(Vec<u8>, u64)>>
Adds all regular files under base_dir
into the DataStore.
Sourcefn read_file_entry<P: AsRef<Path>>(
&self,
rel_path: P,
namespace: Option<&[u8]>,
) -> Result<Option<EntryHandle>>
fn read_file_entry<P: AsRef<Path>>( &self, rel_path: P, namespace: Option<&[u8]>, ) -> Result<Option<EntryHandle>>
Retrieves a file entry stored in the DataStore, using a relative path and optional namespace.
This does not read from the actual filesystem. Instead, it accesses a previously imported file based on its logical key.
§Arguments
rel_path
: Relative path to the file, using OS-native separators.namespace
: Optional namespace used during import (if any).
§Returns
Ok(Some(EntryHandle))
: If the file exists in storage.Ok(None)
: If the key is missing or marked deleted.Err(std::io::Error)
: If a write or I/O operation fails.
Sourcefn open_file_stream<P: AsRef<Path>>(
&self,
rel_path: P,
namespace: Option<&[u8]>,
) -> Result<Option<EntryStream>>
fn open_file_stream<P: AsRef<Path>>( &self, rel_path: P, namespace: Option<&[u8]>, ) -> Result<Option<EntryStream>>
Opens a streaming reader for a file stored in the DataStore, identified by its relative path and optional namespace.
This reads from the internal append-only store — not the filesystem. Paths must match the relative structure used during import.
§Arguments
rel_path
: Relative path used during import (OS-native separators allowed).namespace
: Optional namespace prefix applied during import.
§Returns
Ok(Some(EntryStream))
: If the file exists in storage.Ok(None)
: If no entry is found or it has been evicted.Err(std::io::Error)
: If a write or I/O operation fails.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.