pub struct GraphStore { /* private fields */ }Implementations§
Source§impl GraphStore
impl GraphStore
Sourcepub fn open<P: AsRef<Path>>(path: P) -> Result<Self, StoreError>
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self, StoreError>
Opens or creates a graph store at the specified path. Returns an error if the cache version doesn’t match.
Sourcepub fn open_or_reset<P: AsRef<Path>>(path: P) -> Result<Self, StoreError>
pub fn open_or_reset<P: AsRef<Path>>(path: P) -> Result<Self, StoreError>
Opens a store, clearing it if version mismatches.
Everything goes through one handle. Dropping a sled handle releases
the directory lock only when its flusher thread exits, so re-opening
straight after open reported a mismatch could fail with “could not
acquire lock”, on the first run after an upgrade.
Sourcepub fn get_mtime(&self, file_path: &str) -> Result<Option<u64>, StoreError>
pub fn get_mtime(&self, file_path: &str) -> Result<Option<u64>, StoreError>
Gets the stored mtime for a file.
Sourcepub fn get_file_nodes(
&self,
file_path: &str,
) -> Result<Option<Vec<CodeNode>>, StoreError>
pub fn get_file_nodes( &self, file_path: &str, ) -> Result<Option<Vec<CodeNode>>, StoreError>
Gets the stored nodes for a file.
Sourcepub fn update_file(
&self,
file_path: &str,
nodes: &[CodeNode],
mtime: u64,
) -> Result<(), StoreError>
pub fn update_file( &self, file_path: &str, nodes: &[CodeNode], mtime: u64, ) -> Result<(), StoreError>
Updates the nodes and mtime for a specific file.
This operation is atomic: it removes old nodes associated with the file and inserts the new ones.
Sourcepub fn remove_file(&self, file_path: &str) -> Result<(), StoreError>
pub fn remove_file(&self, file_path: &str) -> Result<(), StoreError>
Removes a file from the cache (for deleted files).
Sourcepub fn list_cached_files(&self) -> Result<Vec<String>, StoreError>
pub fn list_cached_files(&self) -> Result<Vec<String>, StoreError>
Lists all cached file paths.
Sourcepub fn load_graph(&self) -> Result<ArborGraph, StoreError>
pub fn load_graph(&self) -> Result<ArborGraph, StoreError>
Loads the entire graph from the store.
This iterates over all stored nodes and reconstructs the ArborGraph using the GraphBuilder (which re-links edges).
Sourcepub fn clear(&self) -> Result<(), StoreError>
pub fn clear(&self) -> Result<(), StoreError>
Clears the stored graph.