Skip to content

Commit

Permalink
Make possible adding nested storages to MultipleAccessStorage in run-…
Browse files Browse the repository at this point in the history
…time.
  • Loading branch information
zlobober committed May 26, 2020
1 parent e9d348e commit e09bcb4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Access/MultipleAccessStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ const IAccessStorage & MultipleAccessStorage::getStorage(const UUID & id) const
return const_cast<MultipleAccessStorage *>(this)->getStorage(id);
}

void MultipleAccessStorage::addStorage(std::unique_ptr<Storage> nested_storage)
{
/// Note that IStorage::storage_name is not changed. It is ok as this method
/// is considered as a temporary solution allowing third-party Arcadia applications
/// using CH as a library to register their own access storages. Do not remove
/// this method without providing any alternative :)
nested_storages.emplace_back(std::move(nested_storage));
}

AccessEntityPtr MultipleAccessStorage::readImpl(const UUID & id) const
{
Expand Down
2 changes: 2 additions & 0 deletions src/Access/MultipleAccessStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class MultipleAccessStorage : public IAccessStorage
const Storage & getStorage(const UUID & id) const;
Storage & getStorage(const UUID & id);

void addStorage(std::unique_ptr<Storage> nested_storage);

Storage & getStorageByIndex(size_t i) { return *(nested_storages[i]); }
const Storage & getStorageByIndex(size_t i) const { return *(nested_storages[i]); }

Expand Down

0 comments on commit e09bcb4

Please sign in to comment.