Skip to main content

TargetFactoryBase

Trait TargetFactoryBase 

Source
pub trait TargetFactoryBase:
    Send
    + Sync
    + 'static {
    type Spec: DeserializeOwned + Send + Sync;
    type DeclarationSpec: DeserializeOwned + Send + Sync;
    type SetupKey: Debug + Clone + Serialize + DeserializeOwned + Eq + Hash + Send + Sync;
    type SetupState: Debug + Clone + Serialize + DeserializeOwned + Send + Sync;
    type SetupChange: ResourceSetupChange;
    type ExportContext: Send + Sync + 'static;

    // Required methods
    fn name(&self) -> &str;
    fn build<'async_trait>(
        self: Arc<Self>,
        data_collections: Vec<TypedExportDataCollectionSpec<Self>>,
        declarations: Vec<Self::DeclarationSpec>,
        context: Arc<FlowInstanceContext>,
    ) -> Pin<Box<dyn Future<Output = Result<(Vec<TypedExportDataCollectionBuildOutput<Self>>, Vec<(Self::SetupKey, Self::SetupState)>)>> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn diff_setup_states<'life0, 'async_trait>(
        &'life0 self,
        key: Self::SetupKey,
        desired_state: Option<Self::SetupState>,
        existing_states: CombinedState<Self::SetupState>,
        flow_instance_ctx: Arc<FlowInstanceContext>,
    ) -> Pin<Box<dyn Future<Output = Result<Self::SetupChange>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn check_state_compatibility(
        &self,
        desired_state: &Self::SetupState,
        existing_state: &Self::SetupState,
    ) -> Result<SetupStateCompatibility>;
    fn describe_resource(&self, key: &Self::SetupKey) -> Result<String>;
    fn apply_mutation<'life0, 'async_trait>(
        &'life0 self,
        mutations: Vec<ExportTargetMutationWithContext<'async_trait, Self::ExportContext>>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn apply_setup_changes<'life0, 'async_trait>(
        &'life0 self,
        setup_change: Vec<TypedResourceSetupChangeItem<'async_trait, Self>>,
        context: Arc<FlowInstanceContext>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn deserialize_setup_key(key: Value) -> Result<Self::SetupKey> { ... }
    fn extract_additional_key(
        &self,
        _key: &KeyValue,
        _value: &FieldValues,
        _export_context: &Self::ExportContext,
    ) -> Result<Value> { ... }
    fn register(self, registry: &mut ExecutorFactoryRegistry) -> Result<()>
       where Self: Sized { ... }
}

Required Associated Types§

Required Methods§

Source

fn name(&self) -> &str

Source

fn build<'async_trait>( self: Arc<Self>, data_collections: Vec<TypedExportDataCollectionSpec<Self>>, declarations: Vec<Self::DeclarationSpec>, context: Arc<FlowInstanceContext>, ) -> Pin<Box<dyn Future<Output = Result<(Vec<TypedExportDataCollectionBuildOutput<Self>>, Vec<(Self::SetupKey, Self::SetupState)>)>> + Send + 'async_trait>>
where Self: 'async_trait,

Source

fn diff_setup_states<'life0, 'async_trait>( &'life0 self, key: Self::SetupKey, desired_state: Option<Self::SetupState>, existing_states: CombinedState<Self::SetupState>, flow_instance_ctx: Arc<FlowInstanceContext>, ) -> Pin<Box<dyn Future<Output = Result<Self::SetupChange>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Will not be called if it’s setup by user. It returns an error if the target only supports setup by user.

Source

fn check_state_compatibility( &self, desired_state: &Self::SetupState, existing_state: &Self::SetupState, ) -> Result<SetupStateCompatibility>

Source

fn describe_resource(&self, key: &Self::SetupKey) -> Result<String>

Source

fn apply_mutation<'life0, 'async_trait>( &'life0 self, mutations: Vec<ExportTargetMutationWithContext<'async_trait, Self::ExportContext>>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn apply_setup_changes<'life0, 'async_trait>( &'life0 self, setup_change: Vec<TypedResourceSetupChangeItem<'async_trait, Self>>, context: Arc<FlowInstanceContext>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Source

fn deserialize_setup_key(key: Value) -> Result<Self::SetupKey>

Deserialize the setup key from a JSON value. You can override this method to provide a custom deserialization logic, e.g. to perform backward compatible deserialization.

Source

fn extract_additional_key( &self, _key: &KeyValue, _value: &FieldValues, _export_context: &Self::ExportContext, ) -> Result<Value>

Source

fn register(self, registry: &mut ExecutorFactoryRegistry) -> Result<()>
where Self: Sized,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§