Akumuli
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Akumuli::Sequencer Struct Reference

Akumuli can accept unordered time-series (this is the case when clocks of the different time-series sources are slightly out of sync). This component accepts all of them, filter out late writes and reorder all the remaining samples by timestamp and parameter id. More...

#include <sequencer.h>

Public Types

typedef std::vector
< TimeSeriesValue
SortedRun
 
typedef std::shared_ptr
< SortedRun > 
PSortedRun
 
typedef std::mutex Mutex
 
typedef std::unique_lock< Mutex > Lock
 

Public Member Functions

 Sequencer (aku_FineTuneParams const &config)
 
std::tuple< aku_Status, int > add (TimeSeriesValue const &value)
 Timestamp of the sample can be out of order. More...
 
void merge (Caller &caller, InternalCursor *cur)
 Simple merge and sync without compression. (depricated)
 
aku_Status merge_and_compress (PageHeader *target, bool enforce_write=false)
 
aku_Status close (PageHeader *target)
 Close cache for writing, merge everything to page header.
 
int reset ()
 
void search (std::shared_ptr< QP::IQueryProcessor > query, int sequence_number) const
 
std::tuple< aku_Timestamp, int > get_window () const
 

Public Attributes

std::vector< PSortedRun > runs_
 
std::vector< PSortedRun > ready_
 
PSortedRun key_
 
const aku_Duration window_size_
 
aku_Timestamp top_timestamp_
 
aku_Timestamp checkpoint_
 
std::atomic_int sequence_number_
 
Mutex runs_resize_lock_
 
std::vector< RWLockrun_locks_
 
const size_t c_threshold_
 

Static Public Attributes

static const int RUN_LOCK_MAX_BACKOFF = 0x100
 
static const int RUN_LOCK_BUSY_COUNT = 0xFFF
 
static const int RUN_LOCK_FLAGS_MASK = 0x0FF
 
static const int RUN_LOCK_FLAGS_SIZE = 0x100
 

Detailed Description

Akumuli can accept unordered time-series (this is the case when clocks of the different time-series sources are slightly out of sync). This component accepts all of them, filter out late writes and reorder all the remaining samples by timestamp and parameter id.

Time-series sequencer.

Member Function Documentation

std::tuple< aku_Status, int > Akumuli::Sequencer::add ( TimeSeriesValue const &  value)

Timestamp of the sample can be out of order.

Add new sample to sequence.

Returns
error code and flag that indicates whether of not new checkpoint is createf
aku_Status Akumuli::Sequencer::merge_and_compress ( PageHeader target,
bool  enforce_write = false 
)

Merge all values (ts, id, offset, length) and write it to target page. caller and cur parameters used for communication with storage (error reporting).

int Akumuli::Sequencer::reset ( )

Reset sequencer. All runs are ready for merging.

Returns
new sequence number.
void Akumuli::Sequencer::search ( std::shared_ptr< QP::IQueryProcessor query,
int  sequence_number 
) const

Search in sequencer data.

Parameters
queryrepresents search query
sequence_numbersequence number obtained with get_window function
Note
search method follows common pattern used by all methods except sequence_number parameter. This parameter is used to organize optimistic concurrency control. User must call get_window fn and get current window and seq-number. This seq-number then passed to search method. If seq-number is changed between calls to get_window and search - search will be aborted and AKU_EBUSY.error code will be returned If merge occures during search - search will be aborted and AKU_EBUSY error code will be returned.

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