-
Notifications
You must be signed in to change notification settings - Fork 1.4k
DataProduct Catalog Runtime Insertion #4083
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
DataProduct Catalog Runtime Insertion #4083
Conversation
189a5a8 to
90958a1
Compare
| this->log_WARNING_HI_NoDpMemory(); | ||
| return; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a check to see if the catalog has already been loaded. If it hasn't, just drop this call, since the new file will be noticed when the catalog is loaded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Willmac16 Where is this checked an dropped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe I added a check at one point for the dpTree pointer being non-null; however, I later removed that check since nodes could be added after tree completion (and pruning) with the remainActive arg. I'm adding a state file initialization check, since that is the primary thing a runtime added file needs from the catalog build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am now using a catalogBuilt flag since you can't guarantee the state file that is loaded will have any items.
|
Looks good so far! |
d15405c to
b21bc30
Compare
|
Do you have a recommendation for a cmake way to clean up the test artifacts consistently regardless of if the test passes? |
…d when TRANSMITTED is set * TRANSMITTED will be filtered by process file
7e89f01 to
01fd6b1
Compare
01fd6b1 to
9fd9624
Compare
| for (FwSizeType ii = 0; ii <= (source_size - sub_size); ii++) { | ||
| const FwSizeType source_index = (source_size - sub_size) - ii; | ||
|
|
||
| // if the current character matches | ||
| for (FwSizeType sub_index = 0; sub_index < sub_size; sub_index++) { | ||
| // Prevent read overrun | ||
| FW_ASSERT((source_index + sub_index) < source_size); | ||
| // if there is a mismatch, go to next character | ||
| if (source_string[source_index + sub_index] != sub_string[sub_index]) { | ||
| break; | ||
| } else if (sub_index == (sub_size - 1)) { | ||
| // if we matched all the way to the end of the substring | ||
| match_index = source_index; | ||
|
|
||
| // Ensure the result converts properly | ||
| FW_ASSERT(static_cast<FwSizeType>(static_cast<FwSignedSizeType>(match_index)) == match_index); | ||
|
|
||
| return static_cast<FwSignedSizeType>(match_index); | ||
| } | ||
| } | ||
| } |
Check warning
Code scanning / CodeQL
Unbounded loop Warning
| // Grab the directory string (up until the final slash) | ||
| // Could be found directly w/ a dirname func or regex | ||
| FwSignedSizeType loc = Fw::StringUtils::substring_find_last( | ||
| fullFile.toChar(), fullFile.length(), DIRECTORY_DELIMITER, |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| Fw::Buffer hdrBuff(dpBuff, sizeof(dpBuff)); // buffer for container header decoding | ||
| Fw::DpContainer container; // container object for extracting header fields | ||
|
|
||
| this->log_ACTIVITY_LO_ProcessingFile(fullFile); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
|
|
||
| // add entry to catalog. | ||
| DpStateEntry entry; | ||
| entry.dir = static_cast<FwIndexType>(dir); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| } | ||
|
|
||
| Fw::FileNameString addedFileName; | ||
| addedFileName.format(DP_FILENAME_FORMAT, this->m_directories[dir].toChar(), entry.record.get_id(), |
Check warning
Code scanning / CodeQL
Unchecked return value Warning
format
|
|
||
| // Check the catalog has been built | ||
| if (not this->m_catalogBuilt) { | ||
| this->log_ACTIVITY_HI_NotLoaded(fileName); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| } | ||
|
|
||
| // Both of these are grabbed from the header | ||
| (void)priority; |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
|
|
||
| // Both of these are grabbed from the header | ||
| (void)priority; | ||
| (void)size; |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
|
|
||
| // Since this is a runtime addition | ||
| // Check if file is in one of our directories | ||
| FwSizeType dir = this->determineDirectory(fileName); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| void DpCatalog ::START_XMIT_CATALOG_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Fw::Wait wait) { | ||
| void DpCatalog ::START_XMIT_CATALOG_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Fw::Wait wait, bool remainActive) { | ||
| Fw::CmdResponse resp = this->doCatalogXmit(); | ||
| this->m_remainActive = remainActive; |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| return -1; | ||
| } | ||
|
|
||
| FwSignedSizeType Fw::StringUtils::substring_find_last(const CHAR* source_string, |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| } | ||
|
|
||
| void DpCatalog ::START_XMIT_CATALOG_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Fw::Wait wait) { | ||
| void DpCatalog ::START_XMIT_CATALOG_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Fw::Wait wait, bool remainActive) { |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| m_xmitCmdSeq(0), | ||
| m_pendingFiles(0), | ||
| m_pendingDpBytes(0), | ||
| m_remainActive(false) {} |
Check notice
Code scanning / CodeQL
More than one statement per line Note
| } // end fillBinaryTree() | ||
|
|
||
| bool DpCatalog::insertEntry(DpStateEntry& entry) { | ||
| FwSizeType DpCatalog::determineDirectory(Fw::String fullFile) { |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| this->pingOut_out(0, key); | ||
| } | ||
|
|
||
| void DpCatalog ::addToCat_handler(FwIndexType portNum, |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| return DP_MAX_DIRECTORIES; | ||
| } | ||
|
|
||
| int DpCatalog::processFile(Fw::String fullFile, FwSizeType dir) { |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| } | ||
|
|
||
| void DpCatalog::deleteEntry(DpStateEntry& entry) {} | ||
| void DpCatalog::deallocateNode(DpBtreeNode* node) { |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| } | ||
|
|
||
| void DpCatalog::deleteEntry(DpStateEntry& entry) {} | ||
| void DpCatalog::deallocateNode(DpBtreeNode* node) { |
Check notice
Code scanning / CodeQL
Function too long Note
| return compareEntries(*this, other) < 0; | ||
| } | ||
|
|
||
| DpCatalog::DpBtreeNode* DpCatalog::insertEntry(DpStateEntry& entry) { |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| // ---------------------------------------------------------------------- | ||
| // DpStateEntry Comparison Ops | ||
| // ---------------------------------------------------------------------- | ||
| int DpCatalog::DpStateEntry::compareEntries(const DpStateEntry& left, const DpStateEntry& right) { |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| } | ||
|
|
||
| // ret > 0 := success | ||
| int ret = processFile(fileName, dir); |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
| return -1; | ||
| } | ||
|
|
||
| FwSignedSizeType Fw::StringUtils::substring_find_last(const CHAR* source_string, |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
|
|
||
| FwSignedSizeType Fw::StringUtils::substring_find_last(const CHAR* source_string, | ||
| FwSizeType source_size, | ||
| const CHAR* sub_string, |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
| // make sure we haven't exceeded the limit | ||
| if (this->m_numDpRecords > this->m_numDpSlots) { | ||
| this->log_WARNING_HI_DpCatalogFull(entry.record); | ||
| int ret = processFile(fullFile, dir); |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
| return DP_MAX_DIRECTORIES; | ||
| } | ||
|
|
||
| int DpCatalog::processFile(Fw::String fullFile, FwSizeType dir) { |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
| // ---------------------------------------------------------------------- | ||
| // DpStateEntry Comparison Ops | ||
| // ---------------------------------------------------------------------- | ||
| int DpCatalog::DpStateEntry::compareEntries(const DpStateEntry& left, const DpStateEntry& right) { |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
| } // end fillBinaryTree() | ||
|
|
||
| bool DpCatalog::insertEntry(DpStateEntry& entry) { | ||
| FwSizeType DpCatalog::determineDirectory(Fw::String fullFile) { |
Check warning
Code scanning / CppCheck
Parameter 'fullFile' is passed by value. It could be passed as a const reference which is usually faster and recommended in C++. Warning
| return DP_MAX_DIRECTORIES; | ||
| } | ||
|
|
||
| int DpCatalog::processFile(Fw::String fullFile, FwSizeType dir) { |
Check warning
Code scanning / CppCheck
Parameter 'fullFile' is passed by value. It could be passed as a const reference which is usually faster and recommended in C++. Warning
|
I am finally ready for re-review! |
Change Description
Modifies DpCatalog to allow for runtime insertion of data products onto the queue through the DpWriter notifier port
Rationale
Long running missions with the need for automated file downlink would benefit from simultaneous catalog transmission and construction.
Testing/Review Recommendations
Progress towards Draft Completion
processFilefrom addToCatalog portDISABLEDunit testNice to Haves
AI Usage (see policy)
N/A