Skip to main content

SqliteGraphStore

Struct SqliteGraphStore 

Source
pub struct SqliteGraphStore { /* private fields */ }
Expand description

SQLite-backed implementation of the GraphStore trait.

Implementations§

Source§

impl SqliteGraphStore

Source

pub fn open(path: &str) -> Result<Self, GraphError>

Open or create a graph database at the given path.

Source

pub fn in_memory() -> Result<Self, GraphError>

Create an in-memory graph database (for testing).

Source

pub fn set_foreign_keys(&self, enabled: bool) -> Result<bool, GraphError>

Temporarily disable foreign key enforcement (for bulk re-map operations). Returns the actual FK state after the change (for verification).

Source

pub fn schema_version(&self) -> Result<u32, GraphError>

Get the current schema version.

Source

pub fn cleanup_orphaned_edges(&self) -> Result<u64, GraphError>

Remove edges whose source or target node no longer exists.

Source

pub fn clear_all(&mut self) -> Result<(), GraphError>

Clear all graph data (nodes, edges, etc.) for a full re-map. Preserves schema and metadata.

Source

pub fn upsert_module_profiles( &self, profiles: Vec<ModuleProfile>, ) -> Result<(), GraphError>

Insert or update module profiles in bulk. Uses INSERT … ON CONFLICT DO UPDATE for upsert semantics.

Source§

impl SqliteGraphStore

Source

pub fn load_circuit_breaker( &self, ) -> Result<Vec<(String, String, u32, bool)>, GraphError>

Load circuit breaker state from the database.

Source

pub fn save_circuit_breaker( &self, state: &[(String, String, u32, bool)], ) -> Result<(), GraphError>

Save circuit breaker state, replacing all existing rows.

Source

pub fn search_nodes( &self, query: &str, kind_filter: Option<&str>, limit: usize, ) -> Vec<GraphNode>

Search for nodes whose name contains the given substring (case-insensitive). Single SQL query instead of iterating modules + per-file lookups (N+1).

Source

pub fn insert_node(&self, node: &GraphNode) -> Result<(), GraphError>

Insert a node into the database, or update it on hash conflict (upsert).

Source

pub fn update_node_in_db(&self, node: &GraphNode) -> Result<(), GraphError>

Update an existing node by ID, preserving the old hash in previous_hashes.

Trait Implementations§

Source§

impl GraphStore for SqliteGraphStore

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.