Clones the structure of this table into a new one with the same schema, visitor program, and indices. The new table will be completely empty and will use the given `squashed_offset` instead of that of `self`.
(&self, squashed_offset: SquashedOffset)
| 1593 | /// The new table will be completely empty |
| 1594 | /// and will use the given `squashed_offset` instead of that of `self`. |
| 1595 | pub fn clone_structure(&self, squashed_offset: SquashedOffset) -> Self { |
| 1596 | // Clone a bunch of static data. |
| 1597 | // NOTE(centril): It's important that these be cheap to clone. |
| 1598 | // This is why they are all `Arc`ed or have some sort of small-vec optimization. |
| 1599 | let schema = self.schema.clone(); |
| 1600 | let layout = self.row_layout().clone(); |
| 1601 | let sbl = self.inner.static_layout.clone(); |
| 1602 | let visitor = self.inner.visitor_prog.clone(); |
| 1603 | |
| 1604 | // If we had a pointer map, we'll have one in the cloned one as well, but empty. |
| 1605 | let pm = self.pointer_map.as_ref().map(|_| PointerMap::default()); |
| 1606 | |
| 1607 | // Make the new table. |
| 1608 | let mut new = Table::new_raw(schema, layout, sbl, visitor, squashed_offset, pm); |
| 1609 | |
| 1610 | // Clone the index structure. The table is empty, so no need to `build_from_rows`. |
| 1611 | for (&index_id, index) in self.indexes.iter() { |
| 1612 | new.indexes.insert(index_id, index.clone_structure()); |
| 1613 | } |
| 1614 | new |
| 1615 | } |
| 1616 | |
| 1617 | /// Returns the number of bytes occupied by the pages and the blob store. |
| 1618 | /// Note that result can be more than the actual physical size occupied by the table |
no test coverage detected