pub trait Mode: Send + Sync {
// Required methods
fn on_session_start(
&self,
session: &Session,
env: &Envelope,
) -> Result<ModeResponse, MacpError>;
fn on_message(
&self,
session: &Session,
env: &Envelope,
) -> Result<ModeResponse, MacpError>;
// Provided method
fn authorize_sender(
&self,
session: &Session,
env: &Envelope,
) -> Result<(), MacpError> { ... }
}Expand description
Trait that coordination modes implement. Modes receive immutable session references and return a ModeResponse. The runtime kernel is responsible for applying the response.
Required Methods§
fn on_session_start( &self, session: &Session, env: &Envelope, ) -> Result<ModeResponse, MacpError>
fn on_message( &self, session: &Session, env: &Envelope, ) -> Result<ModeResponse, MacpError>
Provided Methods§
Authorize the sender for this message. Modes can override to customize authorization (e.g., allowing orchestrator bypass for Commitment messages).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".