pub trait DaemonDispatch:
Clone
+ Send
+ Sync
+ 'static {
// Required methods
fn plan(&self, ops: &str) -> String;
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,
identity: Option<RequestIdentity>,
) -> 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 methods
fn idle_retirement_blockers(&self) -> Vec<String> { ... }
fn request_read_timeout(&self, _ops: &str) -> Duration { ... }
fn dispatch_with_error_detail<'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,
identity: Option<RequestIdentity>,
) -> Pin<Box<dyn Future<Output = Result<String, DaemonDispatchError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn pool_for_checkpoint(&self) -> Option<Arc<ConnectionPool>> { ... }
fn secondary_pools_for_checkpoint(&self) -> Vec<Arc<ConnectionPool>> { ... }
fn event_store_for_checkpoint(&self) -> Option<Arc<dyn EventStore>> { ... }
}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§
Sourcefn plan(&self, ops: &str) -> String
fn plan(&self, ops: &str) -> String
Describe syntax and loaded catalog membership without dispatching.
Sourcefn 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,
identity: Option<RequestIdentity>,
) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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,
identity: Option<RequestIdentity>,
) -> 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.
identity is the per-request identity context threaded from the frame
(ADR-096): Some(..) when serving a request forwarded over the
daemon socket (built from frame.namespace / frame.actor_id /
frame.visible_namespaces by the connection handler), None for any
other dispatch path. Implementors should mint the storage/gate token from
identity when present and fall back to their own construction-baked
identity when absent, so pure local (non-daemon) dispatch is unchanged.
Provided Methods§
Sourcefn idle_retirement_blockers(&self) -> Vec<String>
fn idle_retirement_blockers(&self) -> Vec<String>
Named retained resources or unknown inventory that prevents idle exit. An implementor must explicitly account for its resources before retiring.
Sourcefn request_read_timeout(&self, _ops: &str) -> Duration
fn request_read_timeout(&self, _ops: &str) -> Duration
Read-deadline ceiling for one request. The default is the operator ceiling; an implementor that understands the request may grant a longer bounded allowance (a long poll’s declared wait plus a margin).
Sourcefn dispatch_with_error_detail<'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,
identity: Option<RequestIdentity>,
) -> Pin<Box<dyn Future<Output = Result<String, DaemonDispatchError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn dispatch_with_error_detail<'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,
identity: Option<RequestIdentity>,
) -> Pin<Box<dyn Future<Output = Result<String, DaemonDispatchError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Preserve structured dispatch errors without breaking string-only implementors.
Sourcefn pool_for_checkpoint(&self) -> Option<Arc<ConnectionPool>>
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.
Sourcefn secondary_pools_for_checkpoint(&self) -> Vec<Arc<ConnectionPool>>
fn secondary_pools_for_checkpoint(&self) -> Vec<Arc<ConnectionPool>>
File-backed backend pools beyond Self::pool_for_checkpoint’s pool
(ADR-091 Amendment 3): one checkpoint task is spawned per entry here,
in addition to the one spawned for the primary pool, so a
multi-backend deployment gets PASSIVE/TRUNCATE checkpointing and
sidecar enumeration on every file-backed backend it wired, not only
the main one.
The default implementation returns an empty Vec — an implementor
with only one backend (or none) needs no override.
Sourcefn event_store_for_checkpoint(&self) -> Option<Arc<dyn EventStore>>
fn event_store_for_checkpoint(&self) -> Option<Arc<dyn EventStore>>
Return the audit EventStore the checkpoint task should append
ADR-094 lifecycle events (CheckpointOutcomeRecorded) to, if any.
Mirrors Self::pool_for_checkpoint’s default-None shape: an
implementor with no configured event store (or no pool at all) simply
gets a checkpoint task that never appends events — the checkpoint
task itself remains fully functional either way.
The default implementation returns None.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".