Skip to main content

ProtocolObserver

Trait ProtocolObserver 

Source
pub trait ProtocolObserver: Send {
    // Required methods
    fn on_phase_start(&mut self, protocol: &str, role: &str, phase: &str);
    fn on_phase_end(&mut self, protocol: &str, role: &str, phase: &str);
    fn on_send(&mut self, from: &str, to: &str, msg_type: &str, size: usize);
    fn on_recv(&mut self, from: &str, to: &str, msg_type: &str, size: usize);
    fn on_choice(&mut self, decider: &str, branch: &str);
    fn on_offer(&mut self, from: &str, branch: &str);
    fn on_error(
        &mut self,
        protocol: &str,
        role: &str,
        error: &ChoreographyError,
    );
    fn on_complete(&mut self, protocol: &str, role: &str);
}
Expand description

Trait for observing protocol execution events.

Implementations can log events, collect metrics, or control simulation behavior based on observed events.

Required Methods§

Source

fn on_phase_start(&mut self, protocol: &str, role: &str, phase: &str)

Called when a protocol phase starts.

Source

fn on_phase_end(&mut self, protocol: &str, role: &str, phase: &str)

Called when a protocol phase ends.

Source

fn on_send(&mut self, from: &str, to: &str, msg_type: &str, size: usize)

Called when a message is sent.

Source

fn on_recv(&mut self, from: &str, to: &str, msg_type: &str, size: usize)

Called when a message is received.

Source

fn on_choice(&mut self, decider: &str, branch: &str)

Called when a choice is made (internal choice).

Source

fn on_offer(&mut self, from: &str, branch: &str)

Called when a choice is received (external choice).

Source

fn on_error(&mut self, protocol: &str, role: &str, error: &ChoreographyError)

Called when an error occurs.

Source

fn on_complete(&mut self, protocol: &str, role: &str)

Called when the protocol completes successfully.

Implementors§