|
1 | 1 | // lib/src/database.rs |
2 | 2 | // Corrected: 2025-07-02 - Final version ensuring correct trait usage and error handling. |
3 | | -// Fixed models import path and conditional RocksDBStorage import. |
| 3 | +// Fixed: 2025-07-02 - Corrected import for SledStorage and RocksDBStorage, and models crate. |
4 | 4 |
|
5 | 5 | use std::sync::Arc; |
6 | | -// Conditionally import RocksDBStorage |
7 | | -#[cfg(feature = "with-rocksdb")] |
8 | | -use crate::storage_engine::RocksDBStorage; |
9 | | -use crate::storage_engine::{GraphStorageEngine, SledGraphStorage, StorageConfig, StorageEngineType, open_sled_db}; |
10 | | -use models::{Vertex, Edge, Identifier}; // Corrected: Removed `crate::` prefix |
| 6 | +// Corrected imports for SledStorage and RocksDBStorage to use their full paths |
| 7 | +use crate::storage_engine::{GraphStorageEngine, StorageConfig, StorageEngineType, open_sled_db}; |
| 8 | +use crate::storage_engine::sled_storage::SledStorage; // Explicitly import SledStorage |
| 9 | +#[cfg(feature = "with-rocksdb")] // Apply cfg to the import itself |
| 10 | +use crate::storage_engine::rocksdb_storage::RocksDBStorage; // Explicitly import RocksDBStorage |
| 11 | + |
| 12 | +// Corrected import for models crate (it's a separate crate, not a module within `crate`) |
| 13 | +use models::{Vertex, Edge, Identifier}; |
11 | 14 | use models::errors::{GraphError, GraphResult}; // Use GraphResult directly |
12 | 15 | use uuid::Uuid; |
13 | 16 | use serde_json::Value; // For query results |
@@ -35,9 +38,9 @@ impl Database { |
35 | 38 | pub async fn new(config: StorageConfig) -> GraphResult<Self> { |
36 | 39 | let storage_engine: Arc<dyn GraphStorageEngine> = match config.engine_type { |
37 | 40 | StorageEngineType::Sled => { |
38 | | - // Open Sled DB and create SledGraphStorage |
| 41 | + // Open Sled DB and create SledStorage |
39 | 42 | let db = open_sled_db(&config.data_path)?; |
40 | | - Arc::new(SledGraphStorage::new(db)?) |
| 43 | + Arc::new(SledStorage::new(db)?) |
41 | 44 | }, |
42 | 45 | StorageEngineType::RocksDB => { |
43 | 46 | // Conditionally compile RocksDB initialization if the feature is enabled |
|
0 commit comments