return whether file was swapped
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-03-09 20:44:55 +01:00
parent 00e04e8b77
commit 2374dea493
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
3 changed files with 7 additions and 3 deletions

View File

@ -222,7 +222,7 @@ ReturnValue_t PersistentTmStore::loadNextDumpFile() {
return returnvalue::OK;
}
ReturnValue_t PersistentTmStore::dumpNextPacket(DirectTmSinkIF& tmSink, size_t& dumpedLen) {
ReturnValue_t PersistentTmStore::dumpNextPacket(DirectTmSinkIF& tmSink, size_t& dumpedLen, bool& fileHasSwapped) {
if (state == State::IDLE) {
return returnvalue::FAILED;
}
@ -239,6 +239,7 @@ ReturnValue_t PersistentTmStore::dumpNextPacket(DirectTmSinkIF& tmSink, size_t&
dumpParams.currentSize += reader.getFullPacketLen();
dumpedLen = reader.getFullPacketLen();
if (dumpParams.currentSize >= dumpParams.fileSize) {
fileHasSwapped = true;
return loadNextDumpFile();
}
} else {
@ -248,6 +249,7 @@ ReturnValue_t PersistentTmStore::dumpNextPacket(DirectTmSinkIF& tmSink, size_t&
// restore the file dump, but for now do not trust the file.
dumpedLen = 0;
std::remove(dumpParams.dirEntry.path().c_str());
fileHasSwapped = true;
return loadNextDumpFile();
}
return returnvalue::OK;

View File

@ -66,7 +66,7 @@ class PersistentTmStore : public TmStoreFrontendSimpleIF, public SystemObject {
void deleteUpTo(uint32_t unixSeconds);
ReturnValue_t startDumpFrom(uint32_t fromUnixSeconds);
ReturnValue_t startDumpFromUpTo(uint32_t fromUnixSeconds, uint32_t upToUnixSeconds);
ReturnValue_t dumpNextPacket(DirectTmSinkIF& tmSink, size_t& dumpedLen);
ReturnValue_t dumpNextPacket(DirectTmSinkIF& tmSink, size_t& dumpedLen, bool& fileHasSwapped);
ReturnValue_t storePacket(PusTmReader& reader);

View File

@ -23,9 +23,11 @@ bool TmStoreTaskBase::handleOneStore(PersistentTmStoreWithTmQueue& store) {
// Dump TMs when applicable
if (store.getState() == PersistentTmStore::State::DUMPING) {
size_t dumpedLen;
bool fileHasSwapped;
// TODO: Maybe do a bit of a delay every 100-200 packets?
// TODO: We could continously dump until a file swap during active downlink..
// TODO: handle returnvalue?
result = store.dumpNextPacket(channel, dumpedLen);
result = store.dumpNextPacket(channel, dumpedLen, fileHasSwapped);
if (result == returnvalue::OK) {
dumpsPerformed = true;
}