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

Method list_graphs

graphlite/src/storage/data_adapter.rs:427–448  ·  view source on GitHub ↗

List all available graphs in storage

(
        &self,
        driver: &dyn StorageDriver<Tree = Box<dyn StorageTree>>,
    )

Source from the content-addressed store, hash-verified

425
426 /// List all available graphs in storage
427 pub fn list_graphs(
428 &self,
429 driver: &dyn StorageDriver<Tree = Box<dyn StorageTree>>,
430 ) -> Result<Vec<String>, Box<dyn std::error::Error>> {
431 let mut graph_names = std::collections::HashSet::new();
432
433 // Scan all trees and extract graph names from tree names
434 // Tree names follow pattern: {table}_{graph_path}
435 let tree_names = driver.list_trees()?;
436
437 for tree_name in tree_names {
438 // Extract graph path from tree names like "nodes_graph1", "edges_graph2", etc.
439 if let Some(graph_path) = self.extract_graph_path_from_tree_name(&tree_name) {
440 graph_names.insert(graph_path);
441 }
442 }
443
444 // Convert to sorted vector
445 let mut result: Vec<String> = graph_names.into_iter().collect();
446 result.sort();
447 Ok(result)
448 }
449
450 /// Extract graph path from tree name
451 fn extract_graph_path_from_tree_name(&self, tree_name: &str) -> Option<String> {

Callers 1

Calls 3

list_treesMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected