diff options
author | Muxi Yan <mxyan@google.com> | 2018-01-26 15:39:32 -0800 |
---|---|---|
committer | Muxi Yan <mxyan@google.com> | 2018-02-15 14:49:34 -0800 |
commit | 0e00c430827e81d61e1e7164ef04ca21ccbfaa77 (patch) | |
tree | 9246301d4f3583a4befd834f7ea426663b8eb622 /include/grpc++/generic | |
parent | 8224c45866c6a2cfa29ede0c91a6ae9f40572658 (diff) |
Move headers from grpc++ to grpcpp
Diffstat (limited to 'include/grpc++/generic')
-rw-r--r-- | include/grpc++/generic/async_generic_service.h | 62 | ||||
-rw-r--r-- | include/grpc++/generic/generic_stub.h | 55 |
2 files changed, 12 insertions, 105 deletions
diff --git a/include/grpc++/generic/async_generic_service.h b/include/grpc++/generic/async_generic_service.h index b1ea4f3909..d3283fac6f 100644 --- a/include/grpc++/generic/async_generic_service.h +++ b/include/grpc++/generic/async_generic_service.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015 gRPC authors. + * Copyright 2018 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,63 +16,13 @@ * */ +// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the +// headers in include/grpcpp instead. This header exists only for backwards +// compatibility. + #ifndef GRPCXX_GENERIC_ASYNC_GENERIC_SERVICE_H #define GRPCXX_GENERIC_ASYNC_GENERIC_SERVICE_H -#include <grpc++/support/async_stream.h> -#include <grpc++/support/byte_buffer.h> - -struct grpc_server; - -namespace grpc { - -typedef ServerAsyncReaderWriter<ByteBuffer, ByteBuffer> - GenericServerAsyncReaderWriter; - -class GenericServerContext final : public ServerContext { - public: - const grpc::string& method() const { return method_; } - const grpc::string& host() const { return host_; } - - private: - friend class Server; - friend class ServerInterface; - - grpc::string method_; - grpc::string host_; -}; - -// A generic service at the server side accepts all RPC methods and hosts. It is -// typically used in proxies. The generic service can be registered to a server -// which also has other services. -// Sample usage: -// ServerBuilder builder; -// auto cq = builder.AddCompletionQueue(); -// AsyncGenericService generic_service; -// builder.RegisterAsyncGeneicService(&generic_service); -// auto server = builder.BuildAndStart(); -// -// // request a new call -// GenericServerContext context; -// GenericAsyncReaderWriter stream; -// generic_service.RequestCall(&context, &stream, cq.get(), cq.get(), tag); -// -// When tag is retrieved from cq->Next(), context.method() can be used to look -// at the method and the RPC can be handled accordingly. -class AsyncGenericService final { - public: - AsyncGenericService() : server_(nullptr) {} - - void RequestCall(GenericServerContext* ctx, - GenericServerAsyncReaderWriter* reader_writer, - CompletionQueue* call_cq, - ServerCompletionQueue* notification_cq, void* tag); - - private: - friend class Server; - Server* server_; -}; - -} // namespace grpc +#include <grpcpp/generic/async_generic_service.h> #endif // GRPCXX_GENERIC_ASYNC_GENERIC_SERVICE_H diff --git a/include/grpc++/generic/generic_stub.h b/include/grpc++/generic/generic_stub.h index e72826bdc1..502953b5de 100644 --- a/include/grpc++/generic/generic_stub.h +++ b/include/grpc++/generic/generic_stub.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015 gRPC authors. + * Copyright 2018 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,56 +16,13 @@ * */ +// DEPRECATED: The headers in include/grpc++ are deprecated. Please include the +// headers in include/grpcpp instead. This header exists only for backwards +// compatibility. + #ifndef GRPCXX_GENERIC_GENERIC_STUB_H #define GRPCXX_GENERIC_GENERIC_STUB_H -#include <grpc++/support/async_stream.h> -#include <grpc++/support/async_unary_call.h> -#include <grpc++/support/byte_buffer.h> - -namespace grpc { - -class CompletionQueue; -typedef ClientAsyncReaderWriter<ByteBuffer, ByteBuffer> - GenericClientAsyncReaderWriter; -typedef ClientAsyncResponseReader<ByteBuffer> GenericClientAsyncResponseReader; - -/// Generic stubs provide a type-unsafe interface to call gRPC methods -/// by name. -class GenericStub final { - public: - explicit GenericStub(std::shared_ptr<ChannelInterface> channel) - : channel_(channel) {} - - /// Setup a call to a named method \a method using \a context, but don't - /// start it. Let it be started explicitly with StartCall and a tag. - /// The return value only indicates whether or not registration of the call - /// succeeded (i.e. the call won't proceed if the return value is nullptr). - std::unique_ptr<GenericClientAsyncReaderWriter> PrepareCall( - ClientContext* context, const grpc::string& method, CompletionQueue* cq); - - /// Setup a unary call to a named method \a method using \a context, and don't - /// start it. Let it be started explicitly with StartCall. - /// The return value only indicates whether or not registration of the call - /// succeeded (i.e. the call won't proceed if the return value is nullptr). - std::unique_ptr<GenericClientAsyncResponseReader> PrepareUnaryCall( - ClientContext* context, const grpc::string& method, - const ByteBuffer& request, CompletionQueue* cq); - - /// DEPRECATED for multi-threaded use - /// Begin a call to a named method \a method using \a context. - /// A tag \a tag will be delivered to \a cq when the call has been started - /// (i.e, initial metadata has been sent). - /// The return value only indicates whether or not registration of the call - /// succeeded (i.e. the call won't proceed if the return value is nullptr). - std::unique_ptr<GenericClientAsyncReaderWriter> Call( - ClientContext* context, const grpc::string& method, CompletionQueue* cq, - void* tag); - - private: - std::shared_ptr<ChannelInterface> channel_; -}; - -} // namespace grpc +#include <grpcpp/generic/generic_stub.h> #endif // GRPCXX_GENERIC_GENERIC_STUB_H |