mirror of
https://github.com/unclechu/gRPC-haskell.git
synced 2024-11-05 10:49:42 +01:00
9113e416e7
* Tweak runOps param order, inline common op sequences, clean up serverHandleNormalCall * More ops sequence inlining for clarity, experimenting with Managed * Checkpoint: preliminary support for all streaming modes; much cleanup/refactoring and api design still needed * Use mempty for default StatusDetails; tweak bad status matching mechanism * Preliminary user-facing, server-streaming, low-level api and test * renaming wibbles * Preliminary user-facing, client-streaming, low-level api and test * Move sendMsgs comb to Network.GRPC.LowLevel.Op; misc cleanup/DCR * Modify bidi streaming to omit request payload * Add transformers dep * Preliminary user-facing low-level bidirectional streaming api and test * Fix missing peek import * Remove TimeoutSeconds params on streaming mode functions * Fix serverHandleNormalCall rebase wart * Fix rebase warts; minor hlint fixes and wibbles * Post-rebase tweaks to optional payload use in serverRequestCall (i.e., now respects payloadHandling again) * Cleanup/refactor serverRequestCall * Fix comment * Change ServerRWHandler type so that handler does not have to invoke a finalizer * Change ServerReaderHandler type so that handler does not have to invoke a finalizer * Simplify serverWriter interface and ServerWriterHandler structure * Simplify serverRW (get rid of exec param), improve bidi streaming tests * Use ExceptT in serverRW impl * Change ServerRWHandler type to pass recv/send operations. * Renaming * Define ClientRWHandler, pass recv/send ops * wibbles * Use ExceptT in clientRW impl * Add DataKinded phantom typing to RegisteredMethod; misc cleanup * Simplify sendMsgs interface; add SingleSend type and related helpers * Rename SingleSend to SendSingle, use ExceptT to clean up {client,server}Writer and sendMsgs * More ExceptT cleanup in clientWriter * Factor out reusable bits of clientWriter * Shrink ServerReaderHandler * Delete stale comments * begin high-level server interface * update to datakind representation * clean up * move method type info to type level, parametrize ServerCall by payload * convert for writer handler * start switching over to Message-based handlers * begin work on highlevel example * comment out old code * parametrize StreamSend * parametrize StreamRecv * conversion for ServerReaderHandler * finish handler conversions * Add high level version and payload checking to echo-client * Decouple server CQs from call-bound CQs (registered methods); use more consistent naming conventions * Decouple server/call-bound CQs for unregistered methods; refactor U.serverRequestCall; misc cleanup * Make convertRecv total; formatting wibbles
177 lines
8.2 KiB
C++
177 lines
8.2 KiB
C++
// Generated by the gRPC protobuf plugin.
|
|
// If you make any local change, they will be lost.
|
|
// source: echo.proto
|
|
#ifndef GRPC_echo_2eproto__INCLUDED
|
|
#define GRPC_echo_2eproto__INCLUDED
|
|
|
|
#include "echo.pb.h"
|
|
|
|
#include <grpc++/impl/codegen/async_stream.h>
|
|
#include <grpc++/impl/codegen/async_unary_call.h>
|
|
#include <grpc++/impl/codegen/proto_utils.h>
|
|
#include <grpc++/impl/codegen/rpc_method.h>
|
|
#include <grpc++/impl/codegen/service_type.h>
|
|
#include <grpc++/impl/codegen/status.h>
|
|
#include <grpc++/impl/codegen/stub_options.h>
|
|
#include <grpc++/impl/codegen/sync_stream.h>
|
|
|
|
namespace grpc {
|
|
class CompletionQueue;
|
|
class Channel;
|
|
class RpcService;
|
|
class ServerCompletionQueue;
|
|
class ServerContext;
|
|
} // namespace grpc
|
|
|
|
namespace echo {
|
|
|
|
class Echo GRPC_FINAL {
|
|
public:
|
|
class StubInterface {
|
|
public:
|
|
virtual ~StubInterface() {}
|
|
virtual ::grpc::Status DoEcho(::grpc::ClientContext* context, const ::echo::EchoRequest& request, ::echo::EchoRequest* response) = 0;
|
|
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::echo::EchoRequest>> AsyncDoEcho(::grpc::ClientContext* context, const ::echo::EchoRequest& request, ::grpc::CompletionQueue* cq) {
|
|
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::echo::EchoRequest>>(AsyncDoEchoRaw(context, request, cq));
|
|
}
|
|
private:
|
|
virtual ::grpc::ClientAsyncResponseReaderInterface< ::echo::EchoRequest>* AsyncDoEchoRaw(::grpc::ClientContext* context, const ::echo::EchoRequest& request, ::grpc::CompletionQueue* cq) = 0;
|
|
};
|
|
class Stub GRPC_FINAL : public StubInterface {
|
|
public:
|
|
Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel);
|
|
::grpc::Status DoEcho(::grpc::ClientContext* context, const ::echo::EchoRequest& request, ::echo::EchoRequest* response) GRPC_OVERRIDE;
|
|
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::echo::EchoRequest>> AsyncDoEcho(::grpc::ClientContext* context, const ::echo::EchoRequest& request, ::grpc::CompletionQueue* cq) {
|
|
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::echo::EchoRequest>>(AsyncDoEchoRaw(context, request, cq));
|
|
}
|
|
|
|
private:
|
|
std::shared_ptr< ::grpc::ChannelInterface> channel_;
|
|
::grpc::ClientAsyncResponseReader< ::echo::EchoRequest>* AsyncDoEchoRaw(::grpc::ClientContext* context, const ::echo::EchoRequest& request, ::grpc::CompletionQueue* cq) GRPC_OVERRIDE;
|
|
const ::grpc::RpcMethod rpcmethod_DoEcho_;
|
|
};
|
|
static std::unique_ptr<Stub> NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());
|
|
|
|
class Service : public ::grpc::Service {
|
|
public:
|
|
Service();
|
|
virtual ~Service();
|
|
virtual ::grpc::Status DoEcho(::grpc::ServerContext* context, const ::echo::EchoRequest* request, ::echo::EchoRequest* response);
|
|
};
|
|
template <class BaseClass>
|
|
class WithAsyncMethod_DoEcho : public BaseClass {
|
|
private:
|
|
void BaseClassMustBeDerivedFromService(const Service *service) {}
|
|
public:
|
|
WithAsyncMethod_DoEcho() {
|
|
::grpc::Service::MarkMethodAsync(0);
|
|
}
|
|
~WithAsyncMethod_DoEcho() GRPC_OVERRIDE {
|
|
BaseClassMustBeDerivedFromService(this);
|
|
}
|
|
// disable synchronous version of this method
|
|
::grpc::Status DoEcho(::grpc::ServerContext* context, const ::echo::EchoRequest* request, ::echo::EchoRequest* response) GRPC_FINAL GRPC_OVERRIDE {
|
|
abort();
|
|
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
|
}
|
|
void RequestDoEcho(::grpc::ServerContext* context, ::echo::EchoRequest* request, ::grpc::ServerAsyncResponseWriter< ::echo::EchoRequest>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
|
|
::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag);
|
|
}
|
|
};
|
|
typedef WithAsyncMethod_DoEcho<Service > AsyncService;
|
|
template <class BaseClass>
|
|
class WithGenericMethod_DoEcho : public BaseClass {
|
|
private:
|
|
void BaseClassMustBeDerivedFromService(const Service *service) {}
|
|
public:
|
|
WithGenericMethod_DoEcho() {
|
|
::grpc::Service::MarkMethodGeneric(0);
|
|
}
|
|
~WithGenericMethod_DoEcho() GRPC_OVERRIDE {
|
|
BaseClassMustBeDerivedFromService(this);
|
|
}
|
|
// disable synchronous version of this method
|
|
::grpc::Status DoEcho(::grpc::ServerContext* context, const ::echo::EchoRequest* request, ::echo::EchoRequest* response) GRPC_FINAL GRPC_OVERRIDE {
|
|
abort();
|
|
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
|
}
|
|
};
|
|
};
|
|
|
|
class Add GRPC_FINAL {
|
|
public:
|
|
class StubInterface {
|
|
public:
|
|
virtual ~StubInterface() {}
|
|
virtual ::grpc::Status DoAdd(::grpc::ClientContext* context, const ::echo::AddRequest& request, ::echo::AddResponse* response) = 0;
|
|
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::echo::AddResponse>> AsyncDoAdd(::grpc::ClientContext* context, const ::echo::AddRequest& request, ::grpc::CompletionQueue* cq) {
|
|
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::echo::AddResponse>>(AsyncDoAddRaw(context, request, cq));
|
|
}
|
|
private:
|
|
virtual ::grpc::ClientAsyncResponseReaderInterface< ::echo::AddResponse>* AsyncDoAddRaw(::grpc::ClientContext* context, const ::echo::AddRequest& request, ::grpc::CompletionQueue* cq) = 0;
|
|
};
|
|
class Stub GRPC_FINAL : public StubInterface {
|
|
public:
|
|
Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel);
|
|
::grpc::Status DoAdd(::grpc::ClientContext* context, const ::echo::AddRequest& request, ::echo::AddResponse* response) GRPC_OVERRIDE;
|
|
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::echo::AddResponse>> AsyncDoAdd(::grpc::ClientContext* context, const ::echo::AddRequest& request, ::grpc::CompletionQueue* cq) {
|
|
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::echo::AddResponse>>(AsyncDoAddRaw(context, request, cq));
|
|
}
|
|
|
|
private:
|
|
std::shared_ptr< ::grpc::ChannelInterface> channel_;
|
|
::grpc::ClientAsyncResponseReader< ::echo::AddResponse>* AsyncDoAddRaw(::grpc::ClientContext* context, const ::echo::AddRequest& request, ::grpc::CompletionQueue* cq) GRPC_OVERRIDE;
|
|
const ::grpc::RpcMethod rpcmethod_DoAdd_;
|
|
};
|
|
static std::unique_ptr<Stub> NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());
|
|
|
|
class Service : public ::grpc::Service {
|
|
public:
|
|
Service();
|
|
virtual ~Service();
|
|
virtual ::grpc::Status DoAdd(::grpc::ServerContext* context, const ::echo::AddRequest* request, ::echo::AddResponse* response);
|
|
};
|
|
template <class BaseClass>
|
|
class WithAsyncMethod_DoAdd : public BaseClass {
|
|
private:
|
|
void BaseClassMustBeDerivedFromService(const Service *service) {}
|
|
public:
|
|
WithAsyncMethod_DoAdd() {
|
|
::grpc::Service::MarkMethodAsync(0);
|
|
}
|
|
~WithAsyncMethod_DoAdd() GRPC_OVERRIDE {
|
|
BaseClassMustBeDerivedFromService(this);
|
|
}
|
|
// disable synchronous version of this method
|
|
::grpc::Status DoAdd(::grpc::ServerContext* context, const ::echo::AddRequest* request, ::echo::AddResponse* response) GRPC_FINAL GRPC_OVERRIDE {
|
|
abort();
|
|
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
|
}
|
|
void RequestDoAdd(::grpc::ServerContext* context, ::echo::AddRequest* request, ::grpc::ServerAsyncResponseWriter< ::echo::AddResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
|
|
::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag);
|
|
}
|
|
};
|
|
typedef WithAsyncMethod_DoAdd<Service > AsyncService;
|
|
template <class BaseClass>
|
|
class WithGenericMethod_DoAdd : public BaseClass {
|
|
private:
|
|
void BaseClassMustBeDerivedFromService(const Service *service) {}
|
|
public:
|
|
WithGenericMethod_DoAdd() {
|
|
::grpc::Service::MarkMethodGeneric(0);
|
|
}
|
|
~WithGenericMethod_DoAdd() GRPC_OVERRIDE {
|
|
BaseClassMustBeDerivedFromService(this);
|
|
}
|
|
// disable synchronous version of this method
|
|
::grpc::Status DoAdd(::grpc::ServerContext* context, const ::echo::AddRequest* request, ::echo::AddResponse* response) GRPC_FINAL GRPC_OVERRIDE {
|
|
abort();
|
|
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
|
}
|
|
};
|
|
};
|
|
|
|
} // namespace echo
|
|
|
|
|
|
#endif // GRPC_echo_2eproto__INCLUDED
|