Skip to content

Removed DB specific get api's from Selectable class #378

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

Merged
merged 3 commits into from
Sep 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions common/redisselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@ int RedisSelect::getFd()
{
return m_subscribe->getContext()->fd;
}
int RedisSelect::getDbConnectorId()
{
return m_subscribe->getDbId();
}

std::string RedisSelect::getDbNamespace()
const DBConnector* RedisSelect::getDbConnector() const
{
return m_subscribe->getNamespace();
return m_subscribe.get();
}

uint64_t RedisSelect::readData()
Expand Down
3 changes: 1 addition & 2 deletions common/redisselect.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ class RedisSelect : public Selectable
bool hasCachedData() override;
bool initializedWithData() override;
void updateAfterRead() override;
int getDbConnectorId() override;
std::string getDbNamespace() override;
const DBConnector* getDbConnector() const;

/* Create a new redisContext, SELECT DB and SUBSCRIBE */
void subscribe(DBConnector* db, const std::string &channelName);
Expand Down
10 changes: 0 additions & 10 deletions common/selectable.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,6 @@ class Selectable
return m_priority;
}

virtual int getDbConnectorId()
{
return 0;
}

virtual std::string getDbNamespace()
{
return std::string();
}

private:

friend class Select;
Expand Down
8 changes: 8 additions & 0 deletions pyext/swsscommon.i
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
%typemap(in, numinputs=0) swss::Selectable ** (swss::Selectable *temp) {
$1 = &temp;
}

%typemap(argout) swss::Selectable ** {
PyObject* temp = NULL;
if (!PyList_Check($result)) {
Expand All @@ -45,6 +46,13 @@
temp = SWIG_NewPointerObj(*$1, SWIGTYPE_p_swss__Selectable, 0);
SWIG_Python_AppendOutput($result, temp);
}

%inline %{
swss::RedisSelect *CastSelectableToRedisSelectObj(swss::Selectable *temp) {
return dynamic_cast<swss::RedisSelect *>(temp);
}
%}

%include "schema.h"
%include "dbconnector.h"
%include "selectable.h"
Expand Down