Skip to content

Commit

Permalink
remove SonicV2Connector which is not used any more (sonic-net#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
dzhangalibaba authored and qiluo-msft committed Oct 7, 2019
1 parent 4cee385 commit a377c1a
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/swsssdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def _load_connector_map():
_load_connector_map()

try:
from .dbconnector import SonicV1Connector, SonicV2Connector
from .dbconnector import SonicV2Connector
from .configdb import ConfigDBConnector
except (KeyError, ValueError):
msg = "Failed to database connector objects -- incorrect database config schema."
Expand Down
12 changes: 0 additions & 12 deletions src/swsssdk/config/database.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
{
"SonicV1Connector": {
"db_map": {
"IF_COUNTER_DB": {
"db": 0,
"separator": ":"
},
"LLDP_COUNTER_DB": {
"db": 1,
"separator": ":"
}
}
},
"SonicV2Connector": {
"db_map": {
"APPL_DB": {
Expand Down
19 changes: 0 additions & 19 deletions src/swsssdk/dbconnector.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,6 @@

# FIXME: Convert to metaclasses when Py2 support is removed. Metaclasses have unique interfaces to Python2/Python3.


class SonicV1Connector(DBInterface):
def __init__(self, **kwargs):
super(SonicV1Connector, self).__init__(**kwargs)

pass


SonicV1Connector.db_map = _connector_map[SonicV1Connector.__name__]['db_map']

if len(SonicV1Connector.db_map) != len({v['db'] for k, v in SonicV1Connector.db_map.items()}):
raise RuntimeError("Duplicate DB index detected in configuration.")


class SonicV2Connector(DBInterface):
def __init__(self, **kwargs):
super(SonicV2Connector, self).__init__(**kwargs)
Expand All @@ -32,8 +18,3 @@ def __init__(self, **kwargs):

if len(SonicV2Connector.db_map) != len({v['db'] for k, v in SonicV2Connector.db_map.items()}):
raise RuntimeError("Duplicate DB index detected in configuration.")


class DBConnector(SonicV1Connector):
logger.warning("DBConnector is DEPRECATED. 'swsssdk.dbconnector.DBConnector' -> 'swsssdk.SonicV1Connector'")
pass
4 changes: 2 additions & 2 deletions src/swsssdk/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ def blockable(f):
"blocking" decorator for Redis accessor methods. Wrapped functions that specify kwarg 'blocking'
will wait for the specified accessor to return with data.::
class SonicV1Connector:
class SonicV2Connector:
@blockable
def keys(self, db_name):
# ...
# call with:
db = SonicV1Connector()
db = SonicV2Connector()
# ...
db.keys('DATABASE', blocking=True)
Expand Down
2 changes: 0 additions & 2 deletions test/test_moduleLoad.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ def test__load_connector_map(self):

def test__db_map_attributes(self):
import swsssdk
db1 = swsssdk.SonicV1Connector()
self.assertTrue(all(hasattr(db1, db_name) for db_name in db1.db_map))
db2 = swsssdk.SonicV2Connector()
self.assertTrue(all(hasattr(db2, db_name) for db_name in db2.db_map))
pass

0 comments on commit a377c1a

Please sign in to comment.