VRS internal class to manage the records of a specific Recordable after their creation.
More...
#include <RecordManager.h>
|
| RecordManager (const RecordManager &)=delete |
|
void | operator= (const RecordManager &)=delete |
|
Record * | createRecord (double timestamp, Record::Type type, uint32_t formatVersion, const DataSource &data) |
|
Record * | createUncompressedRecord (double timestamp, Record::Type type, uint32_t formatVersion, const DataSource &data, std::unique_ptr< DirectWriteRecordData > &&directWriteData) |
|
uint32_t | purgeOldRecords (double oldestTimestamp, bool recycleBuffers=true) |
|
void | purgeCache () |
| Release as much memory as possible, by deleting all the records in the cache.
|
|
void | collectOldRecords (double maxAge, list< Record * > &outCollectedRecords) |
|
CompressionPreset | getCompression () const |
|
void | setCompression (CompressionPreset compression) |
|
void | setMaxCacheSize (size_t max) |
|
size_t | getCurrentCacheSize () const |
|
VRS internal class to manage the records of a specific Recordable after their creation.
Each Recordable has its own RecordManager to minimize (ideally avoid) inter-thread locking. All timestamps are in seconds since some arbitrary point in time, and must be using the same time domain for the entire VRS file.
◆ collectOldRecords()
void vrs::RecordManager::collectOldRecords |
( |
double |
maxAge, |
|
|
list< Record * > & |
outCollectedRecords |
|
) |
| |
Collect records older than a specific timestamp. The ownership of the records returned is transferred to the caller.
- Parameters
-
maxAge | Max timestamp value of the records to collect. |
collectedRecords | A container that will contain the collected records. |
◆ createRecord()
Create & hold a record using the given parameters. RecordManager is responsible for deleting the record. Copies the data referenced by the DataSource.
- Parameters
-
timestamp | Timestamp of the record, in seconds. |
type | Type of the record. |
formatVersion | Version number of the format of the record, so that when the record is read, the data can be interpreted appropriately. |
data | A DataSource that points to the payload to copy in the record. |
- Returns
- A pointer to the record created.
◆ createUncompressedRecord()
Create & hold a record using the given parameters. RecordManager is responsible for deleting the record. Copies the data referenced by the first DataSource, and takes ownership of directWriteData, which will be used to write the last part of the record directly in the file.
- Parameters
-
timestamp | Timestamp of the record, in seconds. |
type | Type of the record. |
formatVersion | Version number of the format of the record, so that when the record is read, the data can be interpreted appropriately. |
data | A DataSource that points to the payload to copy in the record immediately. |
directWriteData | data to write directly in the file at the end of the record. |
- Returns
- A pointer to the record created.
◆ getCompression()
Get the compression preset to use when writing the records of this RecordManager.
- Returns
- The compression preset.
◆ getCurrentCacheSize()
size_t vrs::RecordManager::getCurrentCacheSize |
( |
| ) |
const |
|
inline |
Get the count of recycled records are currently waiting to be reused.
- Returns
- Number of recycled records available.
◆ purgeOldRecords()
uint32_t vrs::RecordManager::purgeOldRecords |
( |
double |
oldestTimestamp, |
|
|
bool |
recycleBuffers = true |
|
) |
| |
Recycle or delete buffers older than a time.
- Parameters
-
oldestTimestamp | Max timestamp of the records to purge. |
recycleBuffers | Tell if old records should be recycled (true) or delete (false). |
- Returns
- Number of records purged.
◆ setCompression()
◆ setMaxCacheSize()
void vrs::RecordManager::setMaxCacheSize |
( |
size_t |
max | ) |
|
|
inline |
If you know that you have a lot samples that are small. You can increase the cache size to avoid allocations. The default value is kMaxCacheSize = 10.
- Parameters
-
max | The maximum amount of reusable records to keep around. |
The documentation for this class was generated from the following files: