Skip to main content

CfgStore

Struct CfgStore 

Source
pub struct CfgStore {
    pub octree: Octree,
    /* private fields */
}
Expand description

CFG Store - combines octree + storage for efficient CFG queries

Fields§

§octree: Octree

Octree spatial index (public for persistence)

Implementations§

Source§

impl CfgStore

Source

pub fn create(path: &Path) -> Result<Self>

Source

pub fn open(path: &Path) -> Result<Self>

Source

pub fn insert_block(&mut self, block: CfgBlock) -> Result<u64>

Source

pub fn insert_blocks(&mut self, blocks: Vec<CfgBlock>) -> Result<()>

Source

pub fn query_nearby(&self, point: Vec3, radius: f32) -> Vec<NodePoint>

Source

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());
}
Source

pub fn block_count(&self) -> usize

Source

pub fn metadata_count(&self) -> usize

Source

pub fn get_stored_metadata(&self, id: u64) -> Option<&MetadataRec>

Source

pub fn flush(&mut self) -> Result<()>

Flush any pending changes to disk

Source

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.

Source

pub fn get_blocks_for_function(&self, function_id: i64) -> Vec<CfgBlock>

Get all blocks for a function WITH FULL METADATA

Source

pub fn get_all_edges(&self) -> Vec<EdgeRec>

Source

pub fn insert_edge(&mut self, edge: EdgeRec) -> Result<u64>

Insert an edge into storage

Source

pub fn get_edges_for_node(&self, source_idx: u64) -> Vec<EdgeRec>

Source

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.

Source

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.

Source

pub fn count_blocks_for_function(&self, function_id: i64) -> usize

Get count of blocks for a specific function

Source

pub fn edge_count(&self) -> usize

Get the total edge count in storage

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.