pub struct HierarchyCache { /* private fields */ }Expand description
Incrementally-loaded hierarchy cache.
Implementations§
Source§impl HierarchyCache
impl HierarchyCache
Sourcepub async fn load_root(
&mut self,
source: &impl ByteSource,
info: &CopcInfo,
) -> Result<(), CopcError>
pub async fn load_root( &mut self, source: &impl ByteSource, info: &CopcInfo, ) -> Result<(), CopcError>
Load the root hierarchy page.
Sourcepub async fn load_pending_pages(
&mut self,
source: &impl ByteSource,
) -> Result<(), CopcError>
pub async fn load_pending_pages( &mut self, source: &impl ByteSource, ) -> Result<(), CopcError>
Load the next batch of pending hierarchy pages.
Sourcepub async fn load_all(
&mut self,
source: &impl ByteSource,
info: &CopcInfo,
) -> Result<(), CopcError>
pub async fn load_all( &mut self, source: &impl ByteSource, info: &CopcInfo, ) -> Result<(), CopcError>
Load all pending pages (breadth-first).
Each depth level is fetched in a single ByteSource::read_ranges
call, so HTTP backends that override read_ranges with parallel
fetches will issue one round-trip per depth level.
Sourcepub async fn load_pages_for_bounds(
&mut self,
source: &impl ByteSource,
bounds: &Aabb,
root_bounds: &Aabb,
) -> Result<(), CopcError>
pub async fn load_pages_for_bounds( &mut self, source: &impl ByteSource, bounds: &Aabb, root_bounds: &Aabb, ) -> Result<(), CopcError>
Load only pending pages whose subtree intersects bounds.
Pages whose voxel key falls outside the query region are left pending for future calls. New child pages discovered during loading are evaluated in subsequent iterations, so the full relevant subtree is loaded by the time this returns.
Sourcepub async fn load_pages_for_bounds_to_level(
&mut self,
source: &impl ByteSource,
bounds: &Aabb,
root_bounds: &Aabb,
max_level: i32,
) -> Result<(), CopcError>
pub async fn load_pages_for_bounds_to_level( &mut self, source: &impl ByteSource, bounds: &Aabb, root_bounds: &Aabb, max_level: i32, ) -> Result<(), CopcError>
Like load_pages_for_bounds but stops
at max_level — pages whose key is deeper than max_level are left
pending even if they intersect the bounds.
Sourcepub fn has_pending_pages(&self) -> bool
pub fn has_pending_pages(&self) -> bool
Whether there are unloaded hierarchy pages.
Sourcepub fn pending_page_keys(&self) -> impl Iterator<Item = VoxelKey> + '_
pub fn pending_page_keys(&self) -> impl Iterator<Item = VoxelKey> + '_
Iterate the VoxelKeys anchoring the currently-pending hierarchy
pages. A pending page is a sub-tree whose entries live in a separate
page in the file that hasn’t been fetched yet. The anchor key is the
node that owns the page pointer; resolving the page populates that
node’s subtree.
Useful to consumers that want to surface unloaded subtrees as
“proxy” nodes in their own data structure, then trigger
Self::load_pages_for_bounds / equivalent on demand.
Sourcepub fn get(&self, key: &VoxelKey) -> Option<&HierarchyEntry>
pub fn get(&self, key: &VoxelKey) -> Option<&HierarchyEntry>
Look up a hierarchy entry by key.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&VoxelKey, &HierarchyEntry)>
pub fn iter(&self) -> impl Iterator<Item = (&VoxelKey, &HierarchyEntry)>
Iterate all loaded entries.