Create a new storage manager with the specified method and configuration
(
path: P,
method: StorageMethod,
storage_type: StorageType,
)
| 62 | impl StorageManager { |
| 63 | /// Create a new storage manager with the specified method and configuration |
| 64 | pub fn new<P: AsRef<Path>>( |
| 65 | path: P, |
| 66 | method: StorageMethod, |
| 67 | storage_type: StorageType, |
| 68 | ) -> Result<Self, Box<dyn std::error::Error>> { |
| 69 | info!( |
| 70 | "Creating storage manager with method: {:?}, storage type: {:?}", |
| 71 | method, storage_type |
| 72 | ); |
| 73 | |
| 74 | match method { |
| 75 | StorageMethod::DiskOnly => Self::init_disk_only(path, storage_type), |
| 76 | StorageMethod::MemoryOnly => Self::init_memory_only(path, storage_type), |
| 77 | StorageMethod::DiskAndMemory => Self::init_disk_and_memory(path, storage_type), |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | /// Initialize storage manager with disk-only storage (Sled) |
| 82 | fn init_disk_only<P: AsRef<Path>>( |
nothing calls this directly
no outgoing calls
no test coverage detected