Skip to main content

Module handler

Module handler 

Source
Expand description

Effect Handler Architecture for Choreographic Programming

This module provides a clean effect boundary between pure choreographic logic and runtime transport implementations. It allows for testable, composable, and runtime-agnostic protocol implementations.

§Architecture

The effect handler system separates concerns:

  • Choreographic Logic: Pure protocol specification (what to do)
  • Effect Handlers: Runtime implementation (how to do it)
  • Interpreters: Execute choreographic programs using handlers
  • Contract Profiles: Machine-checkable statements of semantic obligations versus transport-policy freedom, defined in effects::contract

§Example

use telltale_runtime::{ChoreoHandler, LabelId};

#[async_trait]
impl ChoreoHandler for MyHandler {
    type Role = MyRole;
    type Endpoint = MyEndpoint;

    async fn send<M>(&mut self, ep: &mut Self::Endpoint, to: Self::Role, msg: &M) -> Result<()> {
        // Implementation
    }
    // ... other methods
}

§ProtocolMachine Boundary

The bytecode ProtocolMachine in telltale-machine exposes a separate, synchronous EffectHandler trait for simulation/runtime integration. It is not interchangeable with ChoreoHandler: ChoreoHandler is async and typed over concrete message/role types, while the ProtocolMachine handler operates over bytecode values and must remain session-local for determinism.

Structs§

MessageTag
Typed message tag for receive effects.
NoOpHandler
A no-op handler for testing pure choreographic logic

Enums§

ChoreographyError
Errors that can occur during choreographic execution

Traits§

ChoreoHandler
The core effect handler trait that abstracts all communication effects
ChoreoHandlerExt
Extension trait for handler lifecycle management
ContextExt
Extension trait for adding context to Results.
Endpoint
Session endpoint trait
LabelId
Labels identify branches in internal/external choice.
RoleId
Trait for role identifiers in choreographies

Type Aliases§

ChoreoResult
Result type for choreography operations.