-
Notifications
You must be signed in to change notification settings - Fork 539
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
74 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,41 @@ | ||
#include "consumerstatetable.h" | ||
|
||
#include "consumerstatetable.h" | ||
#include <iostream> | ||
namespace swss | ||
{ | ||
ConsumerStateTable::ConsumerStateTable(DBConnector *db, const std::string &tableName, int popBatchSize, int pri) : | ||
ConsumerTableBase(db, tableName, popBatchSize, pri), | ||
TableName_KeySet(tableName) | ||
{ | ||
} | ||
|
||
void ConsumerStateTable::pops(std::deque<KeyOpFieldsValuesTuple> &vkco, const std::string& /*prefix*/) | ||
{ | ||
int count = 0; | ||
swss::Table table(getDbConnector(), getTableName()); | ||
std::vector<std::string> keys; | ||
table.getKeys(keys); | ||
for (const auto &key: keys) | ||
{ | ||
// pop with batch size | ||
if (count < POP_BATCH_SIZE) | ||
{ | ||
count++; | ||
} | ||
else | ||
{ | ||
break; | ||
} | ||
|
||
KeyOpFieldsValuesTuple kco; | ||
kfvKey(kco) = key; | ||
kfvOp(kco) = SET_COMMAND; | ||
if (!table.get(key, kfvFieldsValues(kco))) | ||
{ | ||
continue; | ||
} | ||
table.del(key); | ||
vkco.push_back(kco); | ||
} | ||
} | ||
} |