pub struct CompressedPage {
compressed_page: Page,
uncompressed_size: usize,
}Expand description
Helper struct to represent pages with potentially compressed buffer (data page v1) or compressed and concatenated buffer (def levels + rep levels + compressed values for data page v2).
The difference with Page is that Page buffer is always uncompressed.
Fields§
§compressed_page: Page§uncompressed_size: usizeImplementations§
Source§impl CompressedPage
impl CompressedPage
Sourcepub fn new(compressed_page: Page, uncompressed_size: usize) -> Self
pub fn new(compressed_page: Page, uncompressed_size: usize) -> Self
Creates CompressedPage from a page with potentially compressed buffer and
uncompressed size.
Sourcepub fn compressed_page(&self) -> &Page
pub fn compressed_page(&self) -> &Page
Returns underlying page with potentially compressed buffer.
Sourcepub fn uncompressed_size(&self) -> usize
pub fn uncompressed_size(&self) -> usize
Returns uncompressed size in bytes.
Sourcepub fn compressed_size(&self) -> usize
pub fn compressed_size(&self) -> usize
Returns compressed size in bytes.
Note that it is assumed that buffer is compressed, but it may not be. In this case compressed size will be equal to uncompressed size.
Sourcepub fn num_values(&self) -> u32
pub fn num_values(&self) -> u32
Number of values in page.
Sourcepub fn memory_usage(&self) -> usize
pub fn memory_usage(&self) -> usize
Returns the number of heap bytes this page currently holds.
This is the page’s compressed buffer (the embedded [Bytes]); use it to
account for a buffered page’s memory footprint rather than reaching for
data().len() at each call site.
Sourcepub(crate) fn to_thrift_header(&self) -> Result<PageHeader>
pub(crate) fn to_thrift_header(&self) -> Result<PageHeader>
Returns the thrift page header
Sourcepub(crate) fn with_new_compressed_buffer(self, new_buffer: Bytes) -> Self
pub(crate) fn with_new_compressed_buffer(self, new_buffer: Bytes) -> Self
Update the compressed buffer for a page. This might be required when encrypting page data for example. The size of uncompressed data must not change.