File indexing completed on 2026-04-17 08:35:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef _THRIFT_TASYNCPROCESSOR_H_
0021 #define _THRIFT_TASYNCPROCESSOR_H_ 1
0022
0023 #include <functional>
0024 #include <memory>
0025
0026 #include <thrift/TProcessor.h>
0027 #include <thrift/protocol/TProtocol.h>
0028
0029 namespace apache {
0030 namespace thrift {
0031 namespace async {
0032
0033
0034
0035
0036
0037
0038 class TAsyncProcessor {
0039 public:
0040 virtual ~TAsyncProcessor() = default;
0041
0042 virtual void process(std::function<void(bool success)> _return,
0043 std::shared_ptr<protocol::TProtocol> in,
0044 std::shared_ptr<protocol::TProtocol> out) = 0;
0045
0046 void process(std::function<void(bool success)> _return,
0047 std::shared_ptr<protocol::TProtocol> io) {
0048 return process(_return, io, io);
0049 }
0050
0051 std::shared_ptr<TProcessorEventHandler> getEventHandler() const { return eventHandler_; }
0052
0053 void setEventHandler(std::shared_ptr<TProcessorEventHandler> eventHandler) {
0054 eventHandler_ = eventHandler;
0055 }
0056
0057 protected:
0058 TAsyncProcessor() = default;
0059
0060 std::shared_ptr<TProcessorEventHandler> eventHandler_;
0061 };
0062
0063 class TAsyncProcessorFactory {
0064 public:
0065 virtual ~TAsyncProcessorFactory() = default;
0066
0067
0068
0069
0070
0071
0072
0073
0074 virtual std::shared_ptr<TAsyncProcessor> getProcessor(const TConnectionInfo& connInfo) = 0;
0075 };
0076 }
0077 }
0078 }
0079
0080 namespace apache {
0081 namespace thrift {
0082 using apache::thrift::async::TAsyncProcessor;
0083 }
0084 }
0085
0086 #endif