pub struct Module {Show 16 fields
pub config: Arc<ModuleConfig>,
pub account: AccountInfo,
pub platform: PlatformInfo,
pub error_times: u32,
pub finished: bool,
pub data_middleware: Vec<String>,
pub download_middleware: Vec<String>,
pub module: Arc<dyn ModuleTrait>,
pub locker: bool,
pub locker_ttl: u64,
pub processor: ModuleDagProcessor,
pub run_id: Uuid,
pub prefix_request: Uuid,
pub pending_ctx: Option<ExecutionMark>,
pub bound_task_meta: Option<Map<String, Value>>,
pub bound_login_info: Option<LoginInfo>,
}Expand description
Runtime module instance bound to account/platform context.
A Module aggregates static module behavior, resolved configuration, middleware bindings, and DAG-runtime metadata.
Fields§
§config: Arc<ModuleConfig>Resolved module configuration.
account: AccountInfoBound account info (lightweight, no sea-orm dependency).
platform: PlatformInfoBound platform info (lightweight, no sea-orm dependency).
error_times: u32In-memory error counter snapshot.
finished: boolCompletion flag at module level.
data_middleware: Vec<String>Data middleware names.
download_middleware: Vec<String>Download middleware names.
module: Arc<dyn ModuleTrait>Module behavior implementation.
locker: boolWhether distributed locking is enabled.
locker_ttl: u64Lock TTL in seconds.
processor: ModuleDagProcessorQueue-backed DAG processor for node generation and parsing.
run_id: UuidRun identifier for cross-stage scoping.
prefix_request: UuidPrefix request for fallback tracing.
pending_ctx: Option<ExecutionMark>Optional execution context for precise node targeting.
bound_task_meta: Option<Map<String, Value>>Task metadata injected by TaskModuleProcessor.
bound_login_info: Option<LoginInfo>Login context injected by TaskModuleProcessor.
Implementations§
Source§impl Module
impl Module
Sourcepub fn bind_task_context(
&mut self,
task_meta: Map<String, Value>,
login_info: Option<LoginInfo>,
)
pub fn bind_task_context( &mut self, task_meta: Map<String, Value>, login_info: Option<LoginInfo>, )
Binds task metadata and optional login context.
Sourcepub fn runtime_task_context(&self) -> (Map<String, Value>, Option<LoginInfo>)
pub fn runtime_task_context(&self) -> (Map<String, Value>, Option<LoginInfo>)
Returns task metadata and login info used by generate.
Sourcepub async fn generate(
&self,
task_meta: Map<String, Value>,
login_info: Option<LoginInfo>,
) -> Result<SyncBoxStream<'static, Request>>
pub async fn generate( &self, task_meta: Map<String, Value>, login_info: Option<LoginInfo>, ) -> Result<SyncBoxStream<'static, Request>>
Generates request stream for the current chain step.
Delegates to ModuleDagProcessor, then enriches each request
with module/account/platform identity, middleware, config payloads, and run markers.
Sourcepub async fn add_step(&self)
pub async fn add_step(&self)
Builds the merged DAG definition and initializes the ModuleDagProcessor.
Merges dag_definition() (custom graph) with add_step() (linear steps) when both
are provided, following ModuleDagOrchestrator::compile_module priority rules.
Sourcepub async fn parser(
&self,
response: Response,
config: Option<Arc<ModuleConfig>>,
) -> Result<TaskOutputEvent>
pub async fn parser( &self, response: Response, config: Option<Arc<ModuleConfig>>, ) -> Result<TaskOutputEvent>
Parses response at the routed DAG node and handles terminal lifecycle hook.
Trait Implementations§
Source§impl EventProcessorTrait<Module, Pin<Box<dyn Stream<Item = Request> + Sync + Send>>> for TaskProcessor
impl EventProcessorTrait<Module, Pin<Box<dyn Stream<Item = Request> + Sync + Send>>> for TaskProcessor
fn pre_status(&self, input: &Module) -> Option<EventEnvelope>
fn finish_status( &self, input: &Module, _output: &SyncBoxStream<'static, Request>, ) -> Option<EventEnvelope>
fn working_status(&self, input: &Module) -> Option<EventEnvelope>
fn error_status(&self, input: &Module, err: &Error) -> Option<EventEnvelope>
fn retry_status( &self, input: &Module, retry_policy: &RetryPolicy, ) -> Option<EventEnvelope>
Source§impl From<&Module> for ModuleGenerateEvent
impl From<&Module> for ModuleGenerateEvent
Source§impl ProcessorTrait<Module, Pin<Box<dyn Stream<Item = Request> + Sync + Send>>> for TaskProcessor
impl ProcessorTrait<Module, Pin<Box<dyn Stream<Item = Request> + Sync + Send>>> for TaskProcessor
Source§fn process<'life0, 'async_trait>(
&'life0 self,
input: Module,
context: ProcessorContext,
) -> Pin<Box<dyn Future<Output = ProcessorResult<SyncBoxStream<'static, Request>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn process<'life0, 'async_trait>(
&'life0 self,
input: Module,
context: ProcessorContext,
) -> Pin<Box<dyn Future<Output = ProcessorResult<SyncBoxStream<'static, Request>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn post_process<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_input: &'life1 Module,
_output: &'life2 SyncBoxStream<'static, Request>,
_context: &'life3 ProcessorContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn post_process<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_input: &'life1 Module,
_output: &'life2 SyncBoxStream<'static, Request>,
_context: &'life3 ProcessorContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Source§fn pre_process<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_input: &'life1 Input,
_context: &'life2 ProcessorContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn pre_process<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_input: &'life1 Input,
_context: &'life2 ProcessorContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn handle_error<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_input: &'life1 Input,
_error: Error,
_context: &'life2 ProcessorContext,
) -> Pin<Box<dyn Future<Output = ProcessorResult<Output>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn handle_error<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_input: &'life1 Input,
_error: Error,
_context: &'life2 ProcessorContext,
) -> Pin<Box<dyn Future<Output = ProcessorResult<Output>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn should_process<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_input: &'life1 Input,
_context: &'life2 ProcessorContext,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn should_process<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_input: &'life1 Input,
_context: &'life2 ProcessorContext,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Auto Trait Implementations§
impl !RefUnwindSafe for Module
impl !UnwindSafe for Module
impl Freeze for Module
impl Send for Module
impl Sync for Module
impl Unpin for Module
impl UnsafeUnpin for Module
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more