Skip to content

Commit

Permalink
Replace RedisClient with DBConnector (#660)
Browse files Browse the repository at this point in the history
  • Loading branch information
qiluo-msft authored Sep 17, 2020
1 parent 3026945 commit 6117cf5
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 7 deletions.
2 changes: 0 additions & 2 deletions lib/inc/RedisVidIndexGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,5 @@ namespace sairedis
std::shared_ptr<swss::DBConnector> m_dbConnector;

std::string m_vidCounterName;

std::shared_ptr<swss::RedisClient> m_redisClient;
};
}
4 changes: 1 addition & 3 deletions lib/src/RedisVidIndexGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ RedisVidIndexGenerator::RedisVidIndexGenerator(
m_vidCounterName(vidCounterName)
{
SWSS_LOG_ENTER();

m_redisClient = std::make_shared<swss::RedisClient>(m_dbConnector.get());
}

uint64_t RedisVidIndexGenerator::increment()
Expand All @@ -22,7 +20,7 @@ uint64_t RedisVidIndexGenerator::increment()
// this counter must be atomic since it can be independently accessed by
// sairedis and syncd

return m_redisClient->incr(m_vidCounterName); // "VIDCOUNTER"
return m_dbConnector->incr(m_vidCounterName); // "VIDCOUNTER"
}

void RedisVidIndexGenerator::reset()
Expand Down
2 changes: 0 additions & 2 deletions syncd/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ sai_status_t sai_bulk_remove_fdb_entry(
SWSS_LOG_THROW(format ": %s", ##__VA_ARGS__, sai_serialize_status(status).c_str());

using namespace saimeta;
static std::shared_ptr<swss::RedisClient> g_redisClient;
static std::shared_ptr<swss::DBConnector> g_db1;

static sai_next_hop_group_api_t test_next_hop_group_api;
Expand Down Expand Up @@ -89,7 +88,6 @@ void clearDB()

g_db1 = std::make_shared<swss::DBConnector>("ASIC_DB", 0, true);
swss::RedisReply r(g_db1.get(), "FLUSHALL", REDIS_REPLY_STATUS);
g_redisClient = std::make_shared<swss::RedisClient>(g_db1.get());

r.checkStatusOK();
}
Expand Down

0 comments on commit 6117cf5

Please sign in to comment.