Skip to main content

DaemonDispatch

Trait DaemonDispatch 

Source
pub trait DaemonDispatch:
    Clone
    + Send
    + Sync
    + 'static {
    // Required methods
    fn dispatch<'life0, 'async_trait>(
        &'life0 self,
        ops: String,
        presentation: Option<String>,
        presentation_per_op: Option<Vec<Option<String>>>,
        format: Option<String>,
        format_per_op: Option<Vec<Option<String>>>,
        from_wire: bool,
    ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn warm_all<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn namespace(&self) -> &str;
    fn config_id(&self) -> &str;

    // Provided method
    fn pool_for_checkpoint(&self) -> Option<Arc<ConnectionPool>> { ... }
}
Expand description

Transport-agnostic dispatch interface for the daemon server.

The MCP crate implements this by dispatching through the shared request body while honoring DaemonRequestFrame::from_wire (so subhandler visibility is gated by request origin, not by transport); any future transport can do the same.

Required Methods§

Source

fn dispatch<'life0, 'async_trait>( &'life0 self, ops: String, presentation: Option<String>, presentation_per_op: Option<Vec<Option<String>>>, format: Option<String>, format_per_op: Option<Vec<Option<String>>>, from_wire: bool, ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Dispatch a verb-DSL request string and return the rendered result.

from_wire carries the origin discriminator from DaemonRequestFrame::from_wire: when true, the implementor enforces verb visibility (rejects Visibility::Subhandler verbs); when false, the request is from a trusted operator surface and subhandlers pass.

Source

fn warm_all<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Warm every pack’s in-memory state (ANN indexes, etc.).

Source

fn namespace(&self) -> &str

The namespace this dispatcher was configured for.

Source

fn config_id(&self) -> &str

Fingerprint of this dispatcher’s resolved runtime config (packs, db target, embedders). Used to reject forwarded requests from clients whose config differs, so a restricted client cannot dispatch through a broader daemon.

Provided Methods§

Source

fn pool_for_checkpoint(&self) -> Option<Arc<ConnectionPool>>

Return the pool to use for background WAL checkpointing, if available.

Implementors backed by a file-based SQLite database should return Some(pool_arc). In-memory or test dispatchers that have no pool return None and the checkpoint task is not spawned.

The default implementation returns None.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§