Skip to main content

DaemonExecutor

Trait DaemonExecutor 

Source
pub trait DaemonExecutor<H: HttpClient>:
    Storage
    + Send
    + Sync {
    // Required methods
    fn http_client(&self) -> &Arc<H> ;
    fn config(&self) -> &DaemonConfig;
    fn run(
        self: Arc<Self>,
        shutdown_token: CancellationToken,
    ) -> Result<JoinHandle<Result<()>>>;
}
Expand description

Daemon executor trait for runtime orchestration.

This trait handles only the daemon lifecycle - spawning the background worker that processes requests. All data operations are on the Storage trait.

Required Methods§

Source

fn http_client(&self) -> &Arc<H>

Get a reference to the HTTP client.

Source

fn config(&self) -> &DaemonConfig

Get a reference to the daemon configuration.

Source

fn run( self: Arc<Self>, shutdown_token: CancellationToken, ) -> Result<JoinHandle<Result<()>>>

Run the daemon thread.

This spawns a background task responsible for actually doing the work of moving requests from one state to another, and broadcasting those status changes.

The daemon will:

  • Claim pending requests
  • Execute HTTP requests
  • Handle retries with exponential backoff
  • Update request statuses
  • Respect per-model concurrency limits
§Errors

Returns an error if the daemon fails to start.

§Example
let manager = Arc::new(manager);
let handle = manager.run()?;

// Do work...

// Shutdown gracefully (implementation-specific)
handle.abort();

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§