Change shards & catalogue db into single property
Refactoring the shards and catalogue mongo database methods into a single method because there's no need for these to access different logical databases. Change-Id: Ia75df73dcdb31e88473878f6c55abcf159f1aa44 Closes-Bug: #1246373
This commit is contained in:
parent
9c5bc99b5c
commit
1d47c602b0
@ -42,7 +42,7 @@ class CatalogueController(base.CatalogueBase):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(CatalogueController, self).__init__(*args, **kwargs)
|
||||
|
||||
self._col = self.driver.catalogue_database.catalogue
|
||||
self._col = self.driver.database.catalogue
|
||||
self._col.ensure_index(CATALOGUE_INDEX, unique=True)
|
||||
|
||||
@utils.raises_conn_error
|
||||
|
@ -126,25 +126,14 @@ class ControlDriver(storage.ControlDriverBase):
|
||||
return _connection(self.mongodb_conf)
|
||||
|
||||
@decorators.lazy_property(write=False)
|
||||
def shards_database(self):
|
||||
name = self.mongodb_conf.database + '_shards'
|
||||
def database(self):
|
||||
name = self.mongodb_conf.database
|
||||
return self.connection[name]
|
||||
|
||||
@property
|
||||
def shards_controller(self):
|
||||
return controllers.ShardsController(self)
|
||||
|
||||
@decorators.lazy_property(write=False)
|
||||
def catalogue_database(self):
|
||||
"""Database dedicated to the "queues" collection.
|
||||
|
||||
The queues collection is separated out into its own database
|
||||
to avoid writer lock contention with the messages collections.
|
||||
"""
|
||||
|
||||
name = self.mongodb_conf.database + '_catalogue'
|
||||
return self.connection[name]
|
||||
|
||||
@property
|
||||
def catalogue_controller(self):
|
||||
return controllers.CatalogueController(self)
|
||||
|
@ -48,7 +48,7 @@ class ShardsController(base.ShardsBase):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(ShardsController, self).__init__(*args, **kwargs)
|
||||
|
||||
self._col = self.driver.shards_database.shards
|
||||
self._col = self.driver.database.shards
|
||||
self._col.ensure_index(SHARDS_INDEX,
|
||||
background=True,
|
||||
name='shards_name',
|
||||
|
Loading…
x
Reference in New Issue
Block a user