in common/configdb.cpp [436:478]
int ConfigDBPipeConnector_Native::_get_config(DBConnector& client, RedisTransactioner& pipe, map<string, map<string, map<string, string>>>& data, int cursor)
{
auto const& rc = client.scan(cursor, "*", REDIS_SCAN_BATCH_SIZE);
auto cur = rc.first;
auto const& keys = rc.second;
pipe.multi();
for (auto const& key: keys)
{
size_t pos = key.find(m_table_name_separator);
if (pos == string::npos)
{
continue;
}
RedisCommand shgetall;
shgetall.format("HGETALL %s", key.c_str());
pipe.enqueue(shgetall, REDIS_REPLY_ARRAY);
}
pipe.exec();
for (auto const& key: keys)
{
size_t pos = key.find(m_table_name_separator);
string table_name = key.substr(0, pos);
string row;
if (pos == string::npos)
{
continue;
}
row = key.substr(pos + 1);
auto reply = pipe.dequeueReply();
RedisReply r(reply);
auto& dataentry = data[table_name][row];
for (unsigned int i = 0; i < r.getChildCount(); i += 2)
{
string field = r.getChild(i)->str;
string value = r.getChild(i+1)->str;
dataentry.emplace(field, value);
}
}
return cur;
}