Module Fn

Module Fn 

Source
Expand description

Effect execution functions implemented on ApplicationRunTime.

§Fn (RunTime::Execute)

§RESPONSIBILITIES

Core effect execution functions that bridge the declarative ActionEffect system with the Echo scheduler for high-performance task execution.

§ARCHITECTURAL ROLE

The execution engine in Mountain’s architecture that handles the “how” of effect execution, while ActionEffect defines the “what”.

§KEY COMPONENTS

  • Run: Basic effect execution through Echo scheduler
  • RunWithTimeout: Timeout-based execution with cancellation
  • RunWithRetry: Retry mechanisms with exponential backoff

§ERROR HANDLING

All errors are propagated through Result<T, E> with detailed context. Effect errors are converted to CommonError when appropriate. Timeouts return timeout-specific errors. Retry failures include attempt count and last error information.

§LOGGING

Uses log crate with appropriate severity levels:

  • info: Effect submission and completion
  • debug: Detailed execution steps
  • warn: Retry attempts and recoverable errors
  • error: Failed operations and timeout occurrences

§PERFORMANCE CONSIDERATIONS

  • Uses oneshot channels for result collection (minimal overhead)
  • Tasks are submitted to Echo’s work-stealing scheduler
  • Timeout uses tokio::time::timeout for efficient cancellation
  • Retry with exponential backoff prevents system overload

§TODO

None