aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc++
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-02-09 15:25:21 -0800
committerGravatar Craig Tiller <ctiller@google.com>2015-02-09 15:25:21 -0800
commit1d2e21962ea2e70ab17c10868f1bf2acec2fde33 (patch)
tree76acfe37cc9bcee4d45157c521e70fa2ab74c90e /include/grpc++
parent061754a483a1b56fe24649ae2be68ffa613a643f (diff)
Server progress
Diffstat (limited to 'include/grpc++')
-rw-r--r--include/grpc++/channel_interface.h1
-rw-r--r--include/grpc++/impl/rpc_method.h4
-rw-r--r--include/grpc++/impl/rpc_service_method.h25
-rw-r--r--include/grpc++/server.h1
-rw-r--r--include/grpc++/server_context.h3
-rw-r--r--include/grpc++/stream.h38
6 files changed, 48 insertions, 24 deletions
diff --git a/include/grpc++/channel_interface.h b/include/grpc++/channel_interface.h
index 452c785733..79466c9fda 100644
--- a/include/grpc++/channel_interface.h
+++ b/include/grpc++/channel_interface.h
@@ -50,7 +50,6 @@ class CallOpBuffer;
class ClientContext;
class CompletionQueue;
class RpcMethod;
-class StreamContextInterface;
class CallInterface;
class ChannelInterface {
diff --git a/include/grpc++/impl/rpc_method.h b/include/grpc++/impl/rpc_method.h
index 75fec356dd..bb16e64c96 100644
--- a/include/grpc++/impl/rpc_method.h
+++ b/include/grpc++/impl/rpc_method.h
@@ -37,8 +37,8 @@
namespace google {
namespace protobuf {
class Message;
-}
-}
+} // namespace protobuf
+} // namespace google
namespace grpc {
diff --git a/include/grpc++/impl/rpc_service_method.h b/include/grpc++/impl/rpc_service_method.h
index 3077e0af66..0fb4f79b59 100644
--- a/include/grpc++/impl/rpc_service_method.h
+++ b/include/grpc++/impl/rpc_service_method.h
@@ -55,25 +55,18 @@ class MethodHandler {
public:
virtual ~MethodHandler() {}
struct HandlerParameter {
- HandlerParameter(ServerContext* context,
+ HandlerParameter(Call *c,
+ ServerContext* context,
const google::protobuf::Message* req,
google::protobuf::Message* resp)
- : server_context(context),
+ : call(c),
+ server_context(context),
request(req),
- response(resp),
- stream_context(nullptr) {}
- HandlerParameter(ServerContext* context,
- const google::protobuf::Message* req,
- google::protobuf::Message* resp,
- StreamContextInterface* stream)
- : server_context(context),
- request(req),
- response(resp),
- stream_context(stream) {}
+ response(resp) {}
+ Call* call;
ServerContext* server_context;
const google::protobuf::Message* request;
google::protobuf::Message* response;
- StreamContextInterface* stream_context;
};
virtual Status RunHandler(const HandlerParameter& param) = 0;
};
@@ -114,7 +107,7 @@ class ClientStreamingHandler : public MethodHandler {
: func_(func), service_(service) {}
Status RunHandler(const HandlerParameter& param) final {
- ServerReader<RequestType> reader(param.stream_context);
+ ServerReader<RequestType> reader(param.call);
return func_(service_, param.server_context, &reader,
dynamic_cast<ResponseType*>(param.response));
}
@@ -136,7 +129,7 @@ class ServerStreamingHandler : public MethodHandler {
: func_(func), service_(service) {}
Status RunHandler(const HandlerParameter& param) final {
- ServerWriter<ResponseType> writer(param.stream_context);
+ ServerWriter<ResponseType> writer(param.call);
return func_(service_, param.server_context,
dynamic_cast<const RequestType*>(param.request), &writer);
}
@@ -159,7 +152,7 @@ class BidiStreamingHandler : public MethodHandler {
: func_(func), service_(service) {}
Status RunHandler(const HandlerParameter& param) final {
- ServerReaderWriter<ResponseType, RequestType> stream(param.stream_context);
+ ServerReaderWriter<ResponseType, RequestType> stream(param.call);
return func_(service_, param.server_context, &stream);
}
diff --git a/include/grpc++/server.h b/include/grpc++/server.h
index ae86683f0b..670ffa7815 100644
--- a/include/grpc++/server.h
+++ b/include/grpc++/server.h
@@ -80,7 +80,6 @@ class Server {
// Start the server.
bool Start();
- void AllowOneRpc();
void HandleQueueClosed();
void RunRpc();
void ScheduleCallback();
diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h
index 47fd6cf1c8..9fd3ab1689 100644
--- a/include/grpc++/server_context.h
+++ b/include/grpc++/server_context.h
@@ -44,6 +44,9 @@ class ServerContext {
virtual ~ServerContext() {}
virtual std::chrono::system_clock::time_point absolute_deadline() const = 0;
+
+ private:
+ std::vector<std::pair<grpc::string, grpc::string> > metadata_;
};
} // namespace grpc
diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h
index 4d4581d00f..30af678c69 100644
--- a/include/grpc++/stream.h
+++ b/include/grpc++/stream.h
@@ -37,12 +37,43 @@
#include <grpc++/call.h>
#include <grpc++/channel_interface.h>
#include <grpc++/completion_queue.h>
-#include <grpc++/stream_context_interface.h>
#include <grpc++/status.h>
#include <grpc/support/log.h>
namespace grpc {
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+// DELETE DELETE DELETE
+ class StreamContextInterface {
+ public:
+ template <class T> bool Write(T, bool);
+ template <class T> void Start(T);
+ template <class T> bool Read(T);
+ google::protobuf::Message *request();
+ };
+
// Common interface for all client side streaming.
class ClientStreamingInterface {
public:
@@ -207,17 +238,16 @@ class ClientReaderWriter final : public ClientStreamingInterface,
template <class R>
class ServerReader final : public ReaderInterface<R> {
public:
- ServerReader(CompletionQueue* cq, Call* call) : cq_(cq), call_(call) {}
+ explicit ServerReader(Call* call) : call_(call) {}
virtual bool Read(R* msg) override {
CallOpBuffer buf;
buf.AddRecvMessage(msg);
call_->PerformOps(&buf, (void *)2);
- return cq_->Pluck((void *)2);
+ return call_->cq()->Pluck((void *)2);
}
private:
- CompletionQueue* cq_;
Call* call_;
};