pub struct CfgStore {
pub octree: Octree,
/* private fields */
}Expand description
CFG Store - combines octree + storage for efficient CFG queries
Fields§
§octree: OctreeOctree spatial index (public for persistence)
Implementations§
Source§impl CfgStore
impl CfgStore
pub fn create(path: &Path) -> Result<Self>
pub fn open(path: &Path) -> Result<Self>
pub fn insert_block(&mut self, block: CfgBlock) -> Result<u64>
pub fn insert_blocks(&mut self, blocks: Vec<CfgBlock>) -> Result<()>
pub fn query_nearby(&self, point: Vec3, radius: f32) -> Vec<NodePoint>
Sourcepub fn query_knn(&self, point: Vec3, k: usize) -> Vec<(NodePoint, f32)>
pub fn query_knn(&self, point: Vec3, k: usize) -> Vec<(NodePoint, f32)>
Find the k nearest CFG blocks to a query point.
Returns up to k nearest blocks sorted by ascending distance. Each result includes the distance squared for precision comparison.
§Example
let nearest = store.query_knn(glam::Vec3::new(1.0, 2.0, 3.0), 5);
for (node_point, dist_sq) in nearest {
println!("Block {} at distance {}", node_point.id, dist_sq.sqrt());
}pub fn block_count(&self) -> usize
pub fn metadata_count(&self) -> usize
pub fn get_stored_metadata(&self, id: u64) -> Option<&MetadataRec>
Sourcepub fn get_block_at_timestamp(
&self,
logical_block_id: u64,
timestamp: u64,
) -> Option<CfgBlock>
pub fn get_block_at_timestamp( &self, logical_block_id: u64, timestamp: u64, ) -> Option<CfgBlock>
LSTS: Get a block at a specific timestamp (time-travel query)
Returns the CfgBlock version that was visible at the given timestamp. This enables querying the CFG as it existed at any point in time.
Sourcepub fn get_blocks_for_function(&self, function_id: i64) -> Vec<CfgBlock>
pub fn get_blocks_for_function(&self, function_id: i64) -> Vec<CfgBlock>
Get all blocks for a function WITH FULL METADATA
pub fn get_all_edges(&self) -> Vec<EdgeRec>
Sourcepub fn insert_edge(&mut self, edge: EdgeRec) -> Result<u64>
pub fn insert_edge(&mut self, edge: EdgeRec) -> Result<u64>
Insert an edge into storage
pub fn get_edges_for_node(&self, source_idx: u64) -> Vec<EdgeRec>
Sourcepub fn get_function_ids(&self) -> HashSet<i64>
pub fn get_function_ids(&self) -> HashSet<i64>
Get the set of function IDs that have blocks in this store
Returns all function IDs that have at least one CFG block. This is useful for vacuum operations to determine which functions are present.
Sourcepub fn get_block_ids_for_function(&self, function_id: i64) -> Option<&[u64]>
pub fn get_block_ids_for_function(&self, function_id: i64) -> Option<&[u64]>
Get block IDs for a specific function
Returns the block IDs that belong to the given function, or None if the function has no blocks in this store.
Sourcepub fn count_blocks_for_function(&self, function_id: i64) -> usize
pub fn count_blocks_for_function(&self, function_id: i64) -> usize
Get count of blocks for a specific function
Sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Get the total edge count in storage