Akumuli
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | Static Public Member Functions | List of all members
Akumuli::PageHeader Class Reference

#include <page.h>

Public Member Functions

uint64_t get_page_length () const
 Get length of the page.
 
uint32_t get_page_id () const
 Get page ID.
 
uint32_t get_numpages () const
 Get number of pages.
 
uint32_t get_open_count () const
 Number of times page was opened for writing.
 
uint32_t get_close_count () const
 Number of times page was closed for writing.
 
void set_open_count (uint32_t cnt)
 Set open count.
 
void set_close_count (uint32_t cnt)
 Set open count.
 
void create_checkpoint ()
 Checkpoint and restore ///. More...
 
bool restore ()
 Restore, return true if flush needed.
 
std::pair
< aku_EntryIndexRecord, int > 
index_to_offset (uint32_t index) const
 Convert entry index to entry offset.
 
aku_EntryIndexRecordpage_index (int index)
 
const aku_EntryIndexRecordpage_index (int index) const
 
 PageHeader (uint32_t count, uint64_t length, uint32_t page_id, uint32_t numpages)
 C-tor.
 
void reuse ()
 Clear all page conent (open_count += 1)
 
void close ()
 Close page for write (close_count += 1)
 
uint32_t get_entries_count () const
 Return number of entries stored in page.
 
size_t get_free_space () const
 Returns amount of free space in bytes.
 
bool inside_bbox (aku_ParamId param, aku_Timestamp time) const
 
aku_Status add_entry (const aku_ParamId param, const aku_Timestamp timestamp, const aku_MemRange &range)
 
aku_Status add_chunk (const aku_MemRange data, const uint32_t free_space_required, uint32_t *out_offset)
 
aku_Status complete_chunk (const UncompressedChunk &data)
 
int get_entry_length_at (int entry_index) const
 
int get_entry_length (uint32_t offset) const
 
int copy_entry_at (int index, aku_Entry *receiver) const
 
int copy_entry (uint32_t offset, aku_Entry *receiver) const
 
const aku_Entryread_entry_at (uint32_t index) const
 
const aku_Timestamp read_timestamp_at (uint32_t index) const
 
const aku_Entryread_entry (uint32_t offset) const
 
const void * read_entry_data (uint32_t offset) const
 
void search (std::shared_ptr< QP::IQueryProcessor > query, std::shared_ptr< ChunkCache > cache=std::shared_ptr< ChunkCache >()) const
 Search matches inside the volume.
 
void get_stats (aku_StorageStats *rcv_stats)
 Get page status.
 

Static Public Member Functions

static void get_search_stats (aku_SearchStats *stats, bool reset=false)
 

Detailed Description

In-memory page representation. PageHeader represents begining of the page. Entry indexes grows from low to high adresses. Entries placed in the bottom of the page. This class must be nonvirtual.

Member Function Documentation

aku_Status Akumuli::PageHeader::add_chunk ( const aku_MemRange  data,
const uint32_t  free_space_required,
uint32_t *  out_offset 
)

Add some data to last entry. (without length)

Parameters
datadata element
free_space_requiredminimum amount of space inside the page
Returns
operation status
aku_Status Akumuli::PageHeader::add_entry ( const aku_ParamId  param,
const aku_Timestamp  timestamp,
const aku_MemRange &  range 
)

Add new entry to page data.

Parameters
entryentry
Returns
operation status
aku_Status Akumuli::PageHeader::complete_chunk ( const UncompressedChunk data)

Complete chunk. Add compressed header and index.

Parameters
datachunk header data (list of sorted timestamps, param ids, offsets and lengths
Returns
operation status
int Akumuli::PageHeader::copy_entry ( uint32_t  offset,
aku_Entry receiver 
) const

Copy entry from page to receiving buffer using offset.

Parameters
receiverreceiving buffer receiver.length must contain correct buffer length buffer length can be larger than sizeof(Entry)
Returns
0 if index out of range, -1*entry[index].length if buffer is to small, entry[index].length on success.
int Akumuli::PageHeader::copy_entry_at ( int  index,
aku_Entry receiver 
) const

Copy entry from page to receiving buffer using index.

Parameters
receiverreceiving buffer receiver.length must contain correct buffer length buffer length can be larger than sizeof(Entry)
Returns
0 if index out of range, -1*entry[index].length if buffer is to small, entry[index].length on success.
void Akumuli::PageHeader::create_checkpoint ( )

Checkpoint and restore ///.

Create checkpoint. Flush should be performed twice, before and after call to this method

int Akumuli::PageHeader::get_entry_length ( uint32_t  offset) const

Get length of the entry.

Parameters
offsetoffset of the entry.
Returns
0 if index is out of range, entry length otherwise.
int Akumuli::PageHeader::get_entry_length_at ( int  entry_index) const

Get length of the entry.

Parameters
entry_indexindex of the entry.
Returns
0 if index is out of range, entry length otherwise.
const aku_Entry * Akumuli::PageHeader::read_entry ( uint32_t  offset) const

Get pointer to entry without copying using offset

Parameters
entryoffset
Returns
pointer to entry or NULL
const aku_Entry * Akumuli::PageHeader::read_entry_at ( uint32_t  index) const

Get pointer to entry without copying using index

Parameters
indexentry index
Returns
pointer to entry or NULL
const void * Akumuli::PageHeader::read_entry_data ( uint32_t  offset) const

Get pointer to entry data without copying using data offset.

Parameters
dataoffset
Returns
pointer to entry data or NULL
const aku_Timestamp Akumuli::PageHeader::read_timestamp_at ( uint32_t  index) const

Get entry timefstamp by index

Parameters
indexentry index
Returns
timestamp

The documentation for this class was generated from the following files: