diff --git a/native/cpp/CommonCpp/grpc/_generated/backup.grpc.pb.h b/native/cpp/CommonCpp/grpc/_generated/backup.grpc.pb.h --- a/native/cpp/CommonCpp/grpc/_generated/backup.grpc.pb.h +++ b/native/cpp/CommonCpp/grpc/_generated/backup.grpc.pb.h @@ -44,14 +44,14 @@ std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< ::backup::CreateNewBackupRequest, ::backup::CreateNewBackupResponse>> PrepareAsyncCreateNewBackup(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) { return std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< ::backup::CreateNewBackupRequest, ::backup::CreateNewBackupResponse>>(PrepareAsyncCreateNewBackupRaw(context, cq)); } - std::unique_ptr< ::grpc::ClientWriterInterface< ::backup::SendLogRequest>> SendLog(::grpc::ClientContext* context, ::google::protobuf::Empty* response) { - return std::unique_ptr< ::grpc::ClientWriterInterface< ::backup::SendLogRequest>>(SendLogRaw(context, response)); + std::unique_ptr< ::grpc::ClientReaderWriterInterface< ::backup::SendLogRequest, ::google::protobuf::Empty>> SendLog(::grpc::ClientContext* context) { + return std::unique_ptr< ::grpc::ClientReaderWriterInterface< ::backup::SendLogRequest, ::google::protobuf::Empty>>(SendLogRaw(context)); } - std::unique_ptr< ::grpc::ClientAsyncWriterInterface< ::backup::SendLogRequest>> AsyncSendLog(::grpc::ClientContext* context, ::google::protobuf::Empty* response, ::grpc::CompletionQueue* cq, void* tag) { - return std::unique_ptr< ::grpc::ClientAsyncWriterInterface< ::backup::SendLogRequest>>(AsyncSendLogRaw(context, response, cq, tag)); + std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< ::backup::SendLogRequest, ::google::protobuf::Empty>> AsyncSendLog(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) { + return std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< ::backup::SendLogRequest, ::google::protobuf::Empty>>(AsyncSendLogRaw(context, cq, tag)); } - std::unique_ptr< ::grpc::ClientAsyncWriterInterface< ::backup::SendLogRequest>> PrepareAsyncSendLog(::grpc::ClientContext* context, ::google::protobuf::Empty* response, ::grpc::CompletionQueue* cq) { - return std::unique_ptr< ::grpc::ClientAsyncWriterInterface< ::backup::SendLogRequest>>(PrepareAsyncSendLogRaw(context, response, cq)); + std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< ::backup::SendLogRequest, ::google::protobuf::Empty>> PrepareAsyncSendLog(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< ::backup::SendLogRequest, ::google::protobuf::Empty>>(PrepareAsyncSendLogRaw(context, cq)); } std::unique_ptr< ::grpc::ClientReaderWriterInterface< ::backup::RecoverBackupKeyRequest, ::backup::RecoverBackupKeyResponse>> RecoverBackupKey(::grpc::ClientContext* context) { return std::unique_ptr< ::grpc::ClientReaderWriterInterface< ::backup::RecoverBackupKeyRequest, ::backup::RecoverBackupKeyResponse>>(RecoverBackupKeyRaw(context)); @@ -75,7 +75,7 @@ public: virtual ~async_interface() {} virtual void CreateNewBackup(::grpc::ClientContext* context, ::grpc::ClientBidiReactor< ::backup::CreateNewBackupRequest,::backup::CreateNewBackupResponse>* reactor) = 0; - virtual void SendLog(::grpc::ClientContext* context, ::google::protobuf::Empty* response, ::grpc::ClientWriteReactor< ::backup::SendLogRequest>* reactor) = 0; + virtual void SendLog(::grpc::ClientContext* context, ::grpc::ClientBidiReactor< ::backup::SendLogRequest,::google::protobuf::Empty>* reactor) = 0; virtual void RecoverBackupKey(::grpc::ClientContext* context, ::grpc::ClientBidiReactor< ::backup::RecoverBackupKeyRequest,::backup::RecoverBackupKeyResponse>* reactor) = 0; virtual void PullBackup(::grpc::ClientContext* context, ::grpc::ClientBidiReactor< ::backup::PullBackupRequest,::backup::PullBackupResponse>* reactor) = 0; }; @@ -86,9 +86,9 @@ virtual ::grpc::ClientReaderWriterInterface< ::backup::CreateNewBackupRequest, ::backup::CreateNewBackupResponse>* CreateNewBackupRaw(::grpc::ClientContext* context) = 0; virtual ::grpc::ClientAsyncReaderWriterInterface< ::backup::CreateNewBackupRequest, ::backup::CreateNewBackupResponse>* AsyncCreateNewBackupRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) = 0; virtual ::grpc::ClientAsyncReaderWriterInterface< ::backup::CreateNewBackupRequest, ::backup::CreateNewBackupResponse>* PrepareAsyncCreateNewBackupRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) = 0; - virtual ::grpc::ClientWriterInterface< ::backup::SendLogRequest>* SendLogRaw(::grpc::ClientContext* context, ::google::protobuf::Empty* response) = 0; - virtual ::grpc::ClientAsyncWriterInterface< ::backup::SendLogRequest>* AsyncSendLogRaw(::grpc::ClientContext* context, ::google::protobuf::Empty* response, ::grpc::CompletionQueue* cq, void* tag) = 0; - virtual ::grpc::ClientAsyncWriterInterface< ::backup::SendLogRequest>* PrepareAsyncSendLogRaw(::grpc::ClientContext* context, ::google::protobuf::Empty* response, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientReaderWriterInterface< ::backup::SendLogRequest, ::google::protobuf::Empty>* SendLogRaw(::grpc::ClientContext* context) = 0; + virtual ::grpc::ClientAsyncReaderWriterInterface< ::backup::SendLogRequest, ::google::protobuf::Empty>* AsyncSendLogRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) = 0; + virtual ::grpc::ClientAsyncReaderWriterInterface< ::backup::SendLogRequest, ::google::protobuf::Empty>* PrepareAsyncSendLogRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientReaderWriterInterface< ::backup::RecoverBackupKeyRequest, ::backup::RecoverBackupKeyResponse>* RecoverBackupKeyRaw(::grpc::ClientContext* context) = 0; virtual ::grpc::ClientAsyncReaderWriterInterface< ::backup::RecoverBackupKeyRequest, ::backup::RecoverBackupKeyResponse>* AsyncRecoverBackupKeyRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) = 0; virtual ::grpc::ClientAsyncReaderWriterInterface< ::backup::RecoverBackupKeyRequest, ::backup::RecoverBackupKeyResponse>* PrepareAsyncRecoverBackupKeyRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) = 0; @@ -108,14 +108,14 @@ std::unique_ptr< ::grpc::ClientAsyncReaderWriter< ::backup::CreateNewBackupRequest, ::backup::CreateNewBackupResponse>> PrepareAsyncCreateNewBackup(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) { return std::unique_ptr< ::grpc::ClientAsyncReaderWriter< ::backup::CreateNewBackupRequest, ::backup::CreateNewBackupResponse>>(PrepareAsyncCreateNewBackupRaw(context, cq)); } - std::unique_ptr< ::grpc::ClientWriter< ::backup::SendLogRequest>> SendLog(::grpc::ClientContext* context, ::google::protobuf::Empty* response) { - return std::unique_ptr< ::grpc::ClientWriter< ::backup::SendLogRequest>>(SendLogRaw(context, response)); + std::unique_ptr< ::grpc::ClientReaderWriter< ::backup::SendLogRequest, ::google::protobuf::Empty>> SendLog(::grpc::ClientContext* context) { + return std::unique_ptr< ::grpc::ClientReaderWriter< ::backup::SendLogRequest, ::google::protobuf::Empty>>(SendLogRaw(context)); } - std::unique_ptr< ::grpc::ClientAsyncWriter< ::backup::SendLogRequest>> AsyncSendLog(::grpc::ClientContext* context, ::google::protobuf::Empty* response, ::grpc::CompletionQueue* cq, void* tag) { - return std::unique_ptr< ::grpc::ClientAsyncWriter< ::backup::SendLogRequest>>(AsyncSendLogRaw(context, response, cq, tag)); + std::unique_ptr< ::grpc::ClientAsyncReaderWriter< ::backup::SendLogRequest, ::google::protobuf::Empty>> AsyncSendLog(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) { + return std::unique_ptr< ::grpc::ClientAsyncReaderWriter< ::backup::SendLogRequest, ::google::protobuf::Empty>>(AsyncSendLogRaw(context, cq, tag)); } - std::unique_ptr< ::grpc::ClientAsyncWriter< ::backup::SendLogRequest>> PrepareAsyncSendLog(::grpc::ClientContext* context, ::google::protobuf::Empty* response, ::grpc::CompletionQueue* cq) { - return std::unique_ptr< ::grpc::ClientAsyncWriter< ::backup::SendLogRequest>>(PrepareAsyncSendLogRaw(context, response, cq)); + std::unique_ptr< ::grpc::ClientAsyncReaderWriter< ::backup::SendLogRequest, ::google::protobuf::Empty>> PrepareAsyncSendLog(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncReaderWriter< ::backup::SendLogRequest, ::google::protobuf::Empty>>(PrepareAsyncSendLogRaw(context, cq)); } std::unique_ptr< ::grpc::ClientReaderWriter< ::backup::RecoverBackupKeyRequest, ::backup::RecoverBackupKeyResponse>> RecoverBackupKey(::grpc::ClientContext* context) { return std::unique_ptr< ::grpc::ClientReaderWriter< ::backup::RecoverBackupKeyRequest, ::backup::RecoverBackupKeyResponse>>(RecoverBackupKeyRaw(context)); @@ -139,7 +139,7 @@ public StubInterface::async_interface { public: void CreateNewBackup(::grpc::ClientContext* context, ::grpc::ClientBidiReactor< ::backup::CreateNewBackupRequest,::backup::CreateNewBackupResponse>* reactor) override; - void SendLog(::grpc::ClientContext* context, ::google::protobuf::Empty* response, ::grpc::ClientWriteReactor< ::backup::SendLogRequest>* reactor) override; + void SendLog(::grpc::ClientContext* context, ::grpc::ClientBidiReactor< ::backup::SendLogRequest,::google::protobuf::Empty>* reactor) override; void RecoverBackupKey(::grpc::ClientContext* context, ::grpc::ClientBidiReactor< ::backup::RecoverBackupKeyRequest,::backup::RecoverBackupKeyResponse>* reactor) override; void PullBackup(::grpc::ClientContext* context, ::grpc::ClientBidiReactor< ::backup::PullBackupRequest,::backup::PullBackupResponse>* reactor) override; private: @@ -156,9 +156,9 @@ ::grpc::ClientReaderWriter< ::backup::CreateNewBackupRequest, ::backup::CreateNewBackupResponse>* CreateNewBackupRaw(::grpc::ClientContext* context) override; ::grpc::ClientAsyncReaderWriter< ::backup::CreateNewBackupRequest, ::backup::CreateNewBackupResponse>* AsyncCreateNewBackupRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) override; ::grpc::ClientAsyncReaderWriter< ::backup::CreateNewBackupRequest, ::backup::CreateNewBackupResponse>* PrepareAsyncCreateNewBackupRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) override; - ::grpc::ClientWriter< ::backup::SendLogRequest>* SendLogRaw(::grpc::ClientContext* context, ::google::protobuf::Empty* response) override; - ::grpc::ClientAsyncWriter< ::backup::SendLogRequest>* AsyncSendLogRaw(::grpc::ClientContext* context, ::google::protobuf::Empty* response, ::grpc::CompletionQueue* cq, void* tag) override; - ::grpc::ClientAsyncWriter< ::backup::SendLogRequest>* PrepareAsyncSendLogRaw(::grpc::ClientContext* context, ::google::protobuf::Empty* response, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientReaderWriter< ::backup::SendLogRequest, ::google::protobuf::Empty>* SendLogRaw(::grpc::ClientContext* context) override; + ::grpc::ClientAsyncReaderWriter< ::backup::SendLogRequest, ::google::protobuf::Empty>* AsyncSendLogRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) override; + ::grpc::ClientAsyncReaderWriter< ::backup::SendLogRequest, ::google::protobuf::Empty>* PrepareAsyncSendLogRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) override; ::grpc::ClientReaderWriter< ::backup::RecoverBackupKeyRequest, ::backup::RecoverBackupKeyResponse>* RecoverBackupKeyRaw(::grpc::ClientContext* context) override; ::grpc::ClientAsyncReaderWriter< ::backup::RecoverBackupKeyRequest, ::backup::RecoverBackupKeyResponse>* AsyncRecoverBackupKeyRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) override; ::grpc::ClientAsyncReaderWriter< ::backup::RecoverBackupKeyRequest, ::backup::RecoverBackupKeyResponse>* PrepareAsyncRecoverBackupKeyRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) override; @@ -177,7 +177,7 @@ Service(); virtual ~Service(); virtual ::grpc::Status CreateNewBackup(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::backup::CreateNewBackupResponse, ::backup::CreateNewBackupRequest>* stream); - virtual ::grpc::Status SendLog(::grpc::ServerContext* context, ::grpc::ServerReader< ::backup::SendLogRequest>* reader, ::google::protobuf::Empty* response); + virtual ::grpc::Status SendLog(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::google::protobuf::Empty, ::backup::SendLogRequest>* stream); virtual ::grpc::Status RecoverBackupKey(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::backup::RecoverBackupKeyResponse, ::backup::RecoverBackupKeyRequest>* stream); virtual ::grpc::Status PullBackup(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::backup::PullBackupResponse, ::backup::PullBackupRequest>* stream); }; @@ -213,12 +213,12 @@ BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status SendLog(::grpc::ServerContext* /*context*/, ::grpc::ServerReader< ::backup::SendLogRequest>* /*reader*/, ::google::protobuf::Empty* /*response*/) override { + ::grpc::Status SendLog(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter< ::google::protobuf::Empty, ::backup::SendLogRequest>* /*stream*/) override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } - void RequestSendLog(::grpc::ServerContext* context, ::grpc::ServerAsyncReader< ::google::protobuf::Empty, ::backup::SendLogRequest>* reader, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { - ::grpc::Service::RequestAsyncClientStreaming(1, context, reader, new_call_cq, notification_cq, tag); + void RequestSendLog(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter< ::google::protobuf::Empty, ::backup::SendLogRequest>* stream, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncBidiStreaming(1, context, stream, new_call_cq, notification_cq, tag); } }; template @@ -292,20 +292,21 @@ public: WithCallbackMethod_SendLog() { ::grpc::Service::MarkMethodCallback(1, - new ::grpc::internal::CallbackClientStreamingHandler< ::backup::SendLogRequest, ::google::protobuf::Empty>( + new ::grpc::internal::CallbackBidiHandler< ::backup::SendLogRequest, ::google::protobuf::Empty>( [this]( - ::grpc::CallbackServerContext* context, ::google::protobuf::Empty* response) { return this->SendLog(context, response); })); + ::grpc::CallbackServerContext* context) { return this->SendLog(context); })); } ~WithCallbackMethod_SendLog() override { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status SendLog(::grpc::ServerContext* /*context*/, ::grpc::ServerReader< ::backup::SendLogRequest>* /*reader*/, ::google::protobuf::Empty* /*response*/) override { + ::grpc::Status SendLog(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter< ::google::protobuf::Empty, ::backup::SendLogRequest>* /*stream*/) override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } - virtual ::grpc::ServerReadReactor< ::backup::SendLogRequest>* SendLog( - ::grpc::CallbackServerContext* /*context*/, ::google::protobuf::Empty* /*response*/) { return nullptr; } + virtual ::grpc::ServerBidiReactor< ::backup::SendLogRequest, ::google::protobuf::Empty>* SendLog( + ::grpc::CallbackServerContext* /*context*/) + { return nullptr; } }; template class WithCallbackMethod_RecoverBackupKey : public BaseClass { @@ -384,7 +385,7 @@ BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status SendLog(::grpc::ServerContext* /*context*/, ::grpc::ServerReader< ::backup::SendLogRequest>* /*reader*/, ::google::protobuf::Empty* /*response*/) override { + ::grpc::Status SendLog(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter< ::google::protobuf::Empty, ::backup::SendLogRequest>* /*stream*/) override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } @@ -455,12 +456,12 @@ BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status SendLog(::grpc::ServerContext* /*context*/, ::grpc::ServerReader< ::backup::SendLogRequest>* /*reader*/, ::google::protobuf::Empty* /*response*/) override { + ::grpc::Status SendLog(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter< ::google::protobuf::Empty, ::backup::SendLogRequest>* /*stream*/) override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } - void RequestSendLog(::grpc::ServerContext* context, ::grpc::ServerAsyncReader< ::grpc::ByteBuffer, ::grpc::ByteBuffer>* reader, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { - ::grpc::Service::RequestAsyncClientStreaming(1, context, reader, new_call_cq, notification_cq, tag); + void RequestSendLog(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter< ::grpc::ByteBuffer, ::grpc::ByteBuffer>* stream, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncBidiStreaming(1, context, stream, new_call_cq, notification_cq, tag); } }; template @@ -533,20 +534,21 @@ public: WithRawCallbackMethod_SendLog() { ::grpc::Service::MarkMethodRawCallback(1, - new ::grpc::internal::CallbackClientStreamingHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + new ::grpc::internal::CallbackBidiHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( [this]( - ::grpc::CallbackServerContext* context, ::grpc::ByteBuffer* response) { return this->SendLog(context, response); })); + ::grpc::CallbackServerContext* context) { return this->SendLog(context); })); } ~WithRawCallbackMethod_SendLog() override { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status SendLog(::grpc::ServerContext* /*context*/, ::grpc::ServerReader< ::backup::SendLogRequest>* /*reader*/, ::google::protobuf::Empty* /*response*/) override { + ::grpc::Status SendLog(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter< ::google::protobuf::Empty, ::backup::SendLogRequest>* /*stream*/) override { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } - virtual ::grpc::ServerReadReactor< ::grpc::ByteBuffer>* SendLog( - ::grpc::CallbackServerContext* /*context*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + virtual ::grpc::ServerBidiReactor< ::grpc::ByteBuffer, ::grpc::ByteBuffer>* SendLog( + ::grpc::CallbackServerContext* /*context*/) + { return nullptr; } }; template class WithRawCallbackMethod_RecoverBackupKey : public BaseClass { diff --git a/native/cpp/CommonCpp/grpc/_generated/backup.grpc.pb.cc b/native/cpp/CommonCpp/grpc/_generated/backup.grpc.pb.cc --- a/native/cpp/CommonCpp/grpc/_generated/backup.grpc.pb.cc +++ b/native/cpp/CommonCpp/grpc/_generated/backup.grpc.pb.cc @@ -36,7 +36,7 @@ BackupService::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) : channel_(channel), rpcmethod_CreateNewBackup_(BackupService_method_names[0], options.suffix_for_stats(),::grpc::internal::RpcMethod::BIDI_STREAMING, channel) - , rpcmethod_SendLog_(BackupService_method_names[1], options.suffix_for_stats(),::grpc::internal::RpcMethod::CLIENT_STREAMING, channel) + , rpcmethod_SendLog_(BackupService_method_names[1], options.suffix_for_stats(),::grpc::internal::RpcMethod::BIDI_STREAMING, channel) , rpcmethod_RecoverBackupKey_(BackupService_method_names[2], options.suffix_for_stats(),::grpc::internal::RpcMethod::BIDI_STREAMING, channel) , rpcmethod_PullBackup_(BackupService_method_names[3], options.suffix_for_stats(),::grpc::internal::RpcMethod::BIDI_STREAMING, channel) {} @@ -57,20 +57,20 @@ return ::grpc::internal::ClientAsyncReaderWriterFactory< ::backup::CreateNewBackupRequest, ::backup::CreateNewBackupResponse>::Create(channel_.get(), cq, rpcmethod_CreateNewBackup_, context, false, nullptr); } -::grpc::ClientWriter< ::backup::SendLogRequest>* BackupService::Stub::SendLogRaw(::grpc::ClientContext* context, ::google::protobuf::Empty* response) { - return ::grpc::internal::ClientWriterFactory< ::backup::SendLogRequest>::Create(channel_.get(), rpcmethod_SendLog_, context, response); +::grpc::ClientReaderWriter< ::backup::SendLogRequest, ::google::protobuf::Empty>* BackupService::Stub::SendLogRaw(::grpc::ClientContext* context) { + return ::grpc::internal::ClientReaderWriterFactory< ::backup::SendLogRequest, ::google::protobuf::Empty>::Create(channel_.get(), rpcmethod_SendLog_, context); } -void BackupService::Stub::async::SendLog(::grpc::ClientContext* context, ::google::protobuf::Empty* response, ::grpc::ClientWriteReactor< ::backup::SendLogRequest>* reactor) { - ::grpc::internal::ClientCallbackWriterFactory< ::backup::SendLogRequest>::Create(stub_->channel_.get(), stub_->rpcmethod_SendLog_, context, response, reactor); +void BackupService::Stub::async::SendLog(::grpc::ClientContext* context, ::grpc::ClientBidiReactor< ::backup::SendLogRequest,::google::protobuf::Empty>* reactor) { + ::grpc::internal::ClientCallbackReaderWriterFactory< ::backup::SendLogRequest,::google::protobuf::Empty>::Create(stub_->channel_.get(), stub_->rpcmethod_SendLog_, context, reactor); } -::grpc::ClientAsyncWriter< ::backup::SendLogRequest>* BackupService::Stub::AsyncSendLogRaw(::grpc::ClientContext* context, ::google::protobuf::Empty* response, ::grpc::CompletionQueue* cq, void* tag) { - return ::grpc::internal::ClientAsyncWriterFactory< ::backup::SendLogRequest>::Create(channel_.get(), cq, rpcmethod_SendLog_, context, response, true, tag); +::grpc::ClientAsyncReaderWriter< ::backup::SendLogRequest, ::google::protobuf::Empty>* BackupService::Stub::AsyncSendLogRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) { + return ::grpc::internal::ClientAsyncReaderWriterFactory< ::backup::SendLogRequest, ::google::protobuf::Empty>::Create(channel_.get(), cq, rpcmethod_SendLog_, context, true, tag); } -::grpc::ClientAsyncWriter< ::backup::SendLogRequest>* BackupService::Stub::PrepareAsyncSendLogRaw(::grpc::ClientContext* context, ::google::protobuf::Empty* response, ::grpc::CompletionQueue* cq) { - return ::grpc::internal::ClientAsyncWriterFactory< ::backup::SendLogRequest>::Create(channel_.get(), cq, rpcmethod_SendLog_, context, response, false, nullptr); +::grpc::ClientAsyncReaderWriter< ::backup::SendLogRequest, ::google::protobuf::Empty>* BackupService::Stub::PrepareAsyncSendLogRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncReaderWriterFactory< ::backup::SendLogRequest, ::google::protobuf::Empty>::Create(channel_.get(), cq, rpcmethod_SendLog_, context, false, nullptr); } ::grpc::ClientReaderWriter< ::backup::RecoverBackupKeyRequest, ::backup::RecoverBackupKeyResponse>* BackupService::Stub::RecoverBackupKeyRaw(::grpc::ClientContext* context) { @@ -118,13 +118,13 @@ }, this))); AddMethod(new ::grpc::internal::RpcServiceMethod( BackupService_method_names[1], - ::grpc::internal::RpcMethod::CLIENT_STREAMING, - new ::grpc::internal::ClientStreamingHandler< BackupService::Service, ::backup::SendLogRequest, ::google::protobuf::Empty>( + ::grpc::internal::RpcMethod::BIDI_STREAMING, + new ::grpc::internal::BidiStreamingHandler< BackupService::Service, ::backup::SendLogRequest, ::google::protobuf::Empty>( [](BackupService::Service* service, ::grpc::ServerContext* ctx, - ::grpc::ServerReader<::backup::SendLogRequest>* reader, - ::google::protobuf::Empty* resp) { - return service->SendLog(ctx, reader, resp); + ::grpc::ServerReaderWriter<::google::protobuf::Empty, + ::backup::SendLogRequest>* stream) { + return service->SendLog(ctx, stream); }, this))); AddMethod(new ::grpc::internal::RpcServiceMethod( BackupService_method_names[2], @@ -157,10 +157,9 @@ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } -::grpc::Status BackupService::Service::SendLog(::grpc::ServerContext* context, ::grpc::ServerReader< ::backup::SendLogRequest>* reader, ::google::protobuf::Empty* response) { +::grpc::Status BackupService::Service::SendLog(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::google::protobuf::Empty, ::backup::SendLogRequest>* stream) { (void) context; - (void) reader; - (void) response; + (void) stream; return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } diff --git a/native/cpp/CommonCpp/grpc/_generated/backup.pb.cc b/native/cpp/CommonCpp/grpc/_generated/backup.pb.cc --- a/native/cpp/CommonCpp/grpc/_generated/backup.pb.cc +++ b/native/cpp/CommonCpp/grpc/_generated/backup.pb.cc @@ -390,22 +390,22 @@ "Data\030\001 \001(\0132\'.backup.SimpleAuthentication" "RequestData\"K\n\022PullBackupResponse\022\031\n\017com" "pactionChunk\030\001 \001(\014H\000\022\022\n\010logChunk\030\002 \001(\014H\000" - "B\006\n\004data2\320\002\n\rBackupService\022X\n\017CreateNewB" + "B\006\n\004data2\322\002\n\rBackupService\022X\n\017CreateNewB" "ackup\022\036.backup.CreateNewBackupRequest\032\037." - "backup.CreateNewBackupResponse\"\000(\0010\001\022=\n\007" + "backup.CreateNewBackupResponse\"\000(\0010\001\022\?\n\007" "SendLog\022\026.backup.SendLogRequest\032\026.google" - ".protobuf.Empty\"\000(\001\022[\n\020RecoverBackupKey\022" - "\037.backup.RecoverBackupKeyRequest\032 .backu" - "p.RecoverBackupKeyResponse\"\000(\0010\001\022I\n\nPull" - "Backup\022\031.backup.PullBackupRequest\032\032.back" - "up.PullBackupResponse\"\000(\0010\001b\006proto3" + ".protobuf.Empty\"\000(\0010\001\022[\n\020RecoverBackupKe" + "y\022\037.backup.RecoverBackupKeyRequest\032 .bac" + "kup.RecoverBackupKeyResponse\"\000(\0010\001\022I\n\nPu" + "llBackup\022\031.backup.PullBackupRequest\032\032.ba" + "ckup.PullBackupResponse\"\000(\0010\001b\006proto3" ; static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_backup_2eproto_deps[1] = { &::descriptor_table_google_2fprotobuf_2fempty_2eproto, }; static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_backup_2eproto_once; const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_backup_2eproto = { - false, false, 2235, descriptor_table_protodef_backup_2eproto, "backup.proto", + false, false, 2237, descriptor_table_protodef_backup_2eproto, "backup.proto", &descriptor_table_backup_2eproto_once, descriptor_table_backup_2eproto_deps, 1, 14, schemas, file_default_instances, TableStruct_backup_2eproto::offsets, file_level_metadata_backup_2eproto, file_level_enum_descriptors_backup_2eproto, file_level_service_descriptors_backup_2eproto, diff --git a/native/cpp/CommonCpp/grpc/protos/backup.proto b/native/cpp/CommonCpp/grpc/protos/backup.proto --- a/native/cpp/CommonCpp/grpc/protos/backup.proto +++ b/native/cpp/CommonCpp/grpc/protos/backup.proto @@ -6,7 +6,7 @@ service BackupService { rpc CreateNewBackup(stream CreateNewBackupRequest) returns (stream CreateNewBackupResponse) {} - rpc SendLog(stream SendLogRequest) returns (google.protobuf.Empty) {} + rpc SendLog(stream SendLogRequest) returns (stream google.protobuf.Empty) {} rpc RecoverBackupKey(stream RecoverBackupKeyRequest) returns (stream RecoverBackupKeyResponse) {} rpc PullBackup(stream PullBackupRequest) returns (stream PullBackupResponse) {} } @@ -111,4 +111,4 @@ bytes compactionChunk = 1; bytes logChunk = 2; } -} \ No newline at end of file +} diff --git a/services/backup/docker-server/contents/server/src/BackupServiceImpl.h b/services/backup/docker-server/contents/server/src/BackupServiceImpl.h --- a/services/backup/docker-server/contents/server/src/BackupServiceImpl.h +++ b/services/backup/docker-server/contents/server/src/BackupServiceImpl.h @@ -8,31 +8,27 @@ namespace comm { namespace network { -class BackupServiceImpl final : public backup::BackupService::Service { +class BackupServiceImpl final : public backup::BackupService::CallbackService { public: BackupServiceImpl(); virtual ~BackupServiceImpl(); - grpc::Status CreateNewBackup( - grpc::ServerContext *context, - grpc::ServerReaderWriter< - backup::CreateNewBackupResponse, - backup::CreateNewBackupRequest> *stream) override; - grpc::Status SendLog( - grpc::ServerContext *context, - grpc::ServerReader *reader, - google::protobuf::Empty *response) override; - grpc::Status RecoverBackupKey( - grpc::ServerContext *context, - grpc::ServerReaderWriter< - backup::RecoverBackupKeyResponse, - backup::RecoverBackupKeyRequest> *stream) override; - grpc::Status PullBackup( - grpc::ServerContext *context, - grpc::ServerReaderWriter< - backup::PullBackupResponse, - backup::PullBackupRequest> *stream) override; + grpc::ServerBidiReactor< + backup::CreateNewBackupRequest, + backup::CreateNewBackupResponse> * + CreateNewBackup(grpc::CallbackServerContext *context) override; + + grpc::ServerBidiReactor * + SendLog(grpc::CallbackServerContext *context) override; + + grpc::ServerBidiReactor< + backup::RecoverBackupKeyRequest, + backup::RecoverBackupKeyResponse> * + RecoverBackupKey(grpc::CallbackServerContext *context) override; + + grpc::ServerBidiReactor + *PullBackup(grpc::CallbackServerContext *context) override; }; } // namespace network diff --git a/services/backup/docker-server/contents/server/src/BackupServiceImpl.cpp b/services/backup/docker-server/contents/server/src/BackupServiceImpl.cpp --- a/services/backup/docker-server/contents/server/src/BackupServiceImpl.cpp +++ b/services/backup/docker-server/contents/server/src/BackupServiceImpl.cpp @@ -1,5 +1,8 @@ #include "BackupServiceImpl.h" +#include "AuthenticationManager.h" +#include "ReactorBase.h" + #include namespace comm { @@ -13,35 +16,103 @@ Aws::ShutdownAPI({}); } -grpc::Status BackupServiceImpl::CreateNewBackup( - grpc::ServerContext *context, - grpc::ServerReaderWriter< - backup::CreateNewBackupResponse, - backup::CreateNewBackupRequest> *stream) { - return grpc::Status(grpc::StatusCode::UNIMPLEMENTED, "not implemented yet"); +grpc::ServerBidiReactor< + backup::CreateNewBackupRequest, + backup::CreateNewBackupResponse> * +BackupServiceImpl::CreateNewBackup(grpc::CallbackServerContext *context) { + class CreateNewBackupReactor : public ReactorBase< + backup::CreateNewBackupRequest, + backup::CreateNewBackupResponse> { + crypto::AuthenticationManager authenticationManager; + + public: + backup::CreateNewBackupResponse + handleRequest(backup::CreateNewBackupRequest request) override { + backup::CreateNewBackupResponse response; + if (this->authenticationManager.getState() != + crypto::AuthenticationState::SUCCESS && + !request.has_authenticationrequestdata()) { + throw std::runtime_error( + "authentication has not been finished properly"); + } + if (this->authenticationManager.getState() == + crypto::AuthenticationState::FAIL) { + throw std::runtime_error("authentication failure"); + } + if (this->authenticationManager.getState() != + crypto::AuthenticationState::SUCCESS) { + backup::FullAuthenticationResponseData authResponse = + this->authenticationManager.processRequest( + request.authenticationrequestdata()); + // warning: core dumps possible, in such a case, try making the response + // a member of CreateNewBackupReactor class + response.set_allocated_authenticationresponsedata(&authResponse); + return response; + } + // auth successful - receive compaction + std::string compactionDataChunk = request.newcompactionchunk(); + std::cout << "receive compaction " << compactionDataChunk.size() + << std::endl; + //... + throw EndConnectionError(); + } + }; + + return new CreateNewBackupReactor(); } -grpc::Status BackupServiceImpl::SendLog( - grpc::ServerContext *context, - grpc::ServerReader *reader, - google::protobuf::Empty *response) { - return grpc::Status(grpc::StatusCode::UNIMPLEMENTED, "not implemented yet"); +grpc::ServerBidiReactor * +BackupServiceImpl::SendLog(grpc::CallbackServerContext *context) { + class SendLogReactor + : public ReactorBase { + public: + google::protobuf::Empty + handleRequest(backup::SendLogRequest request) override { + throw EndConnectionError(); + // TODO handle request + return google::protobuf::Empty(); + } + }; + + return new SendLogReactor(); } -grpc::Status BackupServiceImpl::RecoverBackupKey( - grpc::ServerContext *context, - grpc::ServerReaderWriter< - backup::RecoverBackupKeyResponse, - backup::RecoverBackupKeyRequest> *stream) { - return grpc::Status(grpc::StatusCode::UNIMPLEMENTED, "not implemented yet"); +grpc::ServerBidiReactor< + backup::RecoverBackupKeyRequest, + backup::RecoverBackupKeyResponse> * +BackupServiceImpl::RecoverBackupKey(grpc::CallbackServerContext *context) { + class RecoverBackupKeyReactor : public ReactorBase< + backup::RecoverBackupKeyRequest, + backup::RecoverBackupKeyResponse> { + public: + backup::RecoverBackupKeyResponse + handleRequest(backup::RecoverBackupKeyRequest request) override { + throw EndConnectionError(); + // TODO handle request + // backup::RecoverBackupKeyResponse response; + // return response; + } + }; + + return new RecoverBackupKeyReactor(); } -grpc::Status BackupServiceImpl::PullBackup( - grpc::ServerContext *context, - grpc::ServerReaderWriter< - backup::PullBackupResponse, - backup::PullBackupRequest> *stream) { - return grpc::Status(grpc::StatusCode::UNIMPLEMENTED, "not implemented yet"); +grpc::ServerBidiReactor * +BackupServiceImpl::PullBackup(grpc::CallbackServerContext *context) { + class PullBackupReactor : public ReactorBase< + backup::PullBackupRequest, + backup::PullBackupResponse> { + public: + backup::PullBackupResponse + handleRequest(backup::PullBackupRequest request) override { + throw EndConnectionError(); + // TODO handle request + // backup::PullBackupResponse response; + // return response; + } + }; + + return new PullBackupReactor(); } } // namespace network