pub struct CsrShardSet { /* private fields */ }Expand description
Sharded topology container for one edge direction.
Routes every row-addressed operation to the group owning the bound endpoint. Read paths never create groups; write paths create missing groups on demand.
Implementations§
Source§impl CsrShardSet
impl CsrShardSet
Sourcepub fn group_has_append_log(&self, gid: usize) -> bool
pub fn group_has_append_log(&self, gid: usize) -> bool
Whether a group holds append-log deltas not yet merged into a base.
Sourcepub fn group_append_op_count(&self, gid: usize) -> usize
pub fn group_append_op_count(&self, gid: usize) -> usize
Committed op count held in one group append log.
Sourcepub fn clear_group_append_log(&mut self, gid: usize)
pub fn clear_group_append_log(&mut self, gid: usize)
Drop one group append log after its states merged into a base. The row index is memory only; base files plus later logs rebuild it.
Sourcepub fn clear_all_append_logs(&mut self)
pub fn clear_all_append_logs(&mut self)
Drop every group append log, e.g. after a topology-wide rebuild whose base rewrite already carries all states.
Sourcepub fn encode_group_append_log(
&self,
gid: usize,
manifest: &TableShardManifest,
) -> Vec<u8> ⓘ
pub fn encode_group_append_log( &self, gid: usize, manifest: &TableShardManifest, ) -> Vec<u8> ⓘ
Encode one group append log for an append-only checkpoint. Carries only the address width so group-set growth never invalidates clean groups’ sidecars; a width mismatch is rejected on load instead of replayed against the wrong base. Borrows the in-memory log directly without cloning it into temporaries.
Sourcepub fn replay_group_append_log(
&mut self,
gid: usize,
data: &[u8],
manifest: &TableShardManifest,
) -> Result<(), StorageError>
pub fn replay_group_append_log( &mut self, gid: usize, data: &[u8], manifest: &TableShardManifest, ) -> Result<(), StorageError>
Replay one append-log payload into a group base. Fails closed on version, address-width, section-size or trailing-byte mismatches.
Source§impl CsrShardSet
impl CsrShardSet
Sourcepub fn mark_reclaim_hint_for(&mut self, vid: u32)
pub fn mark_reclaim_hint_for(&mut self, vid: u32)
Set the reclaim hint for the group owning vid.
Used by remap to preserve the hint explicitly instead of relying on delete side effects.
Sourcepub fn group_needs_reclaim_scan(&self, gid: usize) -> bool
pub fn group_needs_reclaim_scan(&self, gid: usize) -> bool
Whether a group may hold tombstones worth a reclaim scan.
Sourcepub fn group_dead_entries(&self, gid: usize) -> usize
pub fn group_dead_entries(&self, gid: usize) -> usize
Physical tombstone entries cached for one group. Zero guarantees the group holds no tombstones, so reclaimable walks can stop at O(1).
Sourcepub fn clear_reclaim_hint(&mut self, gid: usize)
pub fn clear_reclaim_hint(&mut self, gid: usize)
Clear the reclaim hint after a pass visited the whole group.
Sourcepub fn region_census(&self, gid: usize, region: usize) -> (usize, usize, usize)
pub fn region_census(&self, gid: usize, region: usize) -> (usize, usize, usize)
Physical census of one leaf region: (live, dead, capacity) summed
over its rows in global-vid order.
Sourcepub fn region_density(&self, gid: usize, region: usize) -> f32
pub fn region_density(&self, gid: usize, region: usize) -> f32
Live entries per unit of reserved capacity of one leaf region.
Sourcepub fn region_live(&self, gid: usize, region: usize) -> usize
pub fn region_live(&self, gid: usize, region: usize) -> usize
Live entries of one leaf region summed over its rows.
Sourcepub fn region_gap(&self, gid: usize, region: usize) -> usize
pub fn region_gap(&self, gid: usize, region: usize) -> usize
Reserved capacity minus live entries of one leaf region.
Steady-state write room under the current per-row reservation; the region-tail gap model derives the same room from the live count alone.
Sourcepub fn region_reclaimable_count(
&self,
gid: usize,
region: usize,
cutoff: u64,
) -> usize
pub fn region_reclaimable_count( &self, gid: usize, region: usize, cutoff: u64, ) -> usize
Entries of one leaf region reclaimable at cutoff.
Sourcepub fn select_merge_scope(
&self,
gid: usize,
region: usize,
cutoff: u64,
region_min_density: f32,
group_min_density: f32,
) -> Option<RegionMergeScope>
pub fn select_merge_scope( &self, gid: usize, region: usize, cutoff: u64, region_min_density: f32, group_min_density: f32, ) -> Option<RegionMergeScope>
Merge scope for one leaf region. The trigger is always the per-row
reclaimable count; density only widens the scope, and larger scopes
require higher density. Returns None when the region holds nothing
reclaimable and carries no delete dirt. Thresholds come from the
table configuration so measured write amplification can guide them;
the module constants back the configuration defaults.
Sourcepub fn compact_region_with_reporting(
&mut self,
gid: usize,
region: usize,
cutoff: u64,
on_edge_removed: &mut dyn FnMut(EdgeId, u64),
) -> usize
pub fn compact_region_with_reporting( &mut self, gid: usize, region: usize, cutoff: u64, on_edge_removed: &mut dyn FnMut(EdgeId, u64), ) -> usize
Compact one leaf region in place, reporting removals. Only rows in the region window are visited; other regions never move. Marks the region deleted when entries were dropped so the next checkpoint merges the rebuilt rows. Rows holding overflow are rebalanced into primary gaps on the same pass. Frozen groups bypass the per-row walk and merge once at group scope so one region request never pays one trailing memmove per row.
Sourcepub fn compact_frozen_rows_batched(
&mut self,
gid: usize,
locals: &[u32],
cutoff: u64,
on_edge_removed: &mut dyn FnMut(EdgeId, u64),
) -> usize
pub fn compact_frozen_rows_batched( &mut self, gid: usize, locals: &[u32], cutoff: u64, on_edge_removed: &mut dyn FnMut(EdgeId, u64), ) -> usize
Reclaim a listed local-row set of one frozen group in one pass.
Collect-then-merge entry for frozen groups: callers gather reclaimable rows across regions and merge once instead of paying one trailing memmove per row. Mutable groups report zero; their rows use the regular per-row path. Marks the group deleted when entries drop so the next checkpoint persists the rebuilt base.
Sourcepub fn compact_group_with_reporting(
&mut self,
gid: usize,
cutoff: u64,
reserve_ratio: f32,
on_edge_removed: &mut dyn FnMut(EdgeId, u64),
) -> usize
pub fn compact_group_with_reporting( &mut self, gid: usize, cutoff: u64, reserve_ratio: f32, on_edge_removed: &mut dyn FnMut(EdgeId, u64), ) -> usize
Compact one group in place, reporting removals. Marks the group dirty so the next checkpoint persists the rebuilt rows.
Sourcepub fn compact_with_ts_reporting(
&mut self,
cutoff: u64,
reserve_ratio: f32,
on_edge_removed: &mut dyn FnMut(EdgeId, u64),
) -> usize
pub fn compact_with_ts_reporting( &mut self, cutoff: u64, reserve_ratio: f32, on_edge_removed: &mut dyn FnMut(EdgeId, u64), ) -> usize
Compact with per-edge removal reporting across all groups. Only groups that actually dropped entries are marked dirty so clean groups are never dragged into the next checkpoint.
Source§impl CsrShardSet
impl CsrShardSet
Sourcepub fn batch_put_edges(
&mut self,
edges: &[(u32, VertexId, EdgeId)],
ts: u64,
check_duplicates: bool,
) -> Result<usize, StorageError>
pub fn batch_put_edges( &mut self, edges: &[(u32, VertexId, EdgeId)], ts: u64, check_duplicates: bool, ) -> Result<usize, StorageError>
Bulk insert pre-grouped edges with one reservation per touched row.
Input is (src, dst, edge_id) triples at global addresses sharing one
ts. The shared grouping and write path lives in
Self::batch_put_edges_with_ts.
Sourcepub fn batch_put_edges_with_ts(
&mut self,
edges: &[(u32, VertexId, EdgeId, u64)],
check_duplicates: bool,
) -> Result<usize, StorageError>
pub fn batch_put_edges_with_ts( &mut self, edges: &[(u32, VertexId, EdgeId, u64)], check_duplicates: bool, ) -> Result<usize, StorageError>
Bulk insert with per-edge timestamps, partitioned by group.
Direct-write counterpart of batch_put_edges for initial loads with
heterogeneous timestamps: input is (src, dst, edge_id, ts) quads at
global addresses, rows are grouped by shard, each Multiple group is
written through its bulk path (single reservation, single live-set
rebuild per row) preserving each edge timestamp, and other variants
fall back to per-edge inserts. Dirt and append-log entries are
recorded per inserted edge exactly like the single-edge path.
Duplicate keys are rejected before any write when check_duplicates
is set; bulk-import callers prevalidate once and pass false.
Sourcepub fn reserve_for_batch(
&mut self,
counts: &[(u32, usize)],
) -> Result<(), StorageError>
pub fn reserve_for_batch( &mut self, counts: &[(u32, usize)], ) -> Result<(), StorageError>
Pre-size touched rows once for an incoming batch.
Groups missing rows are materialized first; each Multiple group
sizes its rows at the packed density target so the following
per-edge inserts land in reserved gaps. Other strategies skip
reservation. Only sizing happens here; inserts still flow through
the regular path so dirt and append logs stay exact.
Source§impl CsrShardSet
impl CsrShardSet
Sourcepub fn is_bundled(&self) -> bool
pub fn is_bundled(&self) -> bool
Whether this direction stores its single scalar inline.
Sourcepub fn bundled_insert_with_value(
&mut self,
src_vid: u32,
dst: VertexId,
edge_id: EdgeId,
ts: u64,
value: Option<u64>,
) -> Result<(), StorageError>
pub fn bundled_insert_with_value( &mut self, src_vid: u32, dst: VertexId, edge_id: EdgeId, ts: u64, value: Option<u64>, ) -> Result<(), StorageError>
Insert one edge carrying its inline value (None stores NULL).
Dirt and append-log entries mirror the single-edge insert path. Only bundled sets accept a value; anything else is rejected by the variant.
Sourcepub fn bundled_value_at(
&self,
src_vid: u32,
edge_id: EdgeId,
) -> Option<(u64, bool)>
pub fn bundled_value_at( &self, src_vid: u32, edge_id: EdgeId, ) -> Option<(u64, bool)>
Read one edge’s inline value within its source row.
Sourcepub fn bundled_value_by_endpoint(
&self,
src_vid: u32,
endpoint: u32,
) -> Option<(u64, bool)>
pub fn bundled_value_by_endpoint( &self, src_vid: u32, endpoint: u32, ) -> Option<(u64, bool)>
Read the inline value of the live edge for one endpoint.
Sourcepub fn bundled_set_value_by_endpoint(
&mut self,
src_vid: u32,
endpoint: u32,
value: Option<u64>,
) -> bool
pub fn bundled_set_value_by_endpoint( &mut self, src_vid: u32, endpoint: u32, value: Option<u64>, ) -> bool
Overwrite the inline value of the live edge for one endpoint.
The value column rides the group base file rather than the append sidecar, so the update takes delete dirt to force a base rewrite on the next checkpoint. No append record is written: append replay only expresses topology inserts and deletes.
Sourcepub fn bundled_revert_with_value(
&mut self,
src_vid: u32,
position: EdgePosition,
expected: EdgeId,
ts: u64,
value: Option<u64>,
) -> bool
pub fn bundled_revert_with_value( &mut self, src_vid: u32, position: EdgePosition, expected: EdgeId, ts: u64, value: Option<u64>, ) -> bool
Revert a deletion restoring the caller’s value alongside the topology.
Sourcepub fn visit_physical_with_values<F>(&self, src_vid: u32, f: F)
pub fn visit_physical_with_values<F>(&self, src_vid: u32, f: F)
Visit every physically stored entry of one vertex with its inline
value (None for NULL slots and non-bundled forms).
Source§impl CsrShardSet
impl CsrShardSet
Sourcepub fn route_hit_rate(&self) -> f32
pub fn route_hit_rate(&self) -> f32
Routing-cache hit rate for observability. Capacity stays fixed; this only reports so operators can tell whether hot lookups hit.
Sourcepub fn route_collision_count(&self) -> usize
pub fn route_collision_count(&self) -> usize
Routing-cache collision count since creation. Collisions share the miss counter; this separates true empty misses from evictions so operators can tell whether 128 slots still cover the working set.
pub fn new( strategy: EdgeStrategy, group_bits: u32, overflow_chunk_edges: usize, record_form: RecordForm, ) -> Result<CsrShardSet, StorageError>
pub fn strategy(&self) -> EdgeStrategy
pub fn record_form(&self) -> RecordForm
pub fn group_bits(&self) -> u32
pub fn group_size(&self) -> usize
pub fn group_count(&self) -> usize
Sourcepub fn existing_group_ids(&self) -> Vec<usize>
pub fn existing_group_ids(&self) -> Vec<usize>
Sorted existing group ids. Sparse holes are absent: they read as empty, never consume memory and never produce files.
Sourcepub fn group_span(&self) -> usize
pub fn group_span(&self) -> usize
One past the largest materialized group, or zero when empty. Only for diagnostics; flush and reclaim paths iterate existing ids alone so a wide sparse span never drags holes along.
Sourcepub fn address_span_rows(&self) -> usize
pub fn address_span_rows(&self) -> usize
Address-span row count: highest group upper bound minus lowest group lower bound, holes included.
This is the true address upper bound for preallocation and range
validation. vertex_capacity instead reports materialized rows only
(memory-proportional); callers must pick by purpose and never mix the
two calibers.
Sourcepub fn set_tombstone_reuse_cutoff(&mut self, cutoff: u64)
pub fn set_tombstone_reuse_cutoff(&mut self, cutoff: u64)
Refresh the hot-path tombstone reuse cutoff on every group.
Only watermark-derived bounds refresh; the sentinel disables reuse.
See MutableCsr::set_tombstone_reuse_cutoff
for the single freshness contract.
Sourcepub fn refresh_tombstone_reuse_cutoff(&mut self, fresh: u64)
pub fn refresh_tombstone_reuse_cutoff(&mut self, fresh: u64)
Fresh watermark refresh allowing widening on every group.
Sourcepub fn clear_tombstone_reuse_cutoff(&mut self)
pub fn clear_tombstone_reuse_cutoff(&mut self)
Drop the reuse hint back to the disabled sentinel on every group.
Stale path of the same contract: no fresh watermark means no reuse.
Sourcepub fn tombstone_reuse_cutoff(&self) -> u64
pub fn tombstone_reuse_cutoff(&self) -> u64
Current reuse cutoff for observability and tests. Timestamp::MAX
means reuse is disabled.
Sourcepub fn ensure_group_id(&mut self, gid: usize) -> Result<(), StorageError>
pub fn ensure_group_id(&mut self, gid: usize) -> Result<(), StorageError>
Ensure one group exists without routing a vertex id. Used when loading an explicit existing-group list and when orphan timestamp shards fall back to group zero.
Sourcepub fn group_variant(&self, gid: usize) -> Option<&CsrVariant>
pub fn group_variant(&self, gid: usize) -> Option<&CsrVariant>
Borrow one persisted group for checkpoint writes.
Sourcepub fn group_variant_mut(&mut self, gid: usize) -> Option<&mut CsrVariant>
pub fn group_variant_mut(&mut self, gid: usize) -> Option<&mut CsrVariant>
Mutably borrow one group for checkpoint loads.
Sourcepub fn group_mapped(&self, gid: usize) -> Option<MappedFrozen>
pub fn group_mapped(&self, gid: usize) -> Option<MappedFrozen>
Derived serving cache of one group, if the checkpoint load attached one.
Clones share one mapping through the reference count, so snapshotting the handle for a reader is cheap. Only frozen groups ever carry one.
Sourcepub fn group_has_mapped(&self, gid: usize) -> bool
pub fn group_has_mapped(&self, gid: usize) -> bool
Whether one group serves hot reads from its derived mapping.
Sourcepub fn set_group_mapped(
&mut self,
gid: usize,
mapped: MappedFrozen,
) -> Result<(), StorageError>
pub fn set_group_mapped( &mut self, gid: usize, mapped: MappedFrozen, ) -> Result<(), StorageError>
Attach a derived serving cache to a frozen group. Non-frozen groups reject the handle so residency never shadows a writable heap.
Sourcepub fn clear_group_mapped(&mut self, gid: usize)
pub fn clear_group_mapped(&mut self, gid: usize)
Drop one group serving cache, falling back to heap serving.
Sourcepub fn load_group(
&mut self,
gid: usize,
data: &[u8],
) -> Result<(), StorageError>
pub fn load_group( &mut self, gid: usize, data: &[u8], ) -> Result<(), StorageError>
Load one group payload without marking it dirty. The tombstone counter is derived from the loaded payload in one pass, and the reclaim hint follows it, so clean groups skip reclaim scans without paying one audit walk after every load.
Sourcepub fn truncate_trailing_empty_groups(&mut self)
pub fn truncate_trailing_empty_groups(&mut self)
Drop every group holding no physical entries. Tombstone-bearing groups are retained so snapshot history before the cutoff survives. Non-empty strategies keep at least group zero so an empty table stays addressable. Intermediate holes are never materialized, so only existing empty groups are dropped and no empty files are produced.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clear all edges, keeping the group space. Marks surviving groups dirty so the next checkpoint persists the cleared state.
Clearing also drops every derived serving cache: the heap form is emptied and the mapping is outside the heap, so the group falls back to heap serving. Missing-group reads stay empty and no group is dropped here.
Source§impl CsrShardSet
impl CsrShardSet
Sourcepub fn group_dirty(&self, gid: usize) -> GroupDirty
pub fn group_dirty(&self, gid: usize) -> GroupDirty
Dirt of one group; missing groups report clean.
Sourcepub fn dirty_group_ids(&self) -> Vec<usize>
pub fn dirty_group_ids(&self) -> Vec<usize>
Ids of groups holding uncheckpointed writes.
Sourcepub fn column_dirty_group_ids(&self) -> Vec<usize>
pub fn column_dirty_group_ids(&self) -> Vec<usize>
Ids of groups holding property-only write traces.
Precise write-time marking: every property write marks its owning group, so the flush can limit property shards to traced owners. The table-level property flag remains as a correctness insurance that rewrites all owners when no trace exists, but the regular path always carries a trace.
Sourcepub fn checkpoint_kind(&self) -> EdgeCheckpointKind
pub fn checkpoint_kind(&self) -> EdgeCheckpointKind
Checkpoint class for the current dirt without clearing it.
Sourcepub fn mark_column_updated_for_group(&mut self, gid: usize)
pub fn mark_column_updated_for_group(&mut self, gid: usize)
Trace a property-only write to the group owning vid.
Precise write-time marking: the owning group is materialized when missing (unless the direction stores nothing) so every property write leaves a group trace. The table-level property flag remains as a correctness insurance, but the regular path never needs it. Trace a property-only write to a whole group by id.
Group-granular counterpart of Self::mark_column_updated_for for
callers that already resolved the owner (schema fills, drops and
renames touch every row of every owner). Materializes the group when
missing so the trace is never silently dropped.
pub fn mark_column_updated_for(&mut self, vid: u32)
pub fn clear_group_dirty(&mut self, gid: usize)
pub fn clear_all_dirty(&mut self)
Sourcepub fn clear_all_column_dirty(&mut self)
pub fn clear_all_column_dirty(&mut self)
Clear precise column-only traces after a flush. Insert and delete dirt is owned by the per-group flush above and never touched here.
Sourcepub fn mark_all_dirty(&mut self)
pub fn mark_all_dirty(&mut self)
Mark every group dirty so the next checkpoint rewrites the full direction. Used after topology-wide rebuilds such as vertex remapping, where clean-group skipping would otherwise persist stale group files.
Sourcepub fn needs_checkpoint(&self, gid: usize) -> bool
pub fn needs_checkpoint(&self, gid: usize) -> bool
Whether a group holds uncheckpointed writes.
Sourcepub fn group_needs_rebalance(&self, gid: usize) -> bool
pub fn group_needs_rebalance(&self, gid: usize) -> bool
Whether one group carries delete dirt and needs a base merge rather than an append-only persist.
Sourcepub fn region_dirty(&self, gid: usize, region: usize) -> RegionDirty
pub fn region_dirty(&self, gid: usize, region: usize) -> RegionDirty
Dirt of one leaf region; missing groups or regions report clean.
Sourcepub fn dirty_region_ids(&self, gid: usize) -> Vec<usize>
pub fn dirty_region_ids(&self, gid: usize) -> Vec<usize>
Ids of dirty leaf regions inside one group.
Sourcepub fn region_needs_checkpoint(&self, gid: usize, region: usize) -> bool
pub fn region_needs_checkpoint(&self, gid: usize, region: usize) -> bool
Whether one leaf region holds uncheckpointed topology writes.
Sourcepub fn region_needs_rebalance(&self, gid: usize, region: usize) -> bool
pub fn region_needs_rebalance(&self, gid: usize, region: usize) -> bool
Whether one leaf region carries delete dirt and needs a base merge rather than an append-only persist.
pub fn clear_region_dirty(&mut self, gid: usize, region: usize)
Source§impl CsrShardSet
impl CsrShardSet
Sourcepub fn is_group_frozen_for(&self, vid: u32) -> bool
pub fn is_group_frozen_for(&self, vid: u32) -> bool
Whether the group owning vid exists and is frozen.
Sourcepub fn freeze_group(
&mut self,
gid: usize,
cutoff: u64,
reserve_ratio: f32,
on_edge_removed: &mut dyn FnMut(EdgeId, u64),
) -> Result<u64, StorageError>
pub fn freeze_group( &mut self, gid: usize, cutoff: u64, reserve_ratio: f32, on_edge_removed: &mut dyn FnMut(EdgeId, u64), ) -> Result<u64, StorageError>
Freeze one group in place, returning its packed live edge count.
Reclaims first at cutoff through the shared group compaction when
the caller passes an active cutoff, reporting removals through
on_edge_removed for the authority above; a maximum cutoff packs
verbatim with no removals. Only Multiple, Single, Pure and
Bundled groups freeze; missing groups, None groups and
already-frozen groups are rejected.
Sourcepub fn freeze_feasibility(&self, gid: usize) -> FreezeFeasibility
pub fn freeze_feasibility(&self, gid: usize) -> FreezeFeasibility
Read-only freeze outcome for one group.
Runs the same gate freeze_group enforces, without compaction,
packing or authority traffic. A Ready group freezes if nothing
changes in between; a Blocked group reports the exact rejection
reason, including whether migrating to the columnar form lifts it.
Sourcepub fn unfreeze_group(&mut self, gid: usize) -> Result<u64, StorageError>
pub fn unfreeze_group(&mut self, gid: usize) -> Result<u64, StorageError>
Unfreeze one group, rebuilding its mutable variant.
Replays every packed row through the regular insert entry and restores deletion stamps through the regular delete entry, so the rebuilt rows carry the same logical content in fresh physical order. Gap sentinels are not replayed: they are reserved-slot fillers, never edges. Bundled groups additionally replay their carried values through the regular valued insert entry, restoring the same words and validity bits. The rebuilt shape follows the set strategy. Only frozen groups unfreeze; anything else is rejected.
Source§impl CsrShardSet
impl CsrShardSet
Sourcepub fn iter_edges_of(&self, src_vid: u32, ts: u64) -> Option<CsrRowIter<'_>>
pub fn iter_edges_of(&self, src_vid: u32, ts: u64) -> Option<CsrRowIter<'_>>
Iterate edges of a vertex without allocating, for every strategy. Test-only row-stamp filtered iterator; production scans go through the version authority.
Sourcepub fn iter_all(&self) -> ShardCsrIterator<'_> ⓘ
pub fn iter_all(&self) -> ShardCsrIterator<'_> ⓘ
Iterate every physically present entry across groups, including tombstoned ones, in group order. Visibility is decided above this layer by the version authority.
Source§impl CsrShardSet
impl CsrShardSet
Sourcepub fn primary_contains(&self, src_vid: u32, edge_id: EdgeId) -> bool
pub fn primary_contains(&self, src_vid: u32, edge_id: EdgeId) -> bool
Whether the primary row of one vertex holds edge_id.
Sourcepub fn group_of(&self, vid: u32) -> Option<usize>
pub fn group_of(&self, vid: u32) -> Option<usize>
Owner group of one global vertex id without creating groups.
Shared row-location entry point for point lookups, adjacency batches and full scans: every read path resolves rows through this routing instead of duplicating the group arithmetic.
Sourcepub fn visit_physical<F>(&self, src_vid: u32, f: F)
pub fn visit_physical<F>(&self, src_vid: u32, f: F)
Visit every physically stored entry of one vertex without allocating.
Sourcepub fn visit_hot<F>(&self, src_vid: u32, f: F)
pub fn visit_hot<F>(&self, src_vid: u32, f: F)
Visit every physically stored hot half of one vertex without allocating and without touching the stamp lines.
Hot-only counterpart of Self::visit_physical for traversals that
resolve visibility through the version authority by edge_id.
Sourcepub fn fill_physical_into(&self, src_vid: u32, out: &mut Vec<Nbr>)
pub fn fill_physical_into(&self, src_vid: u32, out: &mut Vec<Nbr>)
Fill a caller buffer with every physically stored entry of one vertex.
Same content as the allocating trait accessor, without the per-vertex allocation. Missing groups read as empty and never create groups.
Sourcepub fn fill_physical_batch_into(
&self,
vids: &[u32],
out: &mut Vec<Nbr>,
offsets: &mut Vec<usize>,
)
pub fn fill_physical_batch_into( &self, vids: &[u32], out: &mut Vec<Nbr>, offsets: &mut Vec<usize>, )
Fill one shared buffer with the physical entries of many vertices.
Records one start offset per vertex plus a trailing end offset, so
out[offsets[i]..offsets[i + 1]] is vertex vids[i] in order. One
pass over the vertices, no per-vertex allocation; missing groups and
empty rows contribute empty slices. Read paths never create groups.
Dispatch stays converged in CsrVariant: each run borrows its shard
once (one map lookup per run), then walks rows through the variant
single-row entry. The row loop pays one variant match per row, which
is noise next to the per-row routing plus the row walk itself; in
return there are no per-form arms to keep in sync here, so adding a
form only touches the variant read entries.
Sourcepub fn fill_physical_with_values_batch_into(
&self,
vids: &[u32],
out: &mut Vec<(Nbr, Option<u64>)>,
offsets: &mut Vec<usize>,
)
pub fn fill_physical_with_values_batch_into( &self, vids: &[u32], out: &mut Vec<(Nbr, Option<u64>)>, offsets: &mut Vec<usize>, )
Fill one shared buffer with paired topology plus inline values.
Batched counterpart of the single-row paired fill: same offsets
contract as the topology batch above, but each entry carries its
inline value. Non-bundled forms fill with None values through the
same walk. Like the topology batch, each run borrows its shard once
and walks rows through the variant paired entry, so there are no
per-form arms to keep in sync here either.
Sourcepub fn is_row_sorted(&self, src_vid: u32) -> bool
pub fn is_row_sorted(&self, src_vid: u32) -> bool
Whether the live entries of one row arrive in key order.
Only frozen and single-slot rows promise order and may use bisection;
other variants report an observation that is memory-only, rebuilt on
load and never cached across restarts. Planning paths prefer
should_use_bisection below so the promise plus the live observation
stay in one place. Frozen groups serve the same sorted order from the
heap and from a derived mapping alike.
Sourcepub fn should_use_bisection(&self, src_vid: u32) -> bool
pub fn should_use_bisection(&self, src_vid: u32) -> bool
Whether a range scan should bisect this row.
Central plan selection combining the order promise with the live sorted observation. Missing groups read as sorted empty. The result is memory-only and must never be cached across restarts.
Sourcepub fn sort_row(&mut self, src_vid: u32) -> bool
pub fn sort_row(&mut self, src_vid: u32) -> bool
Sort one row on the maintenance path. Positions for the row go stale.
Sourcepub fn visit_threshold<F>(
&self,
src_vid: u32,
lower: Option<(u32, i64)>,
upper: Option<(u32, i64)>,
f: F,
)
pub fn visit_threshold<F>( &self, src_vid: u32, lower: Option<(u32, i64)>, upper: Option<(u32, i64)>, f: F, )
Visit live entries of one row whose key falls in the inclusive range.
Pure and bundled rows ignore the rank halves by contract: callers pass endpoint intervals there.
Sourcepub fn fill_threshold_into(
&self,
src_vid: u32,
lower: Option<(u32, i64)>,
upper: Option<(u32, i64)>,
out: &mut Vec<Nbr>,
)
pub fn fill_threshold_into( &self, src_vid: u32, lower: Option<(u32, i64)>, upper: Option<(u32, i64)>, out: &mut Vec<Nbr>, )
Fill a caller buffer with the same range content as visit_threshold.
Sourcepub fn visit_threshold_endpoint_only<F>(
&self,
src_vid: u32,
lower: Option<u32>,
upper: Option<u32>,
f: F,
)
pub fn visit_threshold_endpoint_only<F>( &self, src_vid: u32, lower: Option<u32>, upper: Option<u32>, f: F, )
Visit entries whose endpoint falls in the inclusive endpoint range.
Endpoint-only counterpart of visit_threshold sharing one interval
across forms. Missing groups read as empty and never create groups.
Source§impl CsrShardSet
impl CsrShardSet
Sourcepub fn group_stats(&self, gid: usize) -> Option<NodeGroupStats>
pub fn group_stats(&self, gid: usize) -> Option<NodeGroupStats>
Observability view of one group.
Sourcepub fn group_live_count(&self, gid: usize) -> u64
pub fn group_live_count(&self, gid: usize) -> u64
Live edge count of one group for segment statistics.
Sourcepub fn bytes_per_edge(&self) -> usize
pub fn bytes_per_edge(&self) -> usize
Average bytes per edge based on actual memory usage. Measured value only, with no fallback: empty tables report zero, and a degenerate zero measurement on a non-empty table reports zero with a debug line. Callers handle zero explicitly.
Sourcepub fn fragmentation_stats(&self) -> Option<FragmentationStats>
pub fn fragmentation_stats(&self) -> Option<FragmentationStats>
Whole-set fragmentation statistics, summed across groups. Observation metric only; collection triggers use per-vertex counts. Sums every group reporting detailed stats; groups without reserved row capacity contribute nothing. Returns none when no group reports.
Sourcepub fn fragmentation_ratio(&self) -> f32
pub fn fragmentation_ratio(&self) -> f32
Whole-set fragmentation ratio, summed across groups. Observation metric only; collection triggers use per-vertex counts. Shares the single wasted-share caliber through the summed snapshot below instead of a second aggregation loop.
Sourcepub fn wasted_bytes_estimate(&self) -> usize
pub fn wasted_bytes_estimate(&self) -> usize
Estimate wasted bytes due to fragmentation, summed across groups.
Sourcepub fn used_memory_size(&self) -> usize
pub fn used_memory_size(&self) -> usize
Approximate memory usage in bytes, summed across existing groups. Missing groups consume nothing, so sparse tables stay proportional to materialized groups rather than the endpoint span. Derived serving caches count on top of their authoritative heap form.
Sourcepub fn layer_counts(&self) -> (usize, usize)
pub fn layer_counts(&self) -> (usize, usize)
Narrow vs wide row counts summed across groups.
Thresholds stay fixed; this only reports so slow traversals can be attributed to a row width layer. Only multi-edge groups report; other forms contribute zero.
Trait Implementations§
Source§impl Clone for CsrShardSet
impl Clone for CsrShardSet
Source§fn clone(&self) -> CsrShardSet
fn clone(&self) -> CsrShardSet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl CsrBase for CsrShardSet
impl CsrBase for CsrShardSet
Source§fn vertex_capacity(&self) -> usize
fn vertex_capacity(&self) -> usize
Materialized rows only: existing groups times group size.
Memory-proportional by design, so sparse tables stay proportional to
materialized groups. Not an address upper bound: holes are excluded,
use address_span_rows when a true bound is needed.
Source§fn dump(&self) -> Vec<u8> ⓘ
fn dump(&self) -> Vec<u8> ⓘ
Whole-direction dump is rejected by design: persistence moves through the per-group incremental protocol only, so a whole-direction payload would silently bypass group dirt, append sidecars and shard manifests. Any call here is a caller bug and fails loudly instead of returning an empty payload that a reader could mistake for an empty table.
Source§fn load(&mut self, _data: &[u8]) -> Result<(), StorageError>
fn load(&mut self, _data: &[u8]) -> Result<(), StorageError>
Whole-direction load is rejected by design, mirroring the dump guard above. Group payloads load through the per-group path instead.
fn edge_count(&self) -> u64
Source§impl Debug for CsrShardSet
impl Debug for CsrShardSet
Source§impl MutableCsrTrait for CsrShardSet
impl MutableCsrTrait for CsrShardSet
Source§fn insert_edge(
&mut self,
src_vid: u32,
dst: VertexId,
edge_id: EdgeId,
ts: u64,
) -> Result<(), StorageError>
fn insert_edge( &mut self, src_vid: u32, dst: VertexId, edge_id: EdgeId, ts: u64, ) -> Result<(), StorageError>
Source§fn delete_edge(
&mut self,
src_vid: u32,
edge_id: EdgeId,
ts: u64,
) -> Result<bool, StorageError>
fn delete_edge( &mut self, src_vid: u32, edge_id: EdgeId, ts: u64, ) -> Result<bool, StorageError>
Source§fn delete_edge_by_dst(&mut self, src_vid: u32, dst: VertexId, ts: u64) -> usize
fn delete_edge_by_dst(&mut self, src_vid: u32, dst: VertexId, ts: u64) -> usize
Source§fn delete_edge_by_dst_reporting(
&mut self,
src_vid: u32,
dst: VertexId,
ts: u64,
on_deleted: &mut dyn FnMut(EdgeId),
) -> usize
fn delete_edge_by_dst_reporting( &mut self, src_vid: u32, dst: VertexId, ts: u64, on_deleted: &mut dyn FnMut(EdgeId), ) -> usize
Source§fn delete_edge_by_dst_reporting_positioned(
&mut self,
src_vid: u32,
dst: VertexId,
ts: u64,
on_deleted: &mut dyn FnMut(EdgeId, Option<EdgePosition>),
) -> usize
fn delete_edge_by_dst_reporting_positioned( &mut self, src_vid: u32, dst: VertexId, ts: u64, on_deleted: &mut dyn FnMut(EdgeId, Option<EdgePosition>), ) -> usize
Source§fn locate_edge(
&self,
src_vid: u32,
edge_id: EdgeId,
) -> Option<(EdgePosition, Nbr)>
fn locate_edge( &self, src_vid: u32, edge_id: EdgeId, ) -> Option<(EdgePosition, Nbr)>
Source§fn delete_edge_at_position(
&mut self,
src_vid: u32,
position: EdgePosition,
expected: EdgeId,
ts: u64,
) -> Result<bool, StorageError>
fn delete_edge_at_position( &mut self, src_vid: u32, position: EdgePosition, expected: EdgeId, ts: u64, ) -> Result<bool, StorageError>
Source§fn revert_delete_at_position(
&mut self,
src_vid: u32,
position: EdgePosition,
expected: EdgeId,
ts: u64,
) -> bool
fn revert_delete_at_position( &mut self, src_vid: u32, position: EdgePosition, expected: EdgeId, ts: u64, ) -> bool
Source§fn delete_edge_by_offset(
&mut self,
src_vid: u32,
offset: i32,
ts: u64,
) -> Result<bool, StorageError>
fn delete_edge_by_offset( &mut self, src_vid: u32, offset: i32, ts: u64, ) -> Result<bool, StorageError>
Source§fn nbr_at_offset(&self, src_vid: u32, offset: i32) -> Option<Nbr>
fn nbr_at_offset(&self, src_vid: u32, offset: i32) -> Option<Nbr>
Source§fn get_edge_physical(&self, src_vid: u32, dst: VertexId) -> Option<Nbr>
fn get_edge_physical(&self, src_vid: u32, dst: VertexId) -> Option<Nbr>
Source§fn physical_edges_of(&self, src_vid: u32) -> Vec<Nbr>
fn physical_edges_of(&self, src_vid: u32) -> Vec<Nbr>
Source§fn fill_physical_into(&self, src_vid: u32, out: &mut Vec<Nbr>)
fn fill_physical_into(&self, src_vid: u32, out: &mut Vec<Nbr>)
Source§fn has_physical_entries(&self, vid: u32) -> bool
fn has_physical_entries(&self, vid: u32) -> bool
Source§fn primary_contains(&self, src_vid: u32, edge_id: EdgeId) -> bool
fn primary_contains(&self, src_vid: u32, edge_id: EdgeId) -> bool
edge_id.Source§fn revert_delete_by_offset(
&mut self,
src_vid: u32,
offset: i32,
ts: u64,
) -> bool
fn revert_delete_by_offset( &mut self, src_vid: u32, offset: i32, ts: u64, ) -> bool
Source§fn rollback_insert(&mut self, src_vid: u32, edge_id: EdgeId) -> bool
fn rollback_insert(&mut self, src_vid: u32, edge_id: EdgeId) -> bool
Source§fn revert_delete_by_edge_id(
&mut self,
src_vid: u32,
edge_id: EdgeId,
ts: u64,
) -> bool
fn revert_delete_by_edge_id( &mut self, src_vid: u32, edge_id: EdgeId, ts: u64, ) -> bool
ts. Read moreSource§fn get_edge(&self, src_vid: u32, dst: VertexId, ts: u64) -> Option<Nbr>
fn get_edge(&self, src_vid: u32, dst: VertexId, ts: u64) -> Option<Nbr>
Source§fn edges_of(&self, src_vid: u32, ts: u64) -> Vec<Nbr>
fn edges_of(&self, src_vid: u32, ts: u64) -> Vec<Nbr>
Source§fn compact_vertex_with_reporting(
&mut self,
vid: u32,
cutoff: u64,
on_edge_removed: &mut dyn FnMut(EdgeId, u64),
) -> usize
fn compact_vertex_with_reporting( &mut self, vid: u32, cutoff: u64, on_edge_removed: &mut dyn FnMut(EdgeId, u64), ) -> usize
cutoff and tightening live entries without touching other rows. Read moreSource§fn reclaimable_count(&self, vid: u32, cutoff: u64) -> usize
fn reclaimable_count(&self, vid: u32, cutoff: u64) -> usize
cutoff. Read moreSource§fn vertex_needs_compact(&self, vid: u32, cutoff: u64) -> bool
fn vertex_needs_compact(&self, vid: u32, cutoff: u64) -> bool
cutoff.Source§fn vertex_census(&self, vid: u32) -> (usize, usize, usize)
fn vertex_census(&self, vid: u32) -> (usize, usize, usize)
(live, dead, capacity). Read moreSource§fn vertex_reclaim_probe(&self, vid: u32, cutoff: u64) -> (usize, usize)
fn vertex_reclaim_probe(&self, vid: u32, cutoff: u64) -> (usize, usize)
(dead, reclaimable). Read moreSource§fn row_gap(&self, vid: u32) -> usize
fn row_gap(&self, vid: u32) -> usize
Source§fn row_density(&self, vid: u32) -> f32
fn row_density(&self, vid: u32) -> f32
Source§fn rebalance_row(&mut self, vid: u32) -> bool
fn rebalance_row(&mut self, vid: u32) -> bool
Source§fn used_memory_size(&self) -> usize
fn used_memory_size(&self) -> usize
Auto Trait Implementations§
impl !Freeze for CsrShardSet
impl RefUnwindSafe for CsrShardSet
impl Send for CsrShardSet
impl Sync for CsrShardSet
impl Unpin for CsrShardSet
impl UnsafeUnpin for CsrShardSet
impl UnwindSafe for CsrShardSet
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.