seems to work well
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2023-06-24 11:08:50 +02:00
parent 18b67d18a7
commit a8ab40674f
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -17,6 +17,8 @@
using namespace returnvalue;
static constexpr bool DEBUG_DUMPS = false;
PersistentTmStore::PersistentTmStore(PersistentTmStoreArgs args)
: SystemObject(args.objectId),
tmStore(args.tmStore),
@ -75,7 +77,12 @@ ReturnValue_t PersistentTmStore::buildDumpSet(uint32_t fromUnixSeconds, uint32_t
DumpIndex dumpIndex;
dumpIndex.epoch = fileEpoch;
dumpIndex.suffixIdx = extractSuffix(file.string());
// sif::debug << "Inserting file " << fileOrDir.path() << std::endl;
if (DEBUG_DUMPS) {
sif::debug << "Inserting file " << fileOrDir.path() << std::endl;
if (dumpIndex.suffixIdx.has_value()) {
sif::debug << "Suffix: " << static_cast<int>(dumpIndex.suffixIdx.value()) << std::endl;
}
}
dumpParams.orderedDumpFilestamps.emplace(dumpIndex);
}
}
@ -94,8 +101,8 @@ std::optional<uint8_t> PersistentTmStore::extractSuffix(const std::string& pathS
std::optional<uint8_t> number;
try {
number = std::stoi(numberStr);
if (number < 0 or number > std::numeric_limits<uint8_t>::max()) {
return number;
if (number.value() > std::numeric_limits<uint8_t>::max()) {
return std::nullopt;
}
} catch (std::invalid_argument& exception) {
@ -309,7 +316,9 @@ ReturnValue_t PersistentTmStore::loadNextDumpFile() {
sif::error << "PersistentTmStore: File is bad. Loading next file" << std::endl;
continue;
}
// sif::debug << baseName << " dump: Loading " << dumpParams.currentFile << std::endl;
if (DEBUG_DUMPS) {
sif::debug << baseName << " dump: Loading " << dumpParams.currentFile << std::endl;
}
ifile.read(reinterpret_cast<char*>(fileBuf.data()),
static_cast<std::streamsize>(dumpParams.fileSize));
// Increment iterator for next cycle.