pub struct IncrementalUpdater { /* private fields */ }Expand description
Manages incremental updates to the code graph.
Uses Merkle tree change detection to identify modified files, then selectively updates only the affected entities in the graph.
§Example
use codeprysm_core::incremental::IncrementalUpdater;
use std::path::Path;
let mut updater = IncrementalUpdater::new(
Path::new("./my-repo"),
Path::new("./.codeprysm"),
Path::new("./queries"),
)?;
// Perform incremental update
let result = updater.update_repository(false)?;
if result.has_changes() {
println!("Updated {} files", result.changes.total_changes());
}Implementations§
Source§impl IncrementalUpdater
impl IncrementalUpdater
Sourcepub fn new_with_embedded_queries(
repo_path: &Path,
prism_dir: &Path,
) -> Result<Self>
pub fn new_with_embedded_queries( repo_path: &Path, prism_dir: &Path, ) -> Result<Self>
Create a new incremental updater using embedded queries.
This is the preferred constructor for production use as it doesn’t require external query files.
§Arguments
repo_path- Path to the repository being indexedprism_dir- Path to the .codeprysm directory containing partitions
§Errors
Returns an error if the repository doesn’t exist.
Sourcepub fn with_embedded_queries(
repo_path: &Path,
prism_dir: &Path,
exclusion_filter: ExclusionFilter,
builder_config: BuilderConfig,
) -> Result<Self>
pub fn with_embedded_queries( repo_path: &Path, prism_dir: &Path, exclusion_filter: ExclusionFilter, builder_config: BuilderConfig, ) -> Result<Self>
Create an updater with embedded queries and custom configuration.
Sourcepub fn new(
repo_path: &Path,
prism_dir: &Path,
queries_dir: &Path,
) -> Result<Self>
pub fn new( repo_path: &Path, prism_dir: &Path, queries_dir: &Path, ) -> Result<Self>
Create a new incremental updater using query files.
§Arguments
repo_path- Path to the repository being indexedprism_dir- Path to the .codeprysm directory containing partitionsqueries_dir- Path to directory containing SCM query files
§Errors
Returns an error if the repository or queries directory doesn’t exist.
Sourcepub fn with_config(
repo_path: &Path,
prism_dir: &Path,
queries_dir: &Path,
exclusion_filter: ExclusionFilter,
builder_config: BuilderConfig,
) -> Result<Self>
pub fn with_config( repo_path: &Path, prism_dir: &Path, queries_dir: &Path, exclusion_filter: ExclusionFilter, builder_config: BuilderConfig, ) -> Result<Self>
Create an updater with custom configuration using query files.
Sourcepub fn load_graph_state(&mut self) -> Result<bool>
pub fn load_graph_state(&mut self) -> Result<bool>
Load the existing graph state from partitions.
§Returns
true if graph was loaded successfully, false if prism_dir doesn’t exist.
Sourcepub fn detect_repository_changes(&mut self) -> Result<ChangeSet>
pub fn detect_repository_changes(&mut self) -> Result<ChangeSet>
Detect changes in the repository since last update.
Builds a new Merkle tree from the current filesystem state and compares it with the stored state.
Sourcepub fn update_repository(&mut self, force_rebuild: bool) -> Result<UpdateResult>
pub fn update_repository(&mut self, force_rebuild: bool) -> Result<UpdateResult>
Sourcepub fn graph(&self) -> Option<&PetCodeGraph>
pub fn graph(&self) -> Option<&PetCodeGraph>
Get a reference to the current graph.
Sourcepub fn graph_mut(&mut self) -> Option<&mut PetCodeGraph>
pub fn graph_mut(&mut self) -> Option<&mut PetCodeGraph>
Get a mutable reference to the current graph.
Sourcepub fn merkle_tree(&self) -> &MerkleTree
pub fn merkle_tree(&self) -> &MerkleTree
Get the current Merkle tree.
Auto Trait Implementations§
impl Freeze for IncrementalUpdater
impl RefUnwindSafe for IncrementalUpdater
impl Send for IncrementalUpdater
impl Sync for IncrementalUpdater
impl Unpin for IncrementalUpdater
impl UnwindSafe for IncrementalUpdater
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more