/
githubmirror
/
nbs
Обзор
Документация
Войти
/
githubmirror
/
nbs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
cloud/blockstore/libs/cells/impl/cell_impl.h
98 строк
3 KB
neihar
[Blockstore] move common RDMA parts to Storage (#5783)
21 апр 2026, 07:56
Не верифицирован
21 апр 2026, 07:56
0bd7b1f
Код
Авторство
О чём код?
#pragma once #include "bootstrap.h" #include "cell.h" #include "cell_host.h" #include <cloud/blockstore/libs/cells/iface/config.h> #include <cloud/blockstore/libs/cells/iface/host_endpoint.h> #include <cloud/blockstore/libs/client/client.h> #include <cloud/blockstore/libs/client/config.h> #include <cloud/blockstore/libs/client/multiclient_endpoint.h> #include <cloud/blockstore/libs/client_rdma/rdma_client.h> #include <cloud/blockstore/libs/server/config.h> #include <cloud/storage/core/libs/common/error.h> #include <cloud/storage/core/libs/diagnostics/monitoring.h> #include <cloud/storage/core/libs/rdma/impl/client.h> #include <cloud/storage/core/libs/rdma/impl/verbs.h> #include <util/generic/hash_set.h> #include <util/random/random.h> namespace NCloud::NBlockStore::NCells { //////////////////////////////////////////////////////////////////////////////// class TCell : public ICell , public std::enable_shared_from_this<TCell> { private: const TBootstrap Bootstrap; const TCellConfigPtr Config; TAdaptiveLock Lock; THashMap<TString, ICellHostPtr> ActiveHosts; THashMap<TString, ICellHostPtr> ActivatingHosts; THashSet<ICellHostPtr> DeactivatingHosts; TVector<TString> UnusedHosts; public: TCell(TBootstrap bootstrap, TCellConfigPtr config); [[nodiscard]] TResultOrError<TCellHostEndpoint> GetCellClient( const NClient::TClientAppConfigPtr& clientConfig) override { return PickHost(clientConfig); } [[nodiscard]] TCellHostEndpoints GetCellClients( const NClient::TClientAppConfigPtr& clientConfig) override { return PickHosts(Config->GetDescribeVolumeHostCount(), clientConfig); } [[nodiscard]] THashMap<TString, ICellHostPtr> GetActiveHosts() const { with_lock (Lock) { return ActiveHosts; } } [[nodiscard]] THashMap<TString, ICellHostPtr> GetActivatingHosts() const { with_lock (Lock) { return ActivatingHosts; } } [[nodiscard]] THashSet<ICellHostPtr> GetDeactivatingHosts() const { with_lock (Lock) { return DeactivatingHosts; } } void Start() override { AdjustActiveHostsToMinConnections(); } void Stop() override {} private: TResultOrError<TCellHostEndpoint> PickHost( const NClient::TClientAppConfigPtr& clientConfig); TCellHostEndpoints PickHosts( ui32 count, const NClient::TClientAppConfigPtr& clientConfig); void AdjustActiveHostsToMinConnections(); }; //////////////////////////////////////////////////////////////////////////////// } // namespace NCloud::NBlockStore::NCells