![]() |
VRS
A file format for sensor data.
|
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) |
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:
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.
cacheFile | path to the cache file to read. |
outStreamIds | stream Ids read. |
outFileTags | file tags read. |
outStreamTags | stream tags read. |
outRecordIndex | VRS file index read. |
outFileHasIndex | does the original VRS file have a proper index. |
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.
cacheFile | path to the cache file to write. |
streamIds | stream IDs to save. |
fileTags | file tags to save. |
streamTags | stream tags to save. |
recordIndex | VRS file index to save. |
fileHasIndex | does the original VRS file have a proper index. |