@@ -352,7 +352,7 @@ impl<T: SimpleFunctionFactoryBase> SimpleFunctionFactory for T {
352352
353353pub struct TypedExportDataCollectionBuildOutput < F : TargetFactoryBase + ?Sized > {
354354 pub export_context : BoxFuture < ' static , Result < Arc < F :: ExportContext > > > ,
355- pub setup_key : F :: Key ,
355+ pub setup_key : F :: SetupKey ,
356356 pub desired_setup_state : F :: SetupState ,
357357}
358358pub struct TypedExportDataCollectionSpec < F : TargetFactoryBase + ?Sized > {
@@ -364,17 +364,19 @@ pub struct TypedExportDataCollectionSpec<F: TargetFactoryBase + ?Sized> {
364364}
365365
366366pub struct TypedResourceSetupChangeItem < ' a , F : TargetFactoryBase + ?Sized > {
367- pub key : F :: Key ,
367+ pub key : F :: SetupKey ,
368368 pub setup_change : & ' a F :: SetupChange ,
369369}
370370
371371#[ async_trait]
372372pub trait TargetFactoryBase : TargetFactory + Send + Sync + ' static {
373373 type Spec : DeserializeOwned + Send + Sync ;
374374 type DeclarationSpec : DeserializeOwned + Send + Sync ;
375- type Key : Debug + Clone + Serialize + DeserializeOwned + Eq + Hash + Send + Sync ;
375+
376+ type SetupKey : Debug + Clone + Serialize + DeserializeOwned + Eq + Hash + Send + Sync ;
376377 type SetupState : Debug + Clone + Serialize + DeserializeOwned + Send + Sync ;
377378 type SetupChange : ResourceSetupChange ;
379+
378380 type ExportContext : Send + Sync + ' static ;
379381
380382 fn name ( & self ) -> & str ;
@@ -386,20 +388,20 @@ pub trait TargetFactoryBase: TargetFactory + Send + Sync + 'static {
386388 context : Arc < FlowInstanceContext > ,
387389 ) -> Result < (
388390 Vec < TypedExportDataCollectionBuildOutput < Self > > ,
389- Vec < ( Self :: Key , Self :: SetupState ) > ,
391+ Vec < ( Self :: SetupKey , Self :: SetupState ) > ,
390392 ) > ;
391393
392394 /// Deserialize the setup key from a JSON value.
393395 /// You can override this method to provide a custom deserialization logic, e.g. to perform backward compatible deserialization.
394- fn deserialize_setup_key ( key : serde_json:: Value ) -> Result < Self :: Key > {
396+ fn deserialize_setup_key ( key : serde_json:: Value ) -> Result < Self :: SetupKey > {
395397 Ok ( serde_json:: from_value ( key) ?)
396398 }
397399
398400 /// Will not be called if it's setup by user.
399401 /// It returns an error if the target only supports setup by user.
400402 async fn diff_setup_states (
401403 & self ,
402- key : Self :: Key ,
404+ key : Self :: SetupKey ,
403405 desired_state : Option < Self :: SetupState > ,
404406 existing_states : setup:: CombinedState < Self :: SetupState > ,
405407 flow_instance_ctx : Arc < FlowInstanceContext > ,
@@ -411,7 +413,7 @@ pub trait TargetFactoryBase: TargetFactory + Send + Sync + 'static {
411413 existing_state : & Self :: SetupState ,
412414 ) -> Result < SetupStateCompatibility > ;
413415
414- fn describe_resource ( & self , key : & Self :: Key ) -> Result < String > ;
416+ fn describe_resource ( & self , key : & Self :: SetupKey ) -> Result < String > ;
415417
416418 fn extract_additional_key (
417419 & self ,
@@ -504,7 +506,7 @@ impl<T: TargetFactoryBase> TargetFactory for T {
504506 existing_states : setup:: CombinedState < serde_json:: Value > ,
505507 flow_instance_ctx : Arc < FlowInstanceContext > ,
506508 ) -> Result < Box < dyn setup:: ResourceSetupChange > > {
507- let key: T :: Key = Self :: deserialize_setup_key ( key. clone ( ) ) ?;
509+ let key: T :: SetupKey = Self :: deserialize_setup_key ( key. clone ( ) ) ?;
508510 let desired_state: Option < T :: SetupState > = desired_state
509511 . map ( |v| serde_json:: from_value ( v. clone ( ) ) )
510512 . transpose ( ) ?;
@@ -521,12 +523,12 @@ impl<T: TargetFactoryBase> TargetFactory for T {
521523 }
522524
523525 fn describe_resource ( & self , key : & serde_json:: Value ) -> Result < String > {
524- let key: T :: Key = Self :: deserialize_setup_key ( key. clone ( ) ) ?;
526+ let key: T :: SetupKey = Self :: deserialize_setup_key ( key. clone ( ) ) ?;
525527 TargetFactoryBase :: describe_resource ( self , & key)
526528 }
527529
528530 fn normalize_setup_key ( & self , key : & serde_json:: Value ) -> Result < serde_json:: Value > {
529- let key: T :: Key = Self :: deserialize_setup_key ( key. clone ( ) ) ?;
531+ let key: T :: SetupKey = Self :: deserialize_setup_key ( key. clone ( ) ) ?;
530532 Ok ( serde_json:: to_value ( key) ?)
531533 }
532534
0 commit comments