diff --git a/services/backup/docker-server/contents/server/src/grpc-client/ServiceBlobClient.h b/services/backup/docker-server/contents/server/src/grpc-client/ServiceBlobClient.h index 0d7998552..b53d7f93a 100644 --- a/services/backup/docker-server/contents/server/src/grpc-client/ServiceBlobClient.h +++ b/services/backup/docker-server/contents/server/src/grpc-client/ServiceBlobClient.h @@ -1,42 +1,52 @@ #pragma once +#include "BlobGetClientReactor.h" #include "BlobPutClientReactor.h" #include "../_generated/blob.grpc.pb.h" #include "../_generated/blob.pb.h" #include #include #include #include namespace comm { namespace network { class ServiceBlobClient { std::unique_ptr stub; public: ServiceBlobClient() { // todo handle different types of connection(e.g. load balancer) std::string targetStr = "blob-server:50051"; std::shared_ptr channel = grpc::CreateChannel(targetStr, grpc::InsecureChannelCredentials()); this->stub = blob::BlobService::NewStub(channel); } void put(std::shared_ptr putReactor) { if (putReactor == nullptr) { throw std::runtime_error( "put reactor is being used but has not been initialized"); } this->stub->async()->Put(&putReactor->context, &(*putReactor)); putReactor->nextWrite(); } - // void get(const std::string &holder); + + void get(std::shared_ptr getReactor) { + if (getReactor == nullptr) { + throw std::runtime_error( + "get reactor is being used but has not been initialized"); + } + this->stub->async()->Get( + &getReactor->context, &getReactor->request, &(*getReactor)); + getReactor->start(); + } // void remove(const std::string &holder); }; } // namespace network } // namespace comm