pub struct FileStorage { /* private fields */ }Expand description
Implémentation Storage via le backend filesystem OpenDAL.
Thread-safe — Operator est Clone + Send + Sync en interne.
Implementations§
Source§impl FileStorage
impl FileStorage
Sourcepub fn new(root: &Path) -> Result<Self, StorageError>
pub fn new(root: &Path) -> Result<Self, StorageError>
Construit un FileStorage enraciné à root.
§Caveat C11
Appelle ensure_local_filesystem(root) en premier. Retourne
Err(StorageError::Core(GradatumError::VaultOnNfs)) si NFS détecté.
§Erreurs
StorageError::Core(VaultOnNfs)— chemin sur NFS.StorageError::InvalidPath— chemin non convertible en UTF-8.StorageError::OpenDal— échec de construction de l’Operator.
Trait Implementations§
Source§impl Storage for FileStorage
impl Storage for FileStorage
Source§fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Lit le contenu d’un fichier au chemin relatif path.
path est relatif à la racine du storage.
§Erreurs
StorageError::InvalidPath— chemin absolu ou contenant..(E-29).
Source§fn write<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
content: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn write<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
content: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Écrit content au chemin relatif path.
Les répertoires intermédiaires sont créés automatiquement par OpenDAL/Fs.
§Erreurs
StorageError::InvalidPath— chemin absolu ou contenant..(E-29).
Source§fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + 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 = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Supprime le fichier au chemin relatif path.
§Erreurs
StorageError::InvalidPath— chemin absolu ou contenant..(E-29).
Source§fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<StorageEntry>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<StorageEntry>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Liste les entrées dont le chemin commence par prefix.
Retourne une liste plate (non-récursive par entrée mais scan récursif du prefix). Les répertoires sont inclus si retournés par le backend.
§Erreurs
StorageError::InvalidPath— chemin absolu ou contenant..(E-29).
Source§fn stat<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<StorageEntry, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stat<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<StorageEntry, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retourne les métadonnées de l’objet à path.
§Erreurs
StorageError::InvalidPath— chemin absolu ou contenant..(E-29).
Source§fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retourne true si un objet existe à path, false sinon.
§Erreurs
StorageError::InvalidPath— chemin absolu ou contenant..(E-29).
Source§fn create_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Crée le répertoire à path (idempotent).
Délègue à Operator::create_dir — opération native OpenDAL.
Le chemin doit se terminer par / (exigence OpenDAL).
§Erreurs
StorageError::InvalidPath— chemin absolu ou contenant..(E-29).