@@ -296,14 +296,16 @@ pub trait StorageFactoryBase: ExportTargetFactory + Send + Sync + 'static {
296296 desired_state : Option < Self :: SetupState > ,
297297 existing_states : setup:: CombinedState < Self :: SetupState > ,
298298 auth_registry : & Arc < AuthRegistry > ,
299- ) -> Result < impl setup:: ResourceSetupStatusCheck < Self :: Key , Self :: SetupState > + ' static > ;
299+ ) -> Result < impl setup:: ResourceSetupStatusCheck + ' static > ;
300300
301301 fn check_state_compatibility (
302302 & self ,
303303 desired_state : & Self :: SetupState ,
304304 existing_state : & Self :: SetupState ,
305305 ) -> Result < SetupStateCompatibility > ;
306306
307+ fn describe_resource ( & self , key : & Self :: Key ) -> Result < String > ;
308+
307309 fn register ( self , registry : & mut ExecutorFactoryRegistry ) -> Result < ( ) >
308310 where
309311 Self : Sized ,
@@ -315,62 +317,6 @@ pub trait StorageFactoryBase: ExportTargetFactory + Send + Sync + 'static {
315317 }
316318}
317319
318- struct ResourceSetupStatusCheckWrapper < T : StorageFactoryBase > {
319- inner : Box < dyn setup:: ResourceSetupStatusCheck < T :: Key , T :: SetupState > + Send + Sync > ,
320- key_json : serde_json:: Value ,
321- state_json : Option < serde_json:: Value > ,
322- }
323-
324- impl < T : StorageFactoryBase > ResourceSetupStatusCheckWrapper < T > {
325- fn new (
326- inner : Box < dyn setup:: ResourceSetupStatusCheck < T :: Key , T :: SetupState > + Send + Sync > ,
327- ) -> Result < Self > {
328- Ok ( Self {
329- key_json : serde_json:: to_value ( inner. key ( ) ) ?,
330- state_json : inner
331- . desired_state ( )
332- . map ( serde_json:: to_value)
333- . transpose ( ) ?,
334- inner,
335- } )
336- }
337- }
338-
339- impl < T : StorageFactoryBase > Debug for ResourceSetupStatusCheckWrapper < T > {
340- fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
341- std:: fmt:: Debug :: fmt ( & self . inner , f)
342- }
343- }
344-
345- #[ async_trait]
346- impl < T : StorageFactoryBase > setup:: ResourceSetupStatusCheck < serde_json:: Value , serde_json:: Value >
347- for ResourceSetupStatusCheckWrapper < T >
348- {
349- fn describe_resource ( & self ) -> String {
350- self . inner . describe_resource ( )
351- }
352-
353- fn key ( & self ) -> & serde_json:: Value {
354- & self . key_json
355- }
356-
357- fn desired_state ( & self ) -> Option < & serde_json:: Value > {
358- self . state_json . as_ref ( )
359- }
360-
361- fn describe_changes ( & self ) -> Vec < String > {
362- self . inner . describe_changes ( )
363- }
364-
365- fn change_type ( & self ) -> setup:: SetupChangeType {
366- self . inner . change_type ( )
367- }
368-
369- async fn apply_change ( & self ) -> Result < ( ) > {
370- self . inner . apply_change ( ) . await
371- }
372- }
373-
374320impl < T : StorageFactoryBase > ExportTargetFactory for T {
375321 fn build (
376322 self : Arc < Self > ,
@@ -404,11 +350,7 @@ impl<T: StorageFactoryBase> ExportTargetFactory for T {
404350 desired_state : Option < serde_json:: Value > ,
405351 existing_states : setup:: CombinedState < serde_json:: Value > ,
406352 auth_registry : & Arc < AuthRegistry > ,
407- ) -> Result <
408- Box <
409- dyn setup:: ResourceSetupStatusCheck < serde_json:: Value , serde_json:: Value > + Send + Sync ,
410- > ,
411- > {
353+ ) -> Result < Box < dyn setup:: ResourceSetupStatusCheck > > {
412354 let key: T :: Key = serde_json:: from_value ( key. clone ( ) ) ?;
413355 let desired_state: Option < T :: SetupState > = desired_state
414356 . map ( |v| serde_json:: from_value ( v. clone ( ) ) )
@@ -421,9 +363,12 @@ impl<T: StorageFactoryBase> ExportTargetFactory for T {
421363 existing_states,
422364 auth_registry,
423365 ) ?;
424- Ok ( Box :: new ( ResourceSetupStatusCheckWrapper :: < T > :: new (
425- Box :: new ( status_check) ,
426- ) ?) )
366+ Ok ( Box :: new ( status_check) )
367+ }
368+
369+ fn describe_resource ( & self , key : & serde_json:: Value ) -> Result < String > {
370+ let key: T :: Key = serde_json:: from_value ( key. clone ( ) ) ?;
371+ StorageFactoryBase :: describe_resource ( self , & key)
427372 }
428373
429374 fn check_state_compatibility (
0 commit comments