19 static_assert(
DP_MAX_DIRECTORIES > 0,
"Configuration DP_MAX_DIRECTORIES must be positive");
20 static_assert(
DP_MAX_FILES > 0,
"Configuration DP_MAX_FILES must be positive");
37 this->m_stateFile = stateFile;
42 static const FwSizeType slotSize =
sizeof(DpDstateFileEntry);
46 this->m_memPtr = allocator.
allocate(memId, this->m_memSize, notUsed);
49 if ((this->m_memSize >= slotSize) and (this->m_memPtr !=
nullptr)) {
53 const FwSizeType allocatedSlots = this->m_memSize / slotSize;
58 this->m_stateFileData =
static_cast<DpDstateFileEntry*
>(this->m_memPtr);
62 this->m_numDpSlots = 0;
66 for (
FwSizeType dir = 0; dir < numDirs; dir++) {
67 this->m_directories[dir] = directories[dir];
69 this->m_numDirectories = numDirs;
72 this->m_allocator = &allocator;
73 this->m_allocatorId = memId;
74 this->m_initialized =
true;
84 this->
configure(directoryArray, stateFile, memId, allocator);
87 void DpCatalog::resetCatalog() {
89 this->m_dpCatalog.
clear();
91 this->m_hasCurrentXmit =
false;
93 this->m_pendingFiles = 0;
94 this->m_pendingDpBytes = 0;
96 this->m_catalogBuilt =
false;
99 void DpCatalog::resetStateFileData() {
101 for (
FwSizeType slot = 0; slot < this->m_numDpSlots; slot++) {
102 this->m_stateFileData[slot].used =
false;
103 this->m_stateFileData[slot].visited =
false;
104 (void)
new (&this->m_stateFileData[slot].entry.record) DpRecord();
106 this->m_stateFileEntries = 0;
110 FW_ASSERT(this->m_stateFileData !=
nullptr);
113 if (this->m_stateFile.
length() == 0) {
137 stat = stateFile.
size(fileSize);
145 this->m_stateFileEntries = 0;
151 for (
FwSizeType record = 0; record < maxRecords; record++) {
154 stat = stateFile.
read(buffer, size);
169 if (size !=
sizeof(buffer)) {
171 static_cast<I32>(size));
177 Fw::SerializeStatus serStat = entryBuffer.setBuffLen(static_cast<Fw::Serializable::SizeType>(size));
180 entryBuffer.resetDeser();
187 DpStateEntry fileEntry{};
194 status = entryBuffer.deserializeTo(fileEntry.record);
203 if ((fileEntry.dir < 0) || (fileEntry.dir >= static_cast<FwIndexType>(this->m_numDirectories))) {
209 const FwSizeType slot = this->findStateFileSlot(fileEntry);
210 if (slot == this->m_stateFileEntries) {
211 if (this->m_stateFileEntries >= this->m_numDpSlots) {
216 this->m_stateFileEntries++;
218 this->m_stateFileData[slot].entry = fileEntry;
219 this->m_stateFileData[slot].used =
true;
220 this->m_stateFileData[slot].visited =
false;
229 void DpCatalog::getFileState(DpStateEntry& entry) {
230 FW_ASSERT(this->m_stateFileData !=
nullptr);
231 const FwSizeType line = this->findStateFileSlot(entry);
232 if (line < this->m_stateFileEntries) {
234 entry.record.set_priority(this->m_stateFileData[line].entry.record.get_priority());
236 entry.record.set_state(this->m_stateFileData[line].entry.record.get_state());
237 entry.record.set_blocks(this->m_stateFileData[line].entry.record.get_blocks());
239 this->m_stateFileData[line].visited =
true;
243 FwSizeType DpCatalog::findStateFileSlot(
const DpStateEntry& entry)
const {
244 FW_ASSERT(this->m_stateFileData !=
nullptr);
245 for (
FwSizeType line = 0; line < this->m_stateFileEntries; line++) {
246 if (this->m_stateFileData[line].entry.isSameProduct(entry)) {
250 return this->m_stateFileEntries;
254 FW_ASSERT(this->m_stateFileData !=
nullptr);
255 for (
FwSizeType line = 0; line < this->m_stateFileEntries; line++) {
256 if (this->m_stateFileData[line].entry.hasIdentity(
id, tSec, tSub)) {
260 return this->m_stateFileEntries;
263 DpCatalog_StateFileUpdateStatus DpCatalog::updateStateFileData(
const DpStateEntry& entry) {
264 FwSizeType slot = this->findStateFileSlot(entry);
265 if (slot == this->m_stateFileEntries) {
267 for (
FwSizeType line = 0; line < this->m_stateFileEntries; line++) {
268 if (not this->m_stateFileData[line].visited) {
274 if (slot == this->m_stateFileEntries) {
275 if (this->m_stateFileEntries >= this->m_numDpSlots) {
277 if (this->m_stateFile.
length() > 0) {
279 entry.record.get_tSub());
283 this->m_stateFileEntries++;
285 this->m_stateFileData[slot].entry = entry;
286 this->m_stateFileData[slot].used =
true;
287 this->m_stateFileData[slot].visited =
true;
291 DpCatalog_StateFileWriteStatus DpCatalog::pruneAndWriteStateFile() {
292 FW_ASSERT(this->m_stateFileData !=
nullptr);
316 for (
FwSizeType entry = 0; entry < this->m_numDpSlots; entry++) {
318 if ((this->m_stateFileData[entry].used) and (this->m_stateFileData[entry].visited)) {
320 entryBuffer.resetSer();
322 Fw::SerializeStatus serStat = entryBuffer.serializeFrom(this->m_stateFileData[entry].entry.dir);
325 serStat = entryBuffer.serializeFrom(this->m_stateFileData[entry].entry.record);
331 stat = stateFile.
write(buffer, size);
345 void DpCatalog::appendFileState(
const DpStateEntry& entry) {
346 FW_ASSERT(this->m_stateFileData !=
nullptr);
347 FW_ASSERT(entry.dir < static_cast<FwIndexType>(this->m_numDirectories), static_cast<FwAssertArgType>(entry.dir),
348 static_cast<FwAssertArgType>(this->m_numDirectories));
367 entryBuffer.resetSer();
372 serStat = entryBuffer.serializeFrom(entry.record);
377 stat = stateFile.
write(buffer, size);
390 if (not this->checkInit()) {
395 if (0 == this->m_numDpSlots) {
401 if (this->m_xmitInProgress) {
407 this->resetStateFileData();
413 this->resetStateFileData();
418 this->resetCatalog();
421 response = this->fillBinaryTree();
424 this->resetCatalog();
425 this->resetStateFileData();
432 (void)this->pruneAndWriteStateFile();
437 this->m_catalogBuilt =
true;
462 status =
dpDir.getFileCount(fileCount);
470 for (
FwSizeType entry = 0; entry < fileCount; entry++) {
471 status =
dpDir.read(fileName);
487 if ((-1 == loc) || (
static_cast<FwSizeType>(loc) + dpExtLength != fileNameLength)) {
492 if ((totalFiles + filesProcessed) == this->m_numDpSlots) {
498 fullFile.
format(
"%s/%s", this->m_directories[dir].toChar(), fileName.
toChar());
501 static_cast<Fw::StringFormatStatus::T>(formatStatus));
505 const ProcessFileStatus ret = processFile(fullFile, dir);
506 if (ret == ProcessFileStatus::QUIT) {
510 if (ret == ProcessFileStatus::SUCCESS) {
516 totalFiles += filesProcessed;
519 this->m_pendingFiles, this->m_pendingDpBytes);
523 if (totalFiles == this->m_numDpSlots) {
549 for (
FwSizeType dir = 0; dir < this->m_numDirectories; dir++) {
567 DpCatalog::ProcessFileStatus DpCatalog::processFile(
const Fw::String& fullFile,
FwSizeType dir) {
584 return ProcessFileStatus::FAILED;
589 return ProcessFileStatus::FAILED;
595 return ProcessFileStatus::FAILED;
601 stat = dpFile.
read(dpBuff, size);
605 return ProcessFileStatus::FAILED;
612 return ProcessFileStatus::FAILED;
628 return ProcessFileStatus::FAILED;
635 return ProcessFileStatus::FAILED;
640 if (dataSize != expectedDataSize) {
642 return ProcessFileStatus::FAILED;
651 static_cast<Fw::StringFormatStatus::T>(canonicalFormatStatus));
652 return ProcessFileStatus::FAILED;
654 if (canonicalFileName != fullFile) {
656 return ProcessFileStatus::FAILED;
660 DpStateEntry entry{};
662 entry.record.set_id(container.
getId());
663 entry.record.set_priority(container.
getPriority());
664 entry.record.set_state(container.
getState());
667 entry.record.set_size(static_cast<U64>(fileSize));
670 this->getFileState(entry);
675 return ProcessFileStatus::FAILED;
681 DpStateEntry existing{};
684 return ProcessFileStatus::FAILED;
689 if (this->m_dpCatalog.
getSize() >= this->m_numDpSlots) {
691 return ProcessFileStatus::QUIT;
696 bool inserted = this->insertEntry(entry);
699 return ProcessFileStatus::QUIT;
703 this->m_pendingFiles++;
704 this->m_pendingDpBytes += entry.record.get_size();
711 return ProcessFileStatus::SUCCESS;
717 I8 DpCatalog::DpStateEntry::compareEntries(
const DpStateEntry& left,
const DpStateEntry& right) {
719 if (left.record.get_priority() < right.record.get_priority()) {
721 }
else if (left.record.get_priority() > right.record.get_priority()) {
726 else if (left.record.get_tSec() < right.record.get_tSec()) {
728 }
else if (left.record.get_tSec() > right.record.get_tSec()) {
733 else if (left.record.get_tSub() < right.record.get_tSub()) {
735 }
else if (left.record.get_tSub() > right.record.get_tSub()) {
740 else if (left.record.get_id() < right.record.get_id()) {
742 }
else if (left.record.get_id() > right.record.get_id()) {
748 else if (left.dir < right.dir) {
750 }
else if (left.dir > right.dir) {
760 bool DpCatalog::DpStateEntry::hasIdentity(
FwDpIdType id, U32 tSec, U32 tSub)
const {
761 return (this->record.get_id() == id) && (this->record.get_tSec() == tSec) && (this->record.get_tSub() == tSub);
764 bool DpCatalog::DpStateEntry::isSameProduct(
const DpStateEntry& other)
const {
765 return (this->dir == other.dir) &&
766 this->hasIdentity(other.record.get_id(), other.record.get_tSec(), other.record.get_tSub());
769 bool DpCatalog::DpStateEntry::operator==(
const DpStateEntry& other)
const {
770 return compareEntries(*
this, other) == 0;
772 bool DpCatalog::DpStateEntry::operator!=(
const DpStateEntry& other)
const {
773 return compareEntries(*
this, other) != 0;
776 bool DpCatalog::DpStateEntry::operator>(
const DpStateEntry& other)
const {
777 return compareEntries(*
this, other) > 0;
779 bool DpCatalog::DpStateEntry::operator<(
const DpStateEntry& other)
const {
780 return compareEntries(*
this, other) < 0;
783 bool DpCatalog::insertEntry(DpStateEntry& entry) {
790 void DpCatalog::sendNextEntry() {
792 if (this->m_xmitInProgress !=
true) {
797 if (this->m_hasCurrentXmit) {
803 if (!this->findNextEntry(entry)) {
805 this->m_xmitInProgress =
false;
812 this->m_currentXmitEntry = entry;
813 this->m_hasCurrentXmit =
true;
818 entry.record.get_id(), entry.record.get_tSec(), entry.record.get_tSub());
821 static_cast<Fw::StringFormatStatus::T>(formatStatus));
828 entry.record.get_priority());
838 this->m_currXmitContext = resp.get_context();
842 "DpRecord stores priority as U32; a wider FwDpPriorityType would be truncated in the catalog");
844 bool DpCatalog::findNextEntry(DpStateEntry& entry) {
852 for (
FwSizeType index = 0; (index < size) && (iter != this->m_dpCatalog.
end()); index++, ++iter) {
854 if (priority < this->m_xmitStartPriority) {
857 if (priority > this->m_xmitEndPriority) {
867 bool DpCatalog::checkInit() {
868 if (not this->m_initialized) {
871 }
else if (0 == this->m_numDpSlots) {
883 if ((this->m_allocator !=
nullptr) and (this->m_memPtr !=
nullptr)) {
884 this->m_allocator->
deallocate(this->m_allocatorId, this->m_memPtr);
895 if (!this->m_hasCurrentXmit || resp.
get_context() != this->m_currXmitContext) {
908 this->m_pendingDpBytes -= this->m_currentXmitEntry.record.get_size();
909 this->m_pendingFiles--;
917 (void)this->updateStateFileData(this->m_currentXmitEntry);
918 this->appendFileState(this->m_currentXmitEntry);
920 this->m_xmitBytes += this->m_currentXmitEntry.record.get_size();
926 DpStateEntry catalogEntry{};
927 const DpCatalog_EntryLookupStatus found = this->findEntryByIdentity(this->m_currentXmitEntry, catalogEntry);
933 this->m_hasCurrentXmit =
false;
936 this->sendNextEntry();
939 void DpCatalog ::pingIn_handler(
FwIndexType portNum, U32 key) {
944 void DpCatalog ::addToCat_handler(
FwIndexType portNum,
949 if (not this->checkInit()) {
954 if (0 == this->m_numDpSlots) {
960 if (not this->m_catalogBuilt) {
971 FwSizeType dir = this->determineDirectory(fileName);
979 const ProcessFileStatus ret = processFile(fileName, dir);
981 if (ret == ProcessFileStatus::SUCCESS) {
982 this->resumeIfRemainActive();
989 void DpCatalog ::resumeIfRemainActive() {
995 if (!this->m_xmitInProgress && this->m_remainActive) {
996 DpStateEntry nextEntry{};
997 if (this->findNextEntry(nextEntry)) {
998 this->m_xmitInProgress =
true;
999 this->sendNextEntry();
1008 void DpCatalog ::BUILD_CATALOG_cmdHandler(
FwOpcodeType opCode, U32 cmdSeq) {
1013 void DpCatalog ::START_XMIT_CATALOG_cmdHandler(
FwOpcodeType opCode,
1016 bool remainActive) {
1017 this->startXmitCmd(opCode, cmdSeq, wait, remainActive, 0, std::numeric_limits<FwDpPriorityType>::max());
1020 void DpCatalog ::START_XMIT_CATALOG_WITH_PRIORITY_cmdHandler(
FwOpcodeType opCode,
1026 this->startXmitCmd(opCode, cmdSeq, wait, remainActive, startPriority, endPriority);
1035 if (startPriority > endPriority) {
1040 this->m_remainActive = remainActive;
1045 this->m_xmitCmdWait =
true;
1046 this->m_xmitOpCode = opCode;
1047 this->m_xmitCmdSeq = cmdSeq;
1050 Fw::CmdResponse resp = this->doCatalogXmit(startPriority, endPriority);
1054 this->m_xmitCmdWait =
false;
1055 this->m_xmitOpCode = 0;
1056 this->m_xmitCmdSeq = 0;
1064 FW_ASSERT(startPriority <= endPriority, static_cast<FwAssertArgType>(startPriority),
1065 static_cast<FwAssertArgType>(endPriority));
1067 if (not this->checkInit()) {
1072 if (0 == this->m_numDpSlots) {
1078 if (this->m_xmitInProgress) {
1084 if (not this->m_catalogBuilt) {
1091 if (!this->m_hasCurrentXmit) {
1092 this->m_xmitBytes = 0;
1094 this->m_xmitStartPriority = startPriority;
1095 this->m_xmitEndPriority = endPriority;
1097 this->m_xmitInProgress =
true;
1099 this->sendNextEntry();
1103 void DpCatalog ::STOP_XMIT_CATALOG_cmdHandler(
FwOpcodeType opCode, U32 cmdSeq) {
1104 if (not this->m_xmitInProgress) {
1112 this->m_xmitInProgress =
false;
1122 void DpCatalog ::CLEAR_CATALOG_cmdHandler(
FwOpcodeType opCode, U32 cmdSeq) {
1125 if (this->m_xmitInProgress) {
1129 this->resetCatalog();
1130 this->resetStateFileData();
1136 if (this->m_xmitCmdWait) {
1137 this->
cmdResponse_out(this->m_xmitOpCode, this->m_xmitCmdSeq, response);
1140 this->m_xmitCmdWait =
false;
1141 this->m_xmitOpCode = 0;
1142 this->m_xmitCmdSeq = 0;
1147 this->m_hasCurrentXmit =
false;
1148 this->m_xmitInProgress =
false;
1149 this->dispatchWaitedResponse(response);
1152 void DpCatalog ::SET_DP_PRIORITY_cmdHandler(
FwOpcodeType opCode,
1158 if (not this->checkInit()) {
1163 DpStateEntry entry{};
1170 const DpCatalog_PriorityChangeStatus status = this->setDpPriority(entry, priority);
1176 DpCatalog_PriorityChangeStatus DpCatalog ::setDpPriority(DpStateEntry& entry,
FwDpPriorityType priority) {
1178 const U32 tSec = entry.record.get_tSec();
1179 const U32 tSub = entry.record.get_tSub();
1181 if (priority == oldPriority) {
1192 entry.record.set_priority(priority);
1195 status = this->m_dpCatalog.
insert(entry);
1199 if (this->m_hasCurrentXmit && this->m_currentXmitEntry.isSameProduct(entry)) {
1200 this->m_currentXmitEntry.record.set_priority(priority);
1207 const DpCatalog_StateFileUpdateStatus updateStatus = this->updateStateFileData(entry);
1208 if (this->m_stateFile.
length() == 0) {
1214 const DpCatalog_StateFileWriteStatus writeStatus = this->pruneAndWriteStateFile();
1219 void DpCatalog ::DELETE_DP_cmdHandler(
FwOpcodeType opCode, U32 cmdSeq,
FwDpIdType id, U32 tSec, U32 tSub) {
1220 this->
cmdResponse_out(opCode, cmdSeq, this->doDeleteDp(
id, tSec, tSub));
1224 if (not this->checkInit()) {
1228 if (this->m_hasCurrentXmit && this->m_currentXmitEntry.hasIdentity(
id, tSec, tSub)) {
1234 DpStateEntry entry{};
1238 slot = this->findStateFileSlot(entry);
1240 slot = this->findStateFileSlotByIdentity(
id, tSec, tSub);
1241 if (slot != this->m_stateFileEntries) {
1242 entry = this->m_stateFileData[slot].entry;
1245 const bool inStateFile = (slot != this->m_stateFileEntries);
1246 if (not inCatalog && not inStateFile) {
1251 FW_ASSERT((entry.dir >= 0) && (entry.dir < static_cast<FwIndexType>(this->m_numDirectories)),
1252 static_cast<FwAssertArgType>(entry.dir), static_cast<FwAssertArgType>(this->m_numDirectories));
1257 entry.record.get_tSec(), entry.record.get_tSub());
1275 this->m_pendingDpBytes -= entry.record.get_size();
1276 this->m_pendingFiles--;
1280 this->m_stateFileEntries--;
1281 this->m_stateFileData[slot] = this->m_stateFileData[this->m_stateFileEntries];
1282 this->m_stateFileData[this->m_stateFileEntries].used =
false;
1283 this->m_stateFileData[this->m_stateFileEntries].visited =
false;
1289 if (inStateFile && (this->m_stateFile.
length() > 0)) {
1290 const DpCatalog_StateFileWriteStatus writeStatus = this->pruneAndWriteStateFile();
1298 void DpCatalog ::RETRANSMIT_DP_cmdHandler(
FwOpcodeType opCode, U32 cmdSeq,
FwDpIdType id, U32 tSec, U32 tSub) {
1299 this->
cmdResponse_out(opCode, cmdSeq, this->doRetransmitDp(
id, tSec, tSub));
1303 if (not this->checkInit()) {
1307 if (not this->m_catalogBuilt) {
1312 if (this->m_hasCurrentXmit && this->m_currentXmitEntry.hasIdentity(
id, tSec, tSub)) {
1316 DpStateEntry pendingEntry{};
1327 (index < this->m_numDirectories) && (index < static_cast<FwSizeType>(
DP_MAX_DIRECTORIES)); index++) {
1334 static_cast<Fw::StringFormatStatus::T>(formatStatus));
1338 fullFile = candidate;
1349 DpStateEntry product{};
1351 product.record.set_id(
id);
1352 product.record.set_tSec(tSec);
1353 product.record.set_tSub(tSub);
1358 const FwSizeType slot = this->findStateFileSlot(product);
1359 const bool hadRecord = (slot != this->m_stateFileEntries);
1360 DpDstateFileEntry savedSlot{};
1361 DpDstateFileEntry savedLast{};
1363 savedSlot = this->m_stateFileData[slot];
1364 savedLast = this->m_stateFileData[this->m_stateFileEntries - 1];
1365 this->m_stateFileEntries--;
1366 this->m_stateFileData[slot] = this->m_stateFileData[this->m_stateFileEntries];
1367 this->m_stateFileData[this->m_stateFileEntries].used =
false;
1368 this->m_stateFileData[this->m_stateFileEntries].visited =
false;
1370 const ProcessFileStatus ret = this->processFile(fullFile, dir);
1371 if (ret != ProcessFileStatus::SUCCESS) {
1373 this->m_stateFileData[this->m_stateFileEntries] = savedLast;
1374 this->m_stateFileData[slot] = savedSlot;
1375 this->m_stateFileEntries++;
1383 DpStateEntry catalogEntry{};
1384 const DpCatalog_EntryLookupStatus found = this->findEntryByIdentity(product, catalogEntry);
1394 (void)this->updateStateFileData(catalogEntry);
1396 if (this->m_stateFile.
length() > 0) {
1397 const DpCatalog_StateFileWriteStatus writeStatus = this->pruneAndWriteStateFile();
1403 this->resumeIfRemainActive();
1407 DpCatalog_EntryLookupStatus DpCatalog ::findEntryByIdentity(
const DpStateEntry& product, DpStateEntry& entry)
const {
1411 iter != this->m_dpCatalog.
end(); ++iter) {
1412 if ((*iter).isSameProduct(product)) {
1420 DpCatalog_EntryLookupStatus DpCatalog ::findProductEntry(
FwDpIdType id, U32 tSec, U32 tSub, DpStateEntry& entry)
const {
1424 iter != this->m_dpCatalog.
end(); ++iter) {
1425 if ((*iter).hasIdentity(
id, tSec, tSub)) {
Serialization/Deserialization operation was successful.
A data product Container.
void pingOut_out(FwIndexType portNum, U32 key) const
Invoke output port pingOut.
FwDpPriorityType getPriority() const
virtual void * allocate(const FwEnumStoreType identifier, FwSizeType &size, bool &recoverable, FwSizeType alignment=alignof(std::max_align_t))=0
void log_WARNING_HI_StateFileTruncated(const Fw::StringBase &file, I32 offset, I32 size) const
Log event StateFileTruncated.
void log_WARNING_HI_ComponentNoMemory()
FwIdType FwOpcodeType
The type of a command opcode.
void log_WARNING_HI_StateFileFull(FwDpIdType id, U32 tSec, U32 tSub) const
void log_WARNING_HI_DirectoryOpenError(const Fw::StringBase &loc, I32 stat) const
void log_WARNING_HI_DpRetransmitError(FwDpIdType id, U32 tSec, U32 tSub, const Svc::DpCatalog_RetransmitRejectReason &reason) const
void log_WARNING_LO_XmitPriorityRangeInvalid(FwDpPriorityType startPriority, FwDpPriorityType endPriority) const
PlatformSizeType FwSizeType
void log_WARNING_HI_DpFileXmitError(const Fw::StringBase &file, const Svc::SendFileStatus &stat)
Log event DpFileXmitError.
U32 FwDpPriorityType
The type of a data product priority.
void log_ACTIVITY_HI_NotLoaded(const Fw::StringBase &file) const
Log event NotLoaded.
Auto-generated base for DpCatalog component.
FwSignedSizeType substring_find(const CHAR *source_string, FwSizeType source_size, const CHAR *sub_string, FwSizeType sub_size)
find the first occurrence of a substring
void log_WARNING_HI_FileNameFormatError(const Fw::StringBase &file, const Fw::StringFormatStatus &status)
Wait or don't wait for something.
void log_WARNING_HI_DpInsertError(const Svc::DpRecord &dp)
static constexpr FwSizeType MIN_PACKET_SIZE
static const FwIndexType DP_MAX_DIRECTORIES
void log_WARNING_HI_StateFileDirectoryInvalid_ThrottleClear()
Reset throttle value for StateFileDirectoryInvalid.
The priority was changed and, if a state file is configured, recorded in it (DpPrioritySet reported) ...
Svc::SendFileResponse fileOut_out(FwIndexType portNum, const Fw::StringBase &sourceFileName, const Fw::StringBase &destFileName, U32 offset, U32 length) const
Invoke output port fileOut.
The catalog has not been built.
int8_t I8
8-bit signed integer
ConstIterator begin() const override
Status size(FwSizeType &size_result) override
get size of currently open file
Svc::SendFileStatus::T get_status() const
Get member status.
void configure(const Fw::ExternalArray< Fw::FileNameString > &directories, Fw::FileNameString &stateFile, FwEnumStoreType memId, Fw::MemAllocator &allocator)
Configure the DpCatalog.
No entry with the identity is in the catalog.
enum T e
The raw enum value.
Overwrite file when it exists and creation was requested.
PlatformSignedSizeType FwSignedSizeType
The data product is pending in the catalog and will be transmitted.
void log_ACTIVITY_HI_CatalogCleared(U32 pending, U64 pending_bytes) const
static bool exists(const char *path)
Return true if the path exists, false otherwise.
void log_WARNING_HI_StateFileOpenError(const Fw::StringBase &file, I32 stat) const
Log event StateFileOpenError.
Enum representing a command response.
#define DIRECTORY_DELIMITER
void log_ACTIVITY_HI_DpFileAdded(const Fw::StringBase &file) const
void log_WARNING_HI_DpFileRemoveError(const Fw::StringBase &file, I32 stat) const
The state file could not be opened (StateFileOpenError reported)
void setBuffer(const Buffer &buffer)
Set the packet buffer.
bool isValid() const
Check raw enum value for validity.
void log_ACTIVITY_HI_CatalogBuildComplete() const
void log_WARNING_LO_DpXmitInProgress()
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
SerializeStatus
forward declaration for string
U32 get_context() const
Get member context.
void log_WARNING_HI_FileCorruptedDataError(const Fw::StringBase &file, I32 stat) const
void log_WARNING_HI_FileOpenError(const Fw::StringBase &loc, I32 stat)
void log_ACTIVITY_LO_ProductComplete(const Fw::StringBase &file, U32 pending, U64 pending_bytes) const
Os::FileInterface::Status open(const char *path, Mode mode)
open file with supplied path and mode
void log_WARNING_HI_NoDpMemory() const
Log event NoDpMemory.
void log_WARNING_HI_FileSizeError(const Fw::StringBase &file, I32 stat)
The size of the serial representation.
The state file was rewritten.
void log_WARNING_HI_FileReadError(const Fw::StringBase &file, I32 stat)
void clear() override
Clear the set.
The state file data has no free slot.
void log_ACTIVITY_HI_DpFileSkipped(const Fw::StringBase &file) const
void log_ACTIVITY_HI_DpRetransmitScheduled(const Fw::StringBase &file, FwDpPriorityType priority) const
void log_ACTIVITY_LO_ProcessingDirectory(const Fw::StringBase &directory) const
void log_WARNING_HI_DpNotFound(FwDpIdType id, U32 tSec, U32 tSub) const
void log_DIAGNOSTIC_DpDuplicate(const Svc::DpRecord &dp)
File doesn't exist (for read)
void log_ACTIVITY_HI_ProcessingDirectoryComplete(const Fw::StringBase &loc, U32 total, U32 pending, U64 pending_bytes) const
void log_ACTIVITY_LO_SendingProduct(const Fw::StringBase &file, U32 bytes, U32 prio) const
void log_WARNING_LO_NoStateFileSpecified() const
Log event NoStateFileSpecified.
External serialize buffer with no copy semantics.
void log_WARNING_HI_DpInFlight(FwDpIdType id, U32 tSec, U32 tSub) const
void log_WARNING_LO_NoStateFile(const Fw::StringBase &file) const
Log event NoStateFile.
A record could not be written (StateFileWriteError reported)
void log_WARNING_HI_ComponentNotInitialized()
constexpr const char * DP_FILENAME_FORMAT
Fw::Time getTimeTag() const
The entry already had the priority (DpPriorityUnchanged reported)
FwSizeType getSize() const override
void log_ACTIVITY_HI_DpPriorityUnchanged(FwDpIdType id, U32 tSec, U32 tSub, FwDpPriorityType priority) const
An entry with the identity is in the catalog.
void close() override
close the file, if not opened then do nothing
Status write(const U8 *buffer, FwSizeType &size)
write data to this file from the supplied buffer bounded by size
Directory stream has no more files.
void log_WARNING_LO_XmitNotActive() const
Log event XmitNotActive.
const char * toChar() const
Convert to a C-style char*.
void log_ACTIVITY_HI_CatalogXmitCompleted(U64 bytes) const
void log_WARNING_HI_DpFileSendError(const Fw::StringBase &file, const Svc::SendFileStatus &stat)
Log event DpFileSendError.
void log_ACTIVITY_LO_ProcessingFile(const Fw::StringBase &file) const
static const FwIndexType DP_MAX_FILES
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
FwSizeType getSize() const
Command successfully executed.
void log_WARNING_HI_FileHdrError(const Fw::StringBase &file, const Svc::DpHdrField &field, U32 exp, U32 act)
void log_ACTIVITY_HI_CatalogXmitStopped(U64 bytes) const
uint8_t U8
8-bit unsigned integer
DpCatalog(const char *const compName)
DpCatalog constructor.
static Status getFileSize(const char *path, FwSizeType &size)
Get the size of the file (in bytes) at the specified path.
void log_WARNING_HI_StateFileDirectoryInvalid(const Fw::StringBase &file, I32 offset, FwIndexType dirIndex)
FwSignedSizeType substring_find_last(const CHAR *source_string, FwSizeType source_size, const CHAR *sub_string, FwSizeType sub_size)
find the last occurrence of a substring
Status read(U8 *buffer, FwSizeType &size)
read data from this file into supplied buffer bounded by size
Success remove(const T &element) override
Command had execution error.
FwIdType FwDpIdType
The type of a data product identifier.
void log_WARNING_HI_StateFileReadError(const Fw::StringBase &file, I32 stat, I32 offset) const
Log event StateFileReadError.
Fw::DpState getState() const
Get the product state.
void log_ACTIVITY_HI_DpDeleted(const Fw::StringBase &file, const Fw::DpState &state) const
void log_WARNING_HI_DirectoryNotManaged(const Fw::StringBase &file) const
Memory Allocation base class.
void log_WARNING_LO_DpRetransmitNameError(const Fw::StringBase &dir, const Fw::StringFormatStatus &status) const
void log_WARNING_HI_CatalogFull(const Fw::StringBase &dir)
Operation was successful.
No file of the data product exists in a managed directory.
The entry was recorded in its own slot or a reused stale slot.
void log_WARNING_HI_XmitUnbuiltCatalog() const
Log event XmitUnbuiltCatalog.
PlatformIndexType FwIndexType
void log_WARNING_HI_FileHdrDesError(const Fw::StringBase &file, I32 stat)
Operation was successful.
void log_ACTIVITY_HI_CatalogXmitRangeStarted(FwDpPriorityType startPriority, FwDpPriorityType endPriority) const
Send file response struct.
U32 asBigEndianU32() const
Convert bytes 0 through 3 of the hash data to a big-Endian U32 value.
void log_WARNING_LO_StaleFileDone(U32 context, const Svc::SendFileStatus &status)
A container class for holding a hash buffer.
Success::T checkHeaderHash(Utils::HashBuffer &storedHash, Utils::HashBuffer &computedHash) const
Check the header hash.
Success insert(const T &element) override
Command failed validation.
RateGroupDivider component implementation.
ConstIterator end() const override
virtual SizeType length() const
Get the length of the string.
The priority was changed but could not be recorded in the configured state file (error reported) ...
Fw::SerializeStatus deserializeHeader()
Operation was successful.
virtual void deallocate(const FwEnumStoreType identifier, void *ptr)=0
FwSizeType getDataSize() const
The data product is being transmitted.
Don't wait for something.
void log_ACTIVITY_HI_DpPrioritySet(FwDpIdType id, U32 tSec, U32 tSub, FwDpPriorityType oldPriority, FwDpPriorityType newPriority) const
void log_WARNING_HI_InvalidFileName(const Fw::StringBase &file, const Fw::StringBase &expected)
The data product file could not be cataloged (see the preceding file event)
static Status removeFile(const char *path)
Remove a file at the specified path.
void log_WARNING_HI_DpCatalogFull(const Svc::DpRecord &dp)
void log_WARNING_HI_StateFileWriteError(const Fw::StringBase &file, I32 stat) const
Log event StateFileWriteError.
PlatformAssertArgType FwAssertArgType
The type of arguments to assert functions.
FwSizeType string_length(const CHAR *source, FwSizeType buffer_size)
get the length of the source string
FormatStatus
status of string format calls
Open file for writing and truncates file if it exists, ie same flags as creat()