Commit ea5cdd0b authored by Julien Muchembled's avatar Julien Muchembled

storage: revert addition of 'app' parameter in setup()

This is not a valid place to call app.newTask
parent c2cc0c11
......@@ -81,7 +81,7 @@ class Application(object):
# ready is True when operational and got all informations
self.ready = False
self.dm.setup(self, reset=config.getReset())
self.dm.setup(reset=config.getReset())
self.loadConfiguration()
# force node uuid from command line argument, for testing purpose only
......
......@@ -55,15 +55,15 @@ class DatabaseManager(object):
"""Called during instanciation, to process database parameter."""
pass
def setup(self, app, reset=0):
def setup(self, reset=0):
"""Set up a database, discarding existing data first if reset is True
"""
if reset:
self.erase()
self._uncommitted_data = defaultdict(int)
self._setup(app)
self._setup()
def _setup(self, app):
def _setup(self):
"""To be overriden by the backend to set up a database
It must recover self._uncommitted_data from temporary object table.
......
......@@ -139,7 +139,7 @@ class MySQLDatabaseManager(DatabaseManager):
self.query(
"DROP TABLE IF EXISTS config, pt, trans, obj, data, ttrans, tobj")
def _setup(self, app):
def _setup(self):
self._config.clear()
q = self.query
# The table "config" stores configuration parameters which affect the
......
......@@ -105,7 +105,7 @@ class SQLiteDatabaseManager(DatabaseManager):
for t in 'config', 'pt', 'trans', 'obj', 'data', 'ttrans', 'tobj':
self.query('DROP TABLE IF EXISTS ' + t)
def _setup(self, app):
def _setup(self):
self._config.clear()
q = self.query
# The table "config" stores configuration parameters which affect the
......
......@@ -53,7 +53,7 @@ class StorageDBTests(NeoUnitTestBase):
self._db = db = self.getDB(reset)
else:
if reset:
db.setup(None, reset)
db.setup(reset)
else:
try:
n = db.getNumPartitions()
......
......@@ -31,7 +31,7 @@ class StorageMySQSLdbTests(StorageDBTests):
# db manager
database = '%s@%s' % (NEO_SQL_USER, NEO_SQL_DATABASE)
db = MySQLDatabaseManager(database, 0)
db.setup(None, reset)
db.setup(reset)
return db
def test_MySQLDatabaseManagerInit(self):
......
......@@ -22,7 +22,7 @@ class StorageSQLiteTests(StorageDBTests):
def getDB(self, reset=0):
db = SQLiteDatabaseManager(':memory:', 0)
db.setup(None, reset)
db.setup(reset)
return db
del StorageDBTests
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment