Skip to main content

GraphStore

Trait GraphStore 

Source
pub trait GraphStore {
    // Required methods
    fn get_node(&self, hash: &str) -> Option<GraphNode>;
    fn get_node_by_id(&self, id: u64) -> Option<GraphNode>;
    fn get_edges(
        &self,
        node_id: u64,
        direction: EdgeDirection,
    ) -> Vec<GraphEdge>;
    fn get_module_profile(&self, module_id: u64) -> Option<ModuleProfile>;
    fn get_nodes_in_file(&self, file_path: &str) -> Vec<GraphNode>;
    fn get_all_modules(&self) -> Vec<GraphNode>;
    fn update_nodes(
        &mut self,
        changes: Vec<NodeChange>,
    ) -> Result<(), GraphError>;
    fn update_edges(
        &mut self,
        changes: Vec<EdgeChange>,
    ) -> Result<(), GraphError>;
    fn get_previous_hashes(&self, node_id: u64) -> Vec<String>;
    fn find_modules_by_prefix(
        &self,
        prefix: &str,
        exclude_file: &str,
    ) -> Vec<ModuleProfile>;
    fn find_nodes_by_name(
        &self,
        name: &str,
        kind: &str,
        exclude_file: &str,
    ) -> Vec<GraphNode>;
}
Expand description

FROZEN CONTRACT — GraphStore trait.

Agent A owns this interface. Agents B and C consume it. Do NOT modify this trait signature without coordination.

Required Methods§

Source

fn get_node(&self, hash: &str) -> Option<GraphNode>

Look up a node by its content hash.

Source

fn get_node_by_id(&self, id: u64) -> Option<GraphNode>

Look up a node by its internal ID.

Source

fn get_edges(&self, node_id: u64, direction: EdgeDirection) -> Vec<GraphEdge>

Get edges connected to a node in the specified direction.

Source

fn get_module_profile(&self, module_id: u64) -> Option<ModuleProfile>

Get the module profile for a given module node.

Source

fn get_nodes_in_file(&self, file_path: &str) -> Vec<GraphNode>

Get all nodes in a specific file.

Source

fn get_all_modules(&self) -> Vec<GraphNode>

Get all module-type nodes in the graph.

Source

fn update_nodes(&mut self, changes: Vec<NodeChange>) -> Result<(), GraphError>

Apply a batch of node changes (add, update, remove).

Source

fn update_edges(&mut self, changes: Vec<EdgeChange>) -> Result<(), GraphError>

Apply a batch of edge changes (add, remove).

Source

fn get_previous_hashes(&self, node_id: u64) -> Vec<String>

Get previous hashes for rename tracking.

Source

fn find_modules_by_prefix( &self, prefix: &str, exclude_file: &str, ) -> Vec<ModuleProfile>

Find modules whose function_name_prefixes contain the given prefix, excluding modules in the specified file. Used by W001 placement check.

Source

fn find_nodes_by_name( &self, name: &str, kind: &str, exclude_file: &str, ) -> Vec<GraphNode>

Find nodes with the given name and kind, excluding a specific file. Used by W002 duplicate_name check.

Implementors§