@@ -69,3 +69,79 @@ pub trait InvokeCallback {
6969 fn operation_succeed ( & self , response : RemotingCommand ) ;
7070 fn operation_fail ( & self , throwable : Box < dyn std:: error:: Error > ) ;
7171}
72+
73+ #[ allow( unused_variables) ]
74+ mod inner {
75+ use std:: collections:: HashMap ;
76+ use std:: sync:: Arc ;
77+
78+ use crate :: base:: response_future:: ResponseFuture ;
79+ use crate :: net:: channel:: Channel ;
80+ use crate :: protocol:: remoting_command:: RemotingCommand ;
81+ use crate :: protocol:: RemotingCommandType ;
82+ use crate :: remoting_server:: server:: Shutdown ;
83+ use crate :: runtime:: connection_handler_context:: ConnectionHandlerContext ;
84+ use crate :: runtime:: processor:: RequestProcessor ;
85+ use crate :: runtime:: RPCHook ;
86+
87+ struct RemotingGeneral < RP > {
88+ request_processor : RP ,
89+ shutdown : Shutdown ,
90+ rpc_hooks : Arc < Vec < Box < dyn RPCHook > > > ,
91+ response_table : HashMap < i32 , ResponseFuture > ,
92+ }
93+
94+ impl < RP > RemotingGeneral < RP >
95+ where
96+ RP : RequestProcessor + Sync + ' static + Clone ,
97+ {
98+ pub fn process_message_received (
99+ & mut self ,
100+ channel : Channel ,
101+ ctx : ConnectionHandlerContext ,
102+ cmd : & mut RemotingCommand ,
103+ ) {
104+ match cmd. get_type ( ) {
105+ RemotingCommandType :: REQUEST => {
106+ self . process_request_command ( channel, ctx, cmd) ;
107+ }
108+ RemotingCommandType :: RESPONSE => {
109+ self . process_response_command ( channel, ctx, cmd) ;
110+ }
111+ }
112+ }
113+
114+ fn process_request_command (
115+ & mut self ,
116+ channel : Channel ,
117+ ctx : ConnectionHandlerContext ,
118+ cmd : & mut RemotingCommand ,
119+ ) {
120+ }
121+
122+ fn process_response_command (
123+ & mut self ,
124+ channel : Channel ,
125+ ctx : ConnectionHandlerContext ,
126+ cmd : & mut RemotingCommand ,
127+ ) {
128+ }
129+
130+ fn do_after_rpc_hooks (
131+ & self ,
132+ channel : & Channel ,
133+ request : & RemotingCommand ,
134+ response : Option < & mut RemotingCommand > ,
135+ ) -> rocketmq_error:: RocketMQResult < ( ) > {
136+ unimplemented ! ( "do_after_rpc_hooks unimplemented" )
137+ }
138+
139+ pub fn do_before_rpc_hooks (
140+ & self ,
141+ channel : & Channel ,
142+ request : Option < & mut RemotingCommand > ,
143+ ) -> rocketmq_error:: RocketMQResult < ( ) > {
144+ unimplemented ! ( "do_before_rpc_hooks unimplemented" )
145+ }
146+ }
147+ }
0 commit comments