|
roo_monitoring
API Documentation for roo_monitoring
|
Sequential reader for a single vault file. More...
#include <vault.h>
Public Member Functions | |
| VaultFileReader (const Collection *collection) | |
| Creates a reader bound to the specified collection. | |
| bool | open (const VaultFileRef &ref, int index, int64_t offset) |
| Opens the file and seeks to the specified index and byte offset. | |
| bool | is_open () const |
| Returns true if a file is currently open. | |
| void | close () |
| Closes the reader. | |
| void | seekForward (int64_t timestamp) |
| Advances the cursor to the first entry at or after the timestamp. | |
| bool | next (std::vector< Sample > *sample) |
| Reads the next entry and fills the sample vector. | |
| int | index () const |
| Returns the current entry index. | |
| bool | past_eof () const |
| Returns true if the reader has passed the end of file. | |
| bool | ok () const |
| Returns true if the file is either good or does not exist. | |
| roo_io::Status | status () const |
| Returns the current reader status. | |
| const VaultFileRef & | vault_ref () const |
| Returns the vault file reference for this reader. | |
| LogCursor | tell () |
| Returns the current log cursor. | |
| ~VaultFileReader () | |
Sequential reader for a single vault file.
A single vault file has the following format:
header: major version (uint8): currently always 1 minor version (uint8): currently always 1 entry[]: sample count (varint) sample[]: stream ID (varint) avg (uint16) min (uint16) max (uint16) fill (uint16)
The file name of the vault file implies the start timestamp. The level implies the time resolution. The finished vault always has 256 entries.
| roo_monitoring::VaultFileReader::VaultFileReader | ( | const Collection * | collection | ) |
|
inline |
|
inline |
Returns the current entry index.
Definition at line 127 of file vault.h.
Referenced by roo_monitoring::VaultIterator::cursor(), and open().
|
inline |
| bool roo_monitoring::VaultFileReader::next | ( | std::vector< Sample > * | sample | ) |
Reads the next entry and fills the sample vector.
Definition at line 145 of file vault.cpp.
References roo_monitoring::kResolution_65536_ms, past_eof(), and roo_monitoring::VaultFileRef::resolution().
Referenced by roo_monitoring::VaultIterator::next(), and seekForward().
|
inline |
| bool roo_monitoring::VaultFileReader::open | ( | const VaultFileRef & | ref, |
| int | index, | ||
| int64_t | offset | ||
| ) |
Opens the file and seeks to the specified index and byte offset.
Definition at line 77 of file vault.cpp.
References roo_monitoring::Collection::fs(), roo_monitoring::Collection::getVaultFilePath(), index(), and vault_ref().
Referenced by roo_monitoring::VaultIterator::next(), and roo_monitoring::VaultIterator::VaultIterator().
| bool roo_monitoring::VaultFileReader::past_eof | ( | ) | const |
Returns true if the reader has passed the end of file.
Definition at line 201 of file vault.cpp.
References roo_monitoring::kRangeElementCount.
Referenced by roo_monitoring::VaultIterator::next(), next(), seekForward(), and tell().
| void roo_monitoring::VaultFileReader::seekForward | ( | int64_t | timestamp | ) |
Advances the cursor to the first entry at or after the timestamp.
Definition at line 181 of file vault.cpp.
References roo_monitoring::kRangeElementCount, next(), past_eof(), roo_monitoring::VaultFileRef::resolution(), and roo_monitoring::VaultFileRef::timestamp().
Referenced by roo_monitoring::VaultIterator::VaultIterator().
|
inline |
| LogCursor roo_monitoring::VaultFileReader::tell | ( | ) |
Returns the current log cursor.
Definition at line 126 of file vault.cpp.
References past_eof(), and roo_monitoring::VaultFileRef::timestamp().
|
inline |