Home | History | Annotate | Download | only in verbs
      1 /* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
      2 
      3 Licensed under the Apache License, Version 2.0 (the "License");
      4 you may not use this file except in compliance with the License.
      5 You may obtain a copy of the License at
      6 
      7     http://www.apache.org/licenses/LICENSE-2.0
      8 
      9 Unless required by applicable law or agreed to in writing, software
     10 distributed under the License is distributed on an "AS IS" BASIS,
     11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 See the License for the specific language governing permissions and
     13 limitations under the License.
     14 ==============================================================================*/
     15 
     16 #ifndef TENSORFLOW_CONTRIB_GRPC_VERBS_SERVICE_IMPL_H_
     17 #define TENSORFLOW_CONTRIB_GRPC_VERBS_SERVICE_IMPL_H_
     18 
     19 #include "grpc++/impl/codegen/async_stream.h"
     20 #include "grpc++/impl/codegen/async_unary_call.h"
     21 #include "grpc++/impl/codegen/proto_utils.h"
     22 #include "grpc++/impl/codegen/rpc_method.h"
     23 #include "grpc++/impl/codegen/service_type.h"
     24 #include "grpc++/impl/codegen/status.h"
     25 #include "grpc++/impl/codegen/stub_options.h"
     26 #include "grpc++/impl/codegen/sync_stream.h"
     27 
     28 #include "tensorflow/contrib/verbs/verbs_service.pb.h"
     29 
     30 namespace grpc {
     31 class CompletionQueue;
     32 class Channel;
     33 class RpcService;
     34 class ServerCompletionQueue;
     35 class ServerContext;
     36 }  // namespace grpc
     37 
     38 namespace tensorflow {
     39 
     40 namespace grpc {
     41 
     42 // Implementation of `tensorflow.VerbsService`, based on the
     43 // definition in "//tensorflow/contrib/verbs/verbs_service.proto",
     44 // and the gRPC generated stub and service classes.
     45 // See the proto file for the definition of methods and messages.
     46 class VerbsService GRPC_FINAL {
     47  public:
     48   class StubInterface {
     49    public:
     50     virtual ~StubInterface() {}
     51     virtual ::grpc::Status GetRemoteAddress(
     52         ::grpc::ClientContext* context, const GetRemoteAddressRequest& request,
     53         GetRemoteAddressResponse* response) = 0;
     54   };
     55   class Stub GRPC_FINAL : public StubInterface {
     56    public:
     57     Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel);
     58     ::grpc::Status GetRemoteAddress(
     59         ::grpc::ClientContext* context, const GetRemoteAddressRequest& request,
     60         GetRemoteAddressResponse* response) GRPC_OVERRIDE;
     61 
     62    private:
     63     std::shared_ptr< ::grpc::ChannelInterface> channel_;
     64     const ::grpc::internal::RpcMethod rpcmethod_GetRemoteAddress_;
     65   };
     66   static std::unique_ptr<Stub> NewStub(
     67       const std::shared_ptr< ::grpc::ChannelInterface>& channel,
     68       const ::grpc::StubOptions& options = ::grpc::StubOptions());
     69 
     70   class AsyncService : public ::grpc::Service {
     71    public:
     72     AsyncService();
     73     virtual ~AsyncService();
     74     void RequestGetRemoteAddress(
     75         ::grpc::ServerContext* context, GetRemoteAddressRequest* request,
     76         ::grpc::ServerAsyncResponseWriter<GetRemoteAddressResponse>* response,
     77         ::grpc::CompletionQueue* new_call_cq,
     78         ::grpc::ServerCompletionQueue* notification_cq, void* tag) {
     79       ::grpc::Service::RequestAsyncUnary(0, context, request, response,
     80                                          new_call_cq, notification_cq, tag);
     81     }
     82   };
     83 };
     84 
     85 }  // namespace grpc
     86 
     87 }  // namespace tensorflow
     88 
     89 #endif  // TENSORFLOW_CONTRIB_GRPC_VERBS_SERVICE_IMPL_H_
     90