use std::error::Error;
use async_trait::async_trait;
use crate::config::Config;
use crate::transform::{TransformAttempt, TransformRequest};
#[async_trait]
pub trait TransformAttemptCreator: Send {
type Input: Send;
type Output: Send;
type TransformRequest: TransformRequest<Input = Self::Input, Output = Self::Output>;
type TransformAttempt: TransformAttempt<CallArgsType = Self::Input, ReturnType = Self::Output>;
type TransformAttemptCreationError: Error + Send + Sync;
async fn new(config: std::sync::Arc<tokio::sync::Mutex<impl Config>>) -> Self
where
Self: Sized;
async fn create_new_attempt(
&mut self,
request: &Self::TransformRequest,
) -> Result<Self::TransformAttempt, Self::TransformAttemptCreationError>;
async fn create_new_reattempt(
&mut self,
request: <Self::TransformAttempt as TransformAttempt>::Identifier,
error: <Self::TransformAttempt as TransformAttempt>::ReturnPackage,
) -> Result<Self::TransformAttempt, Self::TransformAttemptCreationError>;
}