Skip to content

Commit

Permalink
Refactor method to calc total records count
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitrii Petukhov <[email protected]>
  • Loading branch information
bbpetukhov committed Dec 2, 2024
1 parent 55fdc36 commit 079d26c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ bool SummaryProcessor::processMessageRecord(
BSLS_ANNOTATION_UNUSED bsls::Types::Uint64 recordIndex,
BSLS_ANNOTATION_UNUSED bsls::Types::Uint64 recordOffset)
{
handleAnyRecordType();
updateTotalRecordsCounter();

d_notConfirmedGuids.emplace(record.messageGUID());
d_foundMessagesCount++;
Expand All @@ -856,7 +856,7 @@ bool SummaryProcessor::processConfirmRecord(
BSLS_ANNOTATION_UNUSED bsls::Types::Uint64 recordIndex,
BSLS_ANNOTATION_UNUSED bsls::Types::Uint64 recordOffset)
{
handleAnyRecordType();
updateTotalRecordsCounter();

GuidsSet::iterator it = d_notConfirmedGuids.find(record.messageGUID());
if (it != d_notConfirmedGuids.end()) {
Expand All @@ -878,7 +878,7 @@ bool SummaryProcessor::processDeletionRecord(
BSLS_ANNOTATION_UNUSED bsls::Types::Uint64 recordIndex,
BSLS_ANNOTATION_UNUSED bsls::Types::Uint64 recordOffset)
{
handleAnyRecordType();
updateTotalRecordsCounter();

GuidsSet::iterator it = d_partiallyConfirmedGuids.find(
record.messageGUID());
Expand All @@ -899,7 +899,7 @@ bool SummaryProcessor::processQueueOpRecord(
BSLS_ANNOTATION_UNUSED bsls::Types::Uint64 recordIndex,
BSLS_ANNOTATION_UNUSED bsls::Types::Uint64 recordOffset)
{
handleAnyRecordType();
updateTotalRecordsCounter();

d_queueRecordsMap[record.queueKey()]++;
d_queueQueueOpRecordsMap[record.queueKey()]++;
Expand All @@ -912,7 +912,7 @@ bool SummaryProcessor::processJournalOpRecord(
BSLS_ANNOTATION_UNUSED bsls::Types::Uint64 recordIndex,
BSLS_ANNOTATION_UNUSED bsls::Types::Uint64 recordOffset)
{
handleAnyRecordType();
updateTotalRecordsCounter();

d_otherRecordsCounts[mqbs::RecordType::Enum::e_JOURNAL_OP]++;

Expand All @@ -921,7 +921,7 @@ bool SummaryProcessor::processJournalOpRecord(

bool SummaryProcessor::processOtherRecord(mqbs::RecordType::Enum recordType)
{
handleAnyRecordType();
updateTotalRecordsCounter();

d_otherRecordsCounts[recordType]++;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,11 @@ class SummaryProcessor : public SearchResult {
bslma::Allocator* d_allocator_p;
// Pointer to allocator that is used inside the class.

// PRIVATE MANIPULATORS

void updateTotalRecordsCounter();
// Update total recrods counter

public:
// CREATORS

Expand Down Expand Up @@ -708,15 +713,13 @@ class SummaryProcessor : public SearchResult {
void outputResult() BSLS_KEYWORD_OVERRIDE;
/// Output result of a search filtered by the specified GUIDs filter.
void outputResult(const GuidsList& guidFilter) BSLS_KEYWORD_OVERRIDE;

void handleAnyRecordType();
};

// =================================================
// INLINE FUNCTION DEFINITIONS
// =================================================

inline void SummaryProcessor::handleAnyRecordType()
inline void SummaryProcessor::updateTotalRecordsCounter()
{
d_totalRecordsCount++;
}
Expand Down

0 comments on commit 079d26c

Please sign in to comment.