what is the IDE doing..
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
This commit is contained in:
@ -69,14 +69,14 @@ ReturnValue_t PersistentTmStore::handleCommandQueue(StorageManagerIF& ipcStore,
|
||||
SerializeIF::Endianness::NETWORK);
|
||||
SerializeAdapter::deSerialize(&dumpUntilUnixSeconds, accessor.second.data() + 4, &size,
|
||||
SerializeIF::Endianness::NETWORK);
|
||||
dumpFromUpTo(dumpFromUnixSeconds, dumpUntilUnixSeconds);
|
||||
startDumpFromUpTo(dumpFromUnixSeconds, dumpUntilUnixSeconds);
|
||||
}
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
void PersistentTmStore::dumpFrom(uint32_t fromUnixSeconds) {
|
||||
return dumpFromUpTo(fromUnixSeconds, currentTv.tv_sec);
|
||||
ReturnValue_t PersistentTmStore::startDumpFrom(uint32_t fromUnixSeconds) {
|
||||
return startDumpFromUpTo(fromUnixSeconds, currentTv.tv_sec);
|
||||
}
|
||||
|
||||
ReturnValue_t PersistentTmStore::storePacket(PusTmReader& reader) {
|
||||
@ -155,7 +155,7 @@ void PersistentTmStore::deleteUpTo(uint32_t unixSeconds) {
|
||||
}
|
||||
// Convert file time to the UNIX epoch
|
||||
struct tm fileTime {};
|
||||
if (pathToTm(file.path(), fileTime) != returnvalue::OK) {
|
||||
if (pathToTime(file.path(), fileTime) != returnvalue::OK) {
|
||||
sif::error << "Time extraction for " << file << "failed" << std::endl;
|
||||
continue;
|
||||
}
|
||||
@ -166,32 +166,30 @@ void PersistentTmStore::deleteUpTo(uint32_t unixSeconds) {
|
||||
}
|
||||
}
|
||||
|
||||
void PersistentTmStore::dumpFromUpTo(uint32_t fromUnixSeconds, uint32_t upToUnixSeconds) {
|
||||
ReturnValue_t PersistentTmStore::startDumpFromUpTo(uint32_t fromUnixSeconds,
|
||||
uint32_t upToUnixSeconds) {
|
||||
using namespace std::filesystem;
|
||||
for (auto const& file : directory_iterator(basePath)) {
|
||||
if (file.is_directory()) {
|
||||
continue;
|
||||
}
|
||||
struct tm fileTime {};
|
||||
if (pathToTm(file.path(), fileTime) != returnvalue::OK) {
|
||||
sif::error << "Time extraction for file " << file << "failed" << std::endl;
|
||||
continue;
|
||||
}
|
||||
auto fileEpoch = static_cast<uint32_t>(timegm(&fileTime));
|
||||
if ((fileEpoch > fromUnixSeconds) and (fileEpoch + rolloverDiffSeconds <= upToUnixSeconds)) {
|
||||
fileToPackets(file, fileEpoch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t PersistentTmStore::pathToTm(const std::filesystem::path& path, struct tm& time) {
|
||||
auto pathStr = path.string();
|
||||
size_t splitChar = pathStr.find('_');
|
||||
auto timeOnlyStr = pathStr.substr(splitChar + 1);
|
||||
if (nullptr == strptime(timeOnlyStr.c_str(), FILE_DATE_FORMAT, &time)) {
|
||||
if (state == State::DUMPING) {
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
activeDumpDirIter = directory_iterator(basePath);
|
||||
state = State::DUMPING;
|
||||
return returnvalue::OK;
|
||||
// for (auto const& file : directory_iterator(basePath)) {
|
||||
// if (file.is_directory()) {
|
||||
// continue;
|
||||
// }
|
||||
// struct tm fileTime {};
|
||||
// if (pathToTm(file.path(), fileTime) != returnvalue::OK) {
|
||||
// sif::error << "Time extraction for file " << file << "failed" << std::endl;
|
||||
// continue;
|
||||
// }
|
||||
// auto fileEpoch = static_cast<uint32_t>(timegm(&fileTime));
|
||||
// if ((fileEpoch > fromUnixSeconds) and (fileEpoch + rolloverDiffSeconds <= upToUnixSeconds))
|
||||
// {
|
||||
// fileToPackets(file, fileEpoch);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
void PersistentTmStore::fileToPackets(const std::filesystem::path& path, uint32_t unixStamp) {
|
||||
@ -227,6 +225,18 @@ void PersistentTmStore::fileToPackets(const std::filesystem::path& path, uint32_
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t PersistentTmStore::dumpNextPacket(size_t& dumpedLen) {}
|
||||
|
||||
ReturnValue_t PersistentTmStore::pathToTime(const std::filesystem::path& path, struct tm& time) {
|
||||
auto pathStr = path.string();
|
||||
size_t splitChar = pathStr.find('_');
|
||||
auto timeOnlyStr = pathStr.substr(splitChar + 1);
|
||||
if (nullptr == strptime(timeOnlyStr.c_str(), FILE_DATE_FORMAT, &time)) {
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PersistentTmStore::createMostRecentFile(std::optional<uint8_t> suffix) {
|
||||
using namespace std::filesystem;
|
||||
unsigned currentIdx = 0;
|
||||
|
Reference in New Issue
Block a user