prodigy/storage/
factory.rs1use super::error::StorageResult;
4use super::global::GlobalStorage;
5
6pub struct StorageFactory;
8
9impl StorageFactory {
10 pub async fn from_env() -> StorageResult<GlobalStorage> {
12 GlobalStorage::new()
13 }
14
15 #[cfg(test)]
17 pub fn create_test_storage() -> StorageResult<GlobalStorage> {
18 GlobalStorage::new()
19 }
20}
21
22#[cfg(test)]
23mod tests {
24 use super::*;
25
26 #[tokio::test]
27 async fn test_factory_creates_global_storage() {
28 let storage = StorageFactory::from_env().await.unwrap();
29 let health = storage.health_check().await.unwrap();
30 assert!(health.healthy);
31 }
32
33 #[test]
34 fn test_factory_creates_test_storage() {
35 let storage = StorageFactory::create_test_storage().unwrap();
36 assert!(storage.base_dir().exists());
39 }
40}