Changeset View
Changeset View
Standalone View
Standalone View
swh/objstorage/multiplexer/multiplexer_objstorage.py
Show First 20 Lines • Show All 216 Lines • ▼ Show 20 Lines | class MultiplexerObjStorage(ObjStorage): | ||||
def __iter__(self): | def __iter__(self): | ||||
def obj_iterator(): | def obj_iterator(): | ||||
for storage in self.storages: | for storage in self.storages: | ||||
yield from storage | yield from storage | ||||
return obj_iterator() | return obj_iterator() | ||||
def add(self, content, obj_id=None, check_presence=True): | def add(self, content, obj_id, check_presence=True): | ||||
"""Add a new object to the object storage. | """Add a new object to the object storage. | ||||
If the adding step works in all the storages that accept this content, | If the adding step works in all the storages that accept this content, | ||||
this is a success. Otherwise, the full adding step is an error even if | this is a success. Otherwise, the full adding step is an error even if | ||||
it succeed in some of the storages. | it succeed in some of the storages. | ||||
Args: | Args: | ||||
content: content of the object to be added to the storage. | content: content of the object to be added to the storage. | ||||
▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines |