VRS
A file format for sensor data.
Loading...
Searching...
No Matches
Functions
vrs::FileDetailsCache Namespace Reference

Helper methods to read & write file details in a cache file. More...

Functions

int write (const string &cacheFile, const set< StreamId > &streamIds, const map< string, string > &fileTags, const map< StreamId, StreamTags > &streamTags, const vector< IndexRecord::RecordInfo > &recordIndex, bool fileHasIndex)
 
int read (const string &cacheFile, set< StreamId > &outStreamIds, map< string, string > &outFileTags, map< StreamId, StreamTags > &outStreamTags, vector< IndexRecord::RecordInfo > &outRecordIndex, bool &outFileHasIndex)
 

Detailed Description

Helper methods to read & write file details in a cache file.

File Format:

FileHeader: same struct as a regular VRS file, but with different magic numbers. descriptionRecordOffset: offset of the description record (same as for a VRS file). indexRecordOffset: offset of the index data, in its special case format. firstUserRecordOffset: offset past the index data, effectively the end of the file.

Description record: same as for a regular VRS file.

Index data: custom for this use case, stream IDs and the index itself. uint32_t recordableCount: count of StreamId structs, always present, value may be 0. DiskStreamId streamId[recordableCount]: one per stream ID instance uint32_t recordCount: count of DiskRecordInfo structs, always present, value may be 0. DiskRecordInfo recordInfo[recordCount]; // one per actual record, zstd-frames compressed.

The file header's "future4" is used to save some flags, which may not have been set in the past:

Function Documentation

◆ read()

int vrs::FileDetailsCache::read ( const string &  cacheFile,
set< StreamId > &  outStreamIds,
map< string, string > &  outFileTags,
map< StreamId, StreamTags > &  outStreamTags,
vector< IndexRecord::RecordInfo > &  outRecordIndex,
bool &  outFileHasIndex 
)

Read a VRS details file cache from a disk location.

Parameters
cacheFilepath to the cache file to read.
outStreamIdsstream Ids read.
outFileTagsfile tags read.
outStreamTagsstream tags read.
outRecordIndexVRS file index read.
outFileHasIndexdoes the original VRS file have a proper index.
Returns
A status code, 0 for success.

◆ write()

int vrs::FileDetailsCache::write ( const string &  cacheFile,
const set< StreamId > &  streamIds,
const map< string, string > &  fileTags,
const map< StreamId, StreamTags > &  streamTags,
const vector< IndexRecord::RecordInfo > &  recordIndex,
bool  fileHasIndex 
)

Create a VRS details file cache at a disk location, in one synchronous operation.

Parameters
cacheFilepath to the cache file to write.
streamIdsstream IDs to save.
fileTagsfile tags to save.
streamTagsstream tags to save.
recordIndexVRS file index to save.
fileHasIndexdoes the original VRS file have a proper index.
Returns
A status code, 0 for success.