Home | History | Annotate | Download | only in verbs
      1 /* Copyright 2017 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_CLIENT_H_
     17 #define TENSORFLOW_CONTRIB_GRPC_VERBS_CLIENT_H_
     18 
     19 #include "tensorflow/contrib/verbs/grpc_verbs_service_impl.h"
     20 #include "tensorflow/contrib/verbs/verbs_service.pb.h"
     21 #include "tensorflow/core/distributed_runtime/call_options.h"
     22 #include "tensorflow/core/distributed_runtime/rpc/grpc_util.h"
     23 #include "tensorflow/core/lib/core/status.h"
     24 
     25 namespace tensorflow {
     26 
     27 // GrpcVerbsClient is a client that uses gRPC to talk to the Verbs service.
     28 class GrpcVerbsClient {
     29  public:
     30   explicit GrpcVerbsClient(SharedGrpcChannelPtr client_channel)
     31       : stub_(grpc::VerbsService::NewStub(client_channel)) {}
     32   ~GrpcVerbsClient() {}
     33 
     34   Status GetRemoteAddress(CallOptions* call_options,
     35                           const GetRemoteAddressRequest* request,
     36                           GetRemoteAddressResponse* response);
     37   Status GetRemoteAddress(const GetRemoteAddressRequest* request,
     38                           GetRemoteAddressResponse* response);
     39 
     40  private:
     41   std::unique_ptr<grpc::VerbsService::Stub> stub_;
     42 
     43   void SetDeadline(::grpc::ClientContext* ctx, int64 time_in_ms);
     44 
     45   TF_DISALLOW_COPY_AND_ASSIGN(GrpcVerbsClient);
     46 };
     47 
     48 }  // namespace tensorflow
     49 
     50 #endif  // TENSORFLOW_CONTRIB_GRPC_VERBS_CLIENT_H_
     51