Skip to main content

gradatum_storage/
lib.rs

1//! # gradatum-storage
2//!
3//! Storage trait abstraction avec backends OpenDAL (filesystem, S3, Azure Blob).
4//!
5//! ## Trait principal
6//!
7//! [`Storage`] — primitives async Read/Write/List/Delete/Stat/Exists.
8//!
9//! ## Implémentations
10//!
11//! - [`FileStorage`] — backend OpenDAL filesystem (feature `fs`, activée par défaut).
12//! - Backend S3 (feature `s3`) — non implémenté (planned).
13//! - Backend Azure Blob (feature `azblob`) — non implémenté (planned).
14//!
15//! ## Guard NFS (caveat C11)
16//!
17//! [`ensure_local_filesystem`] vérifie via `statfs(2)` que le chemin fourni n'est pas
18//! sur un montage NFS. Appelé automatiquement par `FileStorage::new()`.
19//! Retourne `Err(StorageError::Core(GradatumError::VaultOnNfs))` si NFS détecté.
20//!
21//! ## Stabilité
22//!
23//! `0.x` — pas de garantie de stabilité API. Voir
24//! [`RELEASE-POLICY.md`](https://github.com/gradatum/gradatum/blob/main/RELEASE-POLICY.md).
25//!
26//! ## Ref
27//!
28//! - Spec §0.3 C11
29
30#![forbid(unsafe_code)]
31#![warn(missing_docs)]
32#![warn(rust_2018_idioms)]
33
34pub mod error;
35pub mod nfs_check;
36pub mod storage_trait;
37
38#[cfg(feature = "fs")]
39pub mod file;
40
41// Re-exports publics.
42pub use error::StorageError;
43pub use nfs_check::ensure_local_filesystem;
44pub use storage_trait::{Storage, StorageEntry};
45
46#[cfg(feature = "fs")]
47pub use file::FileStorage;
48
49/// Version de la crate (depuis `workspace.package.version`).
50pub const VERSION: &str = env!("CARGO_PKG_VERSION");
51
52#[cfg(test)]
53mod tests {
54    use super::*;
55
56    #[test]
57    fn version_is_set() {
58        assert!(!VERSION.is_empty());
59    }
60}