Refactor TM handling #450
@ -65,7 +65,7 @@ ReturnValue_t PersistentTmStore::handleCommandQueue(StorageManagerIF& ipcStore)
|
|||||||
SerializeAdapter::deSerialize(&dumpUntilUnixSeconds, accessor.second.data() + 4, &size,
|
SerializeAdapter::deSerialize(&dumpUntilUnixSeconds, accessor.second.data() + 4, &size,
|
||||||
SerializeIF::Endianness::NETWORK);
|
SerializeIF::Endianness::NETWORK);
|
||||||
result = startDumpFromUpTo(dumpFromUnixSeconds, dumpUntilUnixSeconds);
|
result = startDumpFromUpTo(dumpFromUnixSeconds, dumpUntilUnixSeconds);
|
||||||
if (result != returnvalue::OK and result == BUSY_DUMPING) {
|
if (result == BUSY_DUMPING) {
|
||||||
triggerEvent(persTmStore::BUSY_DUMPING_EVENT);
|
triggerEvent(persTmStore::BUSY_DUMPING_EVENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -197,14 +197,11 @@ ReturnValue_t PersistentTmStore::loadNextDumpFile() {
|
|||||||
using namespace std::filesystem;
|
using namespace std::filesystem;
|
||||||
dumpParams.currentSize = 0;
|
dumpParams.currentSize = 0;
|
||||||
std::error_code e;
|
std::error_code e;
|
||||||
dumpParams.dirIter++;
|
|
||||||
for (; dumpParams.dirIter != directory_iterator(); dumpParams.dirIter++) {
|
for (; dumpParams.dirIter != directory_iterator(); dumpParams.dirIter++) {
|
||||||
dumpParams.dirEntry = *dumpParams.dirIter;
|
dumpParams.dirEntry = *dumpParams.dirIter;
|
||||||
if (dumpParams.dirEntry.is_directory(e)) {
|
if (dumpParams.dirEntry.is_directory(e)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
sif::debug << "handling file " << dumpParams.dirEntry << std::endl;
|
|
||||||
|
|
||||||
dumpParams.fileSize = std::filesystem::file_size(dumpParams.dirEntry.path(), e);
|
dumpParams.fileSize = std::filesystem::file_size(dumpParams.dirEntry.path(), e);
|
||||||
if (e) {
|
if (e) {
|
||||||
sif::error << "PersistentTmStore: Could not retrieve file size: " << e.message() << std::endl;
|
sif::error << "PersistentTmStore: Could not retrieve file size: " << e.message() << std::endl;
|
||||||
@ -237,6 +234,8 @@ ReturnValue_t PersistentTmStore::loadNextDumpFile() {
|
|||||||
}
|
}
|
||||||
ifile.read(reinterpret_cast<char*>(fileBuf.data()),
|
ifile.read(reinterpret_cast<char*>(fileBuf.data()),
|
||||||
static_cast<std::streamsize>(dumpParams.fileSize));
|
static_cast<std::streamsize>(dumpParams.fileSize));
|
||||||
|
// Increment iterator for next cycle.
|
||||||
|
dumpParams.dirIter++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,7 +251,6 @@ ReturnValue_t PersistentTmStore::dumpNextPacket(DirectTmSinkIF& tmSink, size_t&
|
|||||||
if (state == State::IDLE) {
|
if (state == State::IDLE) {
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
sif::debug << "Current file idx: " << dumpParams.currentSize << std::endl;
|
|
||||||
PusTmReader reader(&timeReader, fileBuf.data() + dumpParams.currentSize,
|
PusTmReader reader(&timeReader, fileBuf.data() + dumpParams.currentSize,
|
||||||
fileBuf.size() - dumpParams.currentSize);
|
fileBuf.size() - dumpParams.currentSize);
|
||||||
// CRC check to fully ensure this is a valid TM
|
// CRC check to fully ensure this is a valid TM
|
||||||
|
Loading…
Reference in New Issue
Block a user