MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / init_disk_only

Method init_disk_only

graphlite/src/storage/storage_manager.rs:82–122  ·  view source on GitHub ↗

Initialize storage manager with disk-only storage (Sled)

(
        path: P,
        storage_type: StorageType,
    )

Source from the content-addressed store, hash-verified

80
81 /// Initialize storage manager with disk-only storage (Sled)
82 fn init_disk_only<P: AsRef<Path>>(
83 path: P,
84 storage_type: StorageType,
85 ) -> Result<Self, Box<dyn std::error::Error>> {
86 info!(
87 "Initializing disk-only storage with {} at path: {:?}",
88 storage_type,
89 path.as_ref()
90 );
91
92 // Create single storage driver instance
93 let driver = create_storage_driver(storage_type, path.as_ref())?;
94
95 // Pre-create commonly used column families/trees
96 let common_trees = vec!["nodes", "edges", "metadata", "catalog", "auth"];
97 for tree_name in &common_trees {
98 driver.open_tree(tree_name)?;
99 debug!("Pre-created tree: {}", tree_name);
100 }
101
102 info!(
103 "Storage driver initialized with {} pre-created trees",
104 common_trees.len()
105 );
106
107 // Create DataAdapter (now stateless)
108 let persistent_store = Arc::new(DataAdapter::new());
109
110 // Create IndexManager for graph indexes
111 let driver_arc = Arc::new(driver);
112 let index_manager = Arc::new(IndexManager::new());
113
114 Ok(Self {
115 cache: Arc::new(MultiGraphManager::new()),
116 storage_driver: Some(driver_arc),
117 persistent_store: Some(persistent_store),
118 memory_store: None,
119 storage_type,
120 index_manager: Some(index_manager),
121 })
122 }
123
124 /// Initialize storage manager with memory-only storage (Redis/Valkey)
125 fn init_memory_only<P: AsRef<Path>>(

Callers

nothing calls this directly

Calls 2

create_storage_driverFunction · 0.85
open_treeMethod · 0.45

Tested by

no test coverage detected