@@ -21,14 +21,8 @@ impl ConfigHandler {
2121 Self { config_loader }
2222 }
2323
24- pub fn handle_get (
25- & self ,
26- request : GetRequest ,
27- interceptor : & PluginsInterceptor ,
28- ) -> EngineResult < GetResponse > {
29- interceptor. intercept_with_plugins ( CommandType :: ConfigGet , None , request, self , |req| {
30- self . get ( req)
31- } )
24+ pub fn handle_get ( & self , request : GetRequest ) -> EngineResult < GetResponse > {
25+ self . get ( request)
3226 }
3327
3428 pub fn handle_set (
@@ -51,14 +45,8 @@ impl ConfigHandler {
5145 } )
5246 }
5347
54- pub fn handle_list (
55- & self ,
56- request : ListRequest ,
57- interceptor : & PluginsInterceptor ,
58- ) -> EngineResult < ListResponse > {
59- interceptor. intercept_with_plugins ( CommandType :: ConfigList , None , request, self , |req| {
60- self . list ( req)
61- } )
48+ pub fn handle_list ( & self , request : ListRequest ) -> EngineResult < ListResponse > {
49+ self . list ( request)
6250 }
6351
6452 pub fn handle_create ( & self , request : CreateRequest ) -> EngineResult < CreateResponse > {
@@ -120,50 +108,6 @@ impl ConfigOperations for ConfigHandler {
120108 }
121109}
122110
123- impl PluginsInvocationMapper < GetRequest , GetResponse > for ConfigHandler {
124- fn request_to_payload ( & self , req : & GetRequest ) -> EngineResult < InvocationPrePayload > {
125- Ok ( InvocationPrePayload :: ConfigGet ( ConfigGetPrePayload {
126- config_file : req. location . get_default_path ( ) ?,
127- key : req. key . clone ( ) ,
128- default : req. default . clone ( ) ,
129- } ) )
130- }
131-
132- fn response_to_payload ( & self , res : & GetResponse ) -> EngineResult < InvocationPostPayload > {
133- Ok ( InvocationPostPayload :: ConfigGet ( ConfigGetPostPayload {
134- key : res. key . clone ( ) ,
135- value : res. value . clone ( ) ,
136- } ) )
137- }
138-
139- fn input_to_request ( & self , input : & InvocationInput ) -> EngineResult < GetRequest > {
140- if let Some ( InvocationPrePayload :: ConfigGet ( pre) ) = & input. pre_payload {
141- Ok ( GetRequest {
142- location : ConfigLocation :: from_path ( & pre. config_file ) ?,
143- key : pre. key . clone ( ) ,
144- default : pre. default . clone ( ) ,
145- } )
146- } else {
147- Err ( EngineError :: Plugins ( PluginError :: PrePayload {
148- payload : input. pre_payload . clone ( ) ,
149- } ) )
150- }
151- }
152-
153- fn input_to_response ( & self , input : & InvocationInput ) -> EngineResult < GetResponse > {
154- if let Some ( InvocationPostPayload :: ConfigGet ( post) ) = & input. post_payload {
155- Ok ( GetResponse {
156- key : post. key . clone ( ) ,
157- value : post. value . clone ( ) ,
158- } )
159- } else {
160- Err ( EngineError :: Plugins ( PluginError :: PostPayload {
161- payload : input. post_payload . clone ( ) ,
162- } ) )
163- }
164- }
165- }
166-
167111impl PluginsInvocationMapper < SetRequest , SetResponse > for ConfigHandler {
168112 fn request_to_payload ( & self , req : & SetRequest ) -> EngineResult < InvocationPrePayload > {
169113 Ok ( InvocationPrePayload :: ConfigSet ( ConfigSetPrePayload {
@@ -195,7 +139,7 @@ impl PluginsInvocationMapper<SetRequest, SetResponse> for ConfigHandler {
195139 }
196140
197141 fn input_to_response ( & self , input : & InvocationInput ) -> EngineResult < SetResponse > {
198- if let Some ( InvocationPostPayload :: ConfigGet ( post) ) = & input. post_payload {
142+ if let Some ( InvocationPostPayload :: ConfigSet ( post) ) = & input. post_payload {
199143 Ok ( SetResponse {
200144 key : post. key . clone ( ) ,
201145 value : post. value . clone ( ) ,
@@ -247,41 +191,3 @@ impl PluginsInvocationMapper<UnsetRequest, UnsetResponse> for ConfigHandler {
247191 }
248192 }
249193}
250-
251- impl PluginsInvocationMapper < ListRequest , ListResponse > for ConfigHandler {
252- fn request_to_payload ( & self , req : & ListRequest ) -> EngineResult < InvocationPrePayload > {
253- Ok ( InvocationPrePayload :: ConfigList ( ConfigListPrePayload {
254- config_file : req. location . get_default_path ( ) ?,
255- } ) )
256- }
257-
258- fn response_to_payload ( & self , res : & ListResponse ) -> EngineResult < InvocationPostPayload > {
259- Ok ( InvocationPostPayload :: ConfigList ( ConfigListPostPayload {
260- key_values : res. key_values . clone ( ) ,
261- } ) )
262- }
263-
264- fn input_to_request ( & self , input : & InvocationInput ) -> EngineResult < ListRequest > {
265- if let Some ( InvocationPrePayload :: ConfigList ( pre) ) = & input. pre_payload {
266- Ok ( ListRequest {
267- location : ConfigLocation :: from_path ( & pre. config_file ) ?,
268- } )
269- } else {
270- Err ( EngineError :: Plugins ( PluginError :: PrePayload {
271- payload : input. pre_payload . clone ( ) ,
272- } ) )
273- }
274- }
275-
276- fn input_to_response ( & self , input : & InvocationInput ) -> EngineResult < ListResponse > {
277- if let Some ( InvocationPostPayload :: ConfigList ( post) ) = & input. post_payload {
278- Ok ( ListResponse {
279- key_values : post. key_values . clone ( ) ,
280- } )
281- } else {
282- Err ( EngineError :: Plugins ( PluginError :: PostPayload {
283- payload : input. post_payload . clone ( ) ,
284- } ) )
285- }
286- }
287- }
0 commit comments