Loading src/context/database/__init__.py→src/common/database/__init__.py +0 −0 File moved. src/context/database/inmemory/InMemoryDatabase.py→src/common/database/inmemory/InMemoryDatabase.py +2 −1 Original line number Original line Diff line number Diff line import logging, json import logging, json LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__) FILEPATH = 'context/data/topo_nsfnet.json' FILEPATH = 'data/topo_nsfnet.json' class InMemoryDatabase: class InMemoryDatabase: def __init__(self, filepath=FILEPATH, **parameters): def __init__(self, filepath=FILEPATH, **parameters): Loading src/context/database/inmemory/__init__.py→src/common/database/inmemory/__init__.py +0 −0 File moved. src/context/database/redis/RedisDatabase.py→src/common/database/redis/RedisDatabase.py +3 −1 Original line number Original line Diff line number Diff line Loading @@ -10,6 +10,8 @@ MAX_RETRIES = 15 URL_TEMPLATE = 'redis://{host}:{port}/{dbid}' URL_TEMPLATE = 'redis://{host}:{port}/{dbid}' FILEPATH = 'data/topo_nsfnet.json' class RedisDatabase: class RedisDatabase: def __init__(self, **parameters): def __init__(self, **parameters): host = os.environ.get('REDISDB_SERVICE_HOST') host = os.environ.get('REDISDB_SERVICE_HOST') Loading @@ -32,7 +34,7 @@ class RedisDatabase: def get_topology(self): def get_topology(self): str_topology = self.handler.get('topology') str_topology = self.handler.get('topology') if(str_topology is None): if(str_topology is None): with open('context/data/topo_nsfnet.json', 'r') as f: with open(FILEPATH, 'r') as f: json_topology = json.loads(f.read()) json_topology = json.loads(f.read()) str_topology = json.dumps(json_topology) str_topology = json.dumps(json_topology) self.handler.setnx('topology', str_topology) self.handler.setnx('topology', str_topology) Loading src/context/database/redis/__init__.py→src/common/database/redis/__init__.py +0 −0 File moved. Loading
src/context/database/inmemory/InMemoryDatabase.py→src/common/database/inmemory/InMemoryDatabase.py +2 −1 Original line number Original line Diff line number Diff line import logging, json import logging, json LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__) FILEPATH = 'context/data/topo_nsfnet.json' FILEPATH = 'data/topo_nsfnet.json' class InMemoryDatabase: class InMemoryDatabase: def __init__(self, filepath=FILEPATH, **parameters): def __init__(self, filepath=FILEPATH, **parameters): Loading
src/context/database/redis/RedisDatabase.py→src/common/database/redis/RedisDatabase.py +3 −1 Original line number Original line Diff line number Diff line Loading @@ -10,6 +10,8 @@ MAX_RETRIES = 15 URL_TEMPLATE = 'redis://{host}:{port}/{dbid}' URL_TEMPLATE = 'redis://{host}:{port}/{dbid}' FILEPATH = 'data/topo_nsfnet.json' class RedisDatabase: class RedisDatabase: def __init__(self, **parameters): def __init__(self, **parameters): host = os.environ.get('REDISDB_SERVICE_HOST') host = os.environ.get('REDISDB_SERVICE_HOST') Loading @@ -32,7 +34,7 @@ class RedisDatabase: def get_topology(self): def get_topology(self): str_topology = self.handler.get('topology') str_topology = self.handler.get('topology') if(str_topology is None): if(str_topology is None): with open('context/data/topo_nsfnet.json', 'r') as f: with open(FILEPATH, 'r') as f: json_topology = json.loads(f.read()) json_topology = json.loads(f.read()) str_topology = json.dumps(json_topology) str_topology = json.dumps(json_topology) self.handler.setnx('topology', str_topology) self.handler.setnx('topology', str_topology) Loading