Skip to main content

ModuleNodeTrait

Trait ModuleNodeTrait 

Source
pub trait ModuleNodeTrait: Send + Sync {
    // Required methods
    fn generate<'life0, 'async_trait>(
        &'life0 self,
        _config: Arc<ModuleConfig>,
        _params: Map<String, Value>,
        _login_info: Option<LoginInfo>,
    ) -> Pin<Box<dyn Future<Output = Result<SyncBoxStream<'static, Request>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn parser<'life0, 'async_trait>(
        &'life0 self,
        response: Response,
        _config: Option<Arc<ModuleConfig>>,
    ) -> Pin<Box<dyn Future<Output = Result<TaskOutputEvent>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn retryable(&self) -> bool { ... }
    fn stable_node_key(&self) -> &'static str { ... }
}
Expand description

ModuleNodeTrait defines per-node request generation and response parsing. Data across nodes is currently propagated via metadata: Request -> Response -> TaskParserEvent -> Request. Ideally node structs are immutable during execution; when mutable progression state (e.g. pagination) is needed, it should be carried in metadata.

Required Methods§

Source

fn generate<'life0, 'async_trait>( &'life0 self, _config: Arc<ModuleConfig>, _params: Map<String, Value>, _login_info: Option<LoginInfo>, ) -> Pin<Box<dyn Future<Output = Result<SyncBoxStream<'static, Request>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn parser<'life0, 'async_trait>( &'life0 self, response: Response, _config: Option<Arc<ModuleConfig>>, ) -> Pin<Box<dyn Future<Output = Result<TaskOutputEvent>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Source

fn retryable(&self) -> bool

Source

fn stable_node_key(&self) -> &'static str

Returns a stable, unique string key for this node type within the DAG.

When non-empty, ModuleDagNodeDef uses this value directly as the node ID instead of a randomly generated UUID. This ensures node IDs remain consistent across DAG rebuilds (e.g. after error-task retries cause the factory to reconstruct the module instance), so error retry routing works correctly.

Override this and return a short constant string that is unique among all nodes in the same module’s DAG. Default is "" (random UUID, existing behavior preserved for backward compatibility).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§