MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / rebuild_pointer_map

Method rebuild_pointer_map

crates/table/src/table.rs:2430–2436  ·  view source on GitHub ↗

Rebuild the [`PointerMap`] by iterating over all the rows in `self` and inserting them. Called when restoring from a snapshot after installing the pages, but after computing the row count, since snapshots do not save the pointer map..

(&mut self, blob_store: &dyn BlobStore)

Source from the content-addressed store, hash-verified

2428 /// but after computing the row count,
2429 /// since snapshots do not save the pointer map..
2430 fn rebuild_pointer_map(&mut self, blob_store: &dyn BlobStore) -> PointerMap {
2431 // TODO(perf): Pre-allocate `PointerMap.map` with capacity `self.row_count`.
2432 // Alternatively, do this at the same time as `compute_row_count`.
2433 self.scan_rows(blob_store)
2434 .map(|row_ref| (row_ref.row_hash(), row_ref.pointer()))
2435 .collect()
2436 }
2437
2438 /// Compute and store `self.row_count` and `self.blob_store_bytes`
2439 /// by iterating over all the rows in `self` and counting them.

Callers 2

delete_indexMethod · 0.80
set_pagesMethod · 0.80

Calls 5

scan_rowsMethod · 0.80
row_hashMethod · 0.80
pointerMethod · 0.80
collectMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected