pub trait FileSystem:
Debug
+ Send
+ Sync {
// Required methods
fn list(&self, prefix: &str) -> BoxStream<'_, VortexResult<FileListing>>;
fn head<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = VortexResult<Option<FileListing>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn open_read<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = VortexResult<Arc<dyn VortexReadAt>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = VortexResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
A storage-agnostic filesystem interface for discovering and reading Vortex files.
Implementations handle the details of a particular storage backend (local disk, S3, GCS, etc.) while consumers work through this uniform interface.
§Paths
Path strings are literal object keys / file paths: the characters are used verbatim, with no
shell-style ~ expansion (~ is a literal tilde, not the home directory) and no
percent-encoding or -decoding applied by this layer (%20 is the three characters %, 2,
0, not a space). A path produced by list or head
is the object’s actual key, so it can be passed straight back to
open_read — including when it contains characters such as ~, %,
[, ], or #.
§Future Work
An open_write method will be added once VortexWrite is
object-safe (it currently uses impl Future return types which prevent trait-object usage).
Required Methods§
Sourcefn list(&self, prefix: &str) -> BoxStream<'_, VortexResult<FileListing>>
fn list(&self, prefix: &str) -> BoxStream<'_, VortexResult<FileListing>>
Recursively list files whose paths start with prefix.
When prefix is empty, all files are listed. Implementations must recurse into
subdirectories so that the returned stream contains every file reachable under the prefix.
Returns a stream of FileListing entries. The stream may yield entries in any order;
callers should sort if deterministic ordering is required.
Sourcefn head<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = VortexResult<Option<FileListing>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn head<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = VortexResult<Option<FileListing>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch metadata for the file at the exact path, if it exists.
Unlike list, which enumerates files under a prefix on a
path-segment basis and never yields the prefix itself, head looks up the object at
exactly path. It is the correct primitive for confirming that a single known file
exists and reading its size.
Returns Ok(Some(_)) with the file’s FileListing when it exists, Ok(None) when no
file exists at path, and Err(_) for any other failure (I/O or permission errors, etc.).
Sourcefn open_read<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = VortexResult<Arc<dyn VortexReadAt>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn open_read<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = VortexResult<Arc<dyn VortexReadAt>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Open a file for reading at the given path.
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = VortexResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Implementations§
Source§impl dyn FileSystem + '_
impl dyn FileSystem + '_
Sourcepub fn glob(
&self,
pattern: &str,
) -> VortexResult<BoxStream<'_, VortexResult<FileListing>>>
pub fn glob( &self, pattern: &str, ) -> VortexResult<BoxStream<'_, VortexResult<FileListing>>>
Expand a glob pattern, returning matching files as a stream.
Extracts the directory prefix before the first glob character and uses it
to narrow the list call. The full glob pattern is
then applied as a filter over the listed entries.
Escaped glob characters (\*, \?, \[) are not supported.
Source§impl dyn FileSystem + 'static
impl dyn FileSystem + 'static
Sourcepub fn with_prefix(self: Arc<Self>, prefix: String) -> FileSystemRef
pub fn with_prefix(self: Arc<Self>, prefix: String) -> FileSystemRef
Create a new filesystem that applies the given prefix to all operations on this filesystem.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl FileSystem for ObjectStoreFileSystem
impl<F: FileSystem> FileSystem for Compat<F>
Compatibility adapter for FileSystem implementations that are based on Tokio.