Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-17 08:35:01

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one
0003  * or more contributor license agreements. See the NOTICE file
0004  * distributed with this work for additional information
0005  * regarding copyright ownership. The ASF licenses this file
0006  * to you under the Apache License, Version 2.0 (the
0007  * "License"); you may not use this file except in compliance
0008  * with the License. You may obtain a copy of the License at
0009  *
0010  *   http://www.apache.org/licenses/LICENSE-2.0
0011  *
0012  * Unless required by applicable law or agreed to in writing,
0013  * software distributed under the License is distributed on an
0014  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
0015  * KIND, either express or implied. See the License for the
0016  * specific language governing permissions and limitations
0017  * under the License.
0018  */
0019 
0020 #ifndef _THRIFT_ASYNC_TASYNCCHANNEL_H_
0021 #define _THRIFT_ASYNC_TASYNCCHANNEL_H_ 1
0022 
0023 #include <functional>
0024 #include <memory>
0025 #include <thrift/Thrift.h>
0026 
0027 namespace apache {
0028 namespace thrift {
0029 namespace transport {
0030 class TMemoryBuffer;
0031 }
0032 }
0033 }
0034 
0035 namespace apache {
0036 namespace thrift {
0037 namespace async {
0038 using apache::thrift::transport::TMemoryBuffer;
0039 
0040 class TAsyncChannel {
0041 public:
0042   typedef std::function<void()> VoidCallback;
0043 
0044   virtual ~TAsyncChannel() = default;
0045 
0046   // is the channel in a good state?
0047   virtual bool good() const = 0;
0048   virtual bool error() const = 0;
0049   virtual bool timedOut() const = 0;
0050 
0051   /**
0052    * Send a message over the channel.
0053    */
0054   virtual void sendMessage(const VoidCallback& cob,
0055                            apache::thrift::transport::TMemoryBuffer* message) = 0;
0056 
0057   /**
0058    * Receive a message from the channel.
0059    */
0060   virtual void recvMessage(const VoidCallback& cob,
0061                            apache::thrift::transport::TMemoryBuffer* message) = 0;
0062 
0063   /**
0064    * Send a message over the channel and receive a response.
0065    */
0066   virtual void sendAndRecvMessage(const VoidCallback& cob,
0067                                   apache::thrift::transport::TMemoryBuffer* sendBuf,
0068                                   apache::thrift::transport::TMemoryBuffer* recvBuf);
0069 };
0070 }
0071 }
0072 } // apache::thrift::async
0073 
0074 #endif // #ifndef _THRIFT_ASYNC_TASYNCCHANNEL_H_