65 int open(
const vector<string>& paths);
72 int open(
const vector<FileSpec>& fileSpecs);
79 int open(
const string& path) {
80 return open(vector<string>{path});
89 return open(vector<FileSpec>{fileSpec});
98 void setRelatedFileTags(vector<string>&& tags);
110 const set<UniqueStreamId>& getStreams()
const;
120 uint32_t getRecordCount()
const;
145 const string&
getTag(
const string& name)
const {
146 return getTag(fileTags_, name);
154 return getTag(getTags(uniqueStreamId).user, name);
162 vector<pair<string, int64_t>> getFileChunks()
const;
175 const string& getSerialNumber(
UniqueStreamId uniqueStreamId)
const;
182 vector<UniqueStreamId> getStreams(
RecordableTypeId typeId,
const string& flavor = {})
const;
205 const string& tagName,
207 RecordableTypeId typeId = RecordableTypeId::Undefined)
const;
213 UniqueStreamId getStreamForSerialNumber(
const string& serialNumber)
const;
233 uint32_t getRecordIndex(
const IndexRecord::RecordInfo* record)
const;
238 const IndexRecord::RecordInfo* getRecord(uint32_t globalIndex)
const;
243 uint32_t getRecordSize(uint32_t globalIndex)
const;
251 const IndexRecord::RecordInfo* getRecord(
UniqueStreamId streamId, uint32_t indexNumber)
const;
260 const IndexRecord::RecordInfo*
261 getRecord(
UniqueStreamId streamId, Record::Type recordType, uint32_t indexNumber)
const;
268 const IndexRecord::RecordInfo* getLastRecord(
UniqueStreamId streamId, Record::Type recordType)
274 const vector<const IndexRecord::RecordInfo*>& getIndex(
UniqueStreamId streamId)
const;
281 return getTag(getTags(streamId).
vrs, Recordable::getOriginalNameTagName());
344 bool prefetchRecordSequence(
345 const vector<const IndexRecord::RecordInfo*>& records,
346 bool clearSequence =
true);
358 bool purgeFileCache();
410 Record::Type recordType = Record::Type::UNDEFINED)
const;
415 unique_ptr<FileHandler> getFileHandler()
const;
423 UniqueStreamId getUniqueStreamId(
const IndexRecord::RecordInfo* record)
const;
427 int64_t getTotalSourceSize()
const;
446 bool readFirstConfigurationRecord(
448 StreamPlayer* streamPlayer =
nullptr);
467 bool readFirstConfigurationRecords(StreamPlayer* streamPlayer =
nullptr);
477 bool readFirstConfigurationRecordsForType(
478 RecordableTypeId typeId,
479 StreamPlayer* streamPlayer =
nullptr);
482 const vector<unique_ptr<RecordFileReader>>&
getReaders()
const {
486 static unique_ptr<RecordFileReader> reduceToRecordFileReader_TEMPORARY_API_TO_DELETE(
490 using StreamIdToUniqueIdMap = map<StreamId, UniqueStreamId>;
491 using StreamIdReaderPair = pair<StreamId, RecordFileReader*>;
495 bool hasSingleFile()
const {
496 return readers_.size() == 1;
503 bool areFilesRelated()
const;
505 void initializeUniqueStreamIds();
508 void createConsolidatedIndex();
510 void initializeFileTags();
513 UniqueStreamId generateUniqueStreamId(StreamId duplicateStreamId)
const;
515 const StreamIdReaderPair* getStreamIdReaderPair(
UniqueStreamId uniqueStreamId)
const;
517 static const string& getTag(
const map<string, string>& tags,
const string& name);
521 RecordFileReader* getReader(
const IndexRecord::RecordInfo* record)
const;
526 UniqueStreamId getUniqueStreamIdInternal(
const IndexRecord::RecordInfo* record)
const;
527 UniqueStreamId getUniqueStreamIdInternal(
const RecordFileReader* reader, StreamId streamId)
const;
529 bool timeLessThan(
const IndexRecord::RecordInfo* lhs,
const IndexRecord::RecordInfo* rhs)
const;
531 class RecordComparatorGT {
533 explicit RecordComparatorGT(
const MultiRecordFileReader& parent) : parent_(parent) {}
535 bool operator()(
const IndexRecord::RecordInfo* lhs,
const IndexRecord::RecordInfo* rhs)
const {
536 return parent_.timeLessThan(rhs, lhs);
540 const MultiRecordFileReader& parent_;
543 bool isOpened_{
false};
545 vector<unique_ptr<RecordFileReader>> readers_;
547 unique_ptr<vector<const IndexRecord::RecordInfo*>> recordIndex_;
550 set<UniqueStreamId> uniqueStreamIds_;
551 map<const RecordFileReader*, StreamIdToUniqueIdMap> readerStreamIdToUniqueMap_;
552 map<UniqueStreamId, StreamIdReaderPair> uniqueToStreamIdReaderPairMap_;
554 vector<string> filePaths_;
555 const RecordComparatorGT recordComparatorGT_{*
this};
556 map<string, string> fileTags_;
558 vector<string> relatedFileTags_;
561 FRIEND_TEST(::MultiRecordFileReaderTest, multiFile);