superuser: add storage replication config
This commit is contained in:
parent
c33ae0e896
commit
5000b1621c
15 changed files with 357 additions and 106 deletions
|
@ -16,6 +16,7 @@ def _location_aware(unbound_func):
|
|||
for preferred in self.preferred_locations:
|
||||
if preferred in locations:
|
||||
storage = self._storages[preferred]
|
||||
break
|
||||
|
||||
if not storage:
|
||||
storage = self._storages[random.sample(locations, 1)[0]]
|
||||
|
@ -26,10 +27,10 @@ def _location_aware(unbound_func):
|
|||
|
||||
|
||||
class DistributedStorage(StoragePaths):
|
||||
def __init__(self, storages, preferred_locations=[], default_locations=[]):
|
||||
def __init__(self, storages, preferred_locations=None, default_locations=None):
|
||||
self._storages = dict(storages)
|
||||
self.preferred_locations = list(preferred_locations)
|
||||
self.default_locations = list(default_locations)
|
||||
self.preferred_locations = list(preferred_locations or [])
|
||||
self.default_locations = list(default_locations or [])
|
||||
|
||||
@property
|
||||
def locations(self):
|
||||
|
|
Reference in a new issue