/
githubmirror
/
nbs
Обзор
Документация
Войти
/
githubmirror
/
nbs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
cloud/blockstore/apps/client/lib/ping.cpp
60 строк
1 KB
arigachnyy
move server_lightweight and client
13 окт 2023, 23:02
13 окт 2023, 23:02
aa7267b
Код
Авторство
О чём код?
#include "ping.h" #include <cloud/blockstore/libs/service/context.h> #include <cloud/blockstore/libs/service/service.h> #include <cloud/storage/core/libs/common/error.h> #include <cloud/storage/core/libs/diagnostics/logging.h> #include <library/cpp/protobuf/util/pb_io.h> namespace NCloud::NBlockStore::NClient { namespace { //////////////////////////////////////////////////////////////////////////////// class TPingCommand final : public TCommand { public: TPingCommand(IBlockStorePtr client) : TCommand(std::move(client)) {} protected: bool DoExecute() override { auto& output = GetOutputStream(); STORAGE_DEBUG("Sending Ping request"); auto result = WaitFor(ClientEndpoint->Ping( MakeIntrusive<TCallContext>(), std::make_shared<NProto::TPingRequest>() )); STORAGE_DEBUG("Received Ping response"); if (Proto) { SerializeToTextFormat(result, output); return true; } if (HasError(result)) { output << FormatError(result.GetError()) << Endl; return false; } output << "OK" << Endl; return true; } }; } // namespace //////////////////////////////////////////////////////////////////////////////// TCommandPtr NewPingCommand(IBlockStorePtr client) { return MakeIntrusive<TPingCommand>(std::move(client)); } } // namespace NCloud::NBlockStore::NClient