pub trait ForgeJob:
Send
+ Sync
+ 'static {
type Args: DeserializeOwned + Serialize + Send + Sync;
type Output: Serialize + Send;
// Required methods
fn info() -> JobInfo;
fn execute(
ctx: &JobContext,
args: Self::Args,
) -> Pin<Box<dyn Future<Output = Result<Self::Output, ForgeError>> + Send + '_>>;
// Provided method
fn compensate<'a>(
_ctx: &'a JobContext,
_args: Self::Args,
_reason: &'a str,
) -> Pin<Box<dyn Future<Output = Result<(), ForgeError>> + Send + 'a>> { ... }
}Expand description
Trait for FORGE job handlers.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn compensate<'a>(
_ctx: &'a JobContext,
_args: Self::Args,
_reason: &'a str,
) -> Pin<Box<dyn Future<Output = Result<(), ForgeError>> + Send + 'a>>
fn compensate<'a>( _ctx: &'a JobContext, _args: Self::Args, _reason: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), ForgeError>> + Send + 'a>>
Compensate a cancelled job.
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.