pub struct Catalog { /* private fields */ }Expand description
Every table a native file holds, without the directory of any of them.
This is what opening a database reads. It is the small level of the directory, so the cost is proportional to how many tables there are rather than to how much data they hold, and a session that touches two tables of eight decodes two table directories.
The file handle is shared with every reader this hands out. Eight tables in one file is one open file descriptor, not eight, which is the other thing one file buys over a file per table.
Implementations§
Source§impl Catalog
impl Catalog
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self>
pub fn open(path: impl AsRef<Path>) -> Result<Self>
Reads the highest valid catalog slot and nothing under it.
The readers it hands out keep pages in a pool of their own with no budget, so each column
holds its floor of four stripes and no more. A database opens with Catalog::open_in.
§Errors
If the file has no valid committed catalog or a catalog pointer is out of bounds.
Sourcepub fn open_in(path: impl AsRef<Path>, pool: &PagePool) -> Result<Self>
pub fn open_in(path: impl AsRef<Path>, pool: &PagePool) -> Result<Self>
The same, with every reader it hands out keeping its pages in pool.
§Errors
If the file has no valid committed catalog or a catalog pointer is out of bounds.
Sourcepub fn names(&self) -> impl ExactSizeIterator<Item = &str>
pub fn names(&self) -> impl ExactSizeIterator<Item = &str>
The tables in the file, in the order they were written.
Sourcepub fn rows(&self) -> impl ExactSizeIterator<Item = (&str, usize)>
pub fn rows(&self) -> impl ExactSizeIterator<Item = (&str, usize)>
The same tables with how many rows each of them holds.
The names alone answer which tables the file has, which is what a checkpoint needs to know. A load asks a second question: whether a table already in the file is really in the way of the one it wants to write. A table with no rows is not, because it has no pages the next generation would have to carry, so the count has to come out of the catalog beside the name.
Sourcepub fn views(&self) -> impl ExactSizeIterator<Item = &ViewEntry>
pub fn views(&self) -> impl ExactSizeIterator<Item = &ViewEntry>
The views in the file, in the order they were written.
Whole, unlike Catalog::names, which hands back names and makes the caller ask for a table
by one. A view is a few strings and a column list and it was all read at open, so there is
nothing left to go and fetch and no reason to make the caller ask twice.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether the file holds no table at all, which is what Writer::empty writes and what a
database somebody dropped the last table out of comes back as.
Sourcepub fn table(&self, name: &str) -> Result<Reader>
pub fn table(&self, name: &str) -> Result<Reader>
Opens one table by name, decoding its directory now.
§Errors
If there is no table by that name, or its directory is torn or points outside the file.
Sourcepub fn nonzero_count(&self, name: &str, column: usize) -> Result<Option<u64>>
pub fn nonzero_count(&self, name: &str, column: usize) -> Result<Option<u64>>
Counts non-null, nonzero values from a validated native directory without building a
reader for every stripe. Returns None when the bounded frequency synopsis cannot prove
the count, so callers can use the ordinary query path.
Sourcepub fn aggregate_sums(
&self,
name: &str,
columns: &[usize],
) -> Result<Option<CertifiedSums>>
pub fn aggregate_sums( &self, name: &str, columns: &[usize], ) -> Result<Option<CertifiedSums>>
Exact signed-integer sums and non-null counts from the small catalog. The table directory checksum is still checked once before any certificate can answer a query.
Sourcepub fn distinct_count(&self, name: &str, column: usize) -> Result<Option<u64>>
pub fn distinct_count(&self, name: &str, column: usize) -> Result<Option<u64>>
Exact non-null distinct count from the small catalog, after checking the table directory.
Sourcepub fn integer_extremes(
&self,
name: &str,
column: usize,
) -> Result<Option<IntegerExtremes>>
pub fn integer_extremes( &self, name: &str, column: usize, ) -> Result<Option<IntegerExtremes>>
Exact integer or date ends from the small catalog after checking the table directory.
Sourcepub fn exact_numeric_frequencies(
&self,
name: &str,
column: usize,
) -> Result<Option<NumericFrequencies>>
pub fn exact_numeric_frequencies( &self, name: &str, column: usize, ) -> Result<Option<NumericFrequencies>>
Complete numeric frequencies from the small catalog, after checking the table directory.
Sourcepub fn table_fields(&self, name: &str) -> Option<&[Field]>
pub fn table_fields(&self, name: &str) -> Option<&[Field]>
The schema copied into the small file catalog, available without opening the table directory.