Skip to main content

Crate aura_composition

Crate aura_composition 

Source
Expand description

§Aura Composition - Layer 3: Implementation (Handler Composition)

Purpose: Assemble individual handlers into cohesive effect systems.

This crate provides effect handler composition, registry, and builder infrastructure for assembling stateless handlers from the effects crate into runnable effect systems.

§Architecture Constraints

Layer 3 depends only on aura-core and the effects implementations (foundation + implementation).

  • MUST handle composition of effect handlers (not implementation)
  • MUST provide registry and builder patterns for handler assembly
  • MUST manage effect system lifecycle (initialization, shutdown)
  • MUST NOT implement effect handlers (that’s the effects crate)
  • MUST NOT do multi-party coordination (that’s aura-protocol)
  • MUST NOT depend on domain crates or higher layers

§Key Components

  • EffectRegistry: Type-indexed storage of handler instances
  • EffectSystemBuilder: Builder pattern for composing handlers
  • EffectContainer: Runtime container managing handler lifecycle
  • Handler lifecycle management (start/stop/configure)

§What Belongs Here

Handler composition and assembly infrastructure:

  • Effect registry and lookup by type
  • Builder patterns for effect system construction
  • Handler composition utilities
  • Lifecycle management (initialization, shutdown)

§What Does NOT Belong Here

  • Individual handler implementations (that’s the effects crate)
  • Multi-party protocol logic (that’s aura-protocol)
  • Runtime-specific concerns like signal handling (that’s aura-agent)
  • Application lifecycle management (that’s aura-agent)

§Usage Pattern

Feature crates compose handlers without pulling in full runtime infrastructure:

use aura_composition::{EffectSystemBuilder};
use aura_effects::RealCryptoHandler;

let effects = EffectSystemBuilder::new()
    .with_handler(Arc::new(RealCryptoHandler::new()))
    .build()
    .await?;

Re-exports§

pub use registry::EffectCapability;
pub use registry::EffectRegistry;
pub use registry::Handler;
pub use registry::HandlerContext;
pub use registry::HandlerError;
pub use registry::RegisterAllOptions;
pub use registry::RegistrableHandler;
pub use registry::RegistryCapabilities;
pub use registry::RegistryError;
pub use composite::CompositeError;
pub use composite::CompositeHandler;
pub use composite::CompositeHandlerAdapter;
pub use composite::CompositeHandlerBuilder;
pub use adapters::ConsoleHandlerAdapter;
pub use adapters::CryptoHandlerAdapter;
pub use adapters::LoggingSystemHandlerAdapter;
pub use adapters::RandomHandlerAdapter;
pub use adapters::StorageHandlerAdapter;
pub use adapters::TimeHandlerAdapter;
pub use adapters::TraceHandlerAdapter;
pub use adapters::TransportHandlerAdapter;
pub use view_delta::compact_deltas;
pub use view_delta::downcast_delta;
pub use view_delta::downcast_delta_owned;
pub use view_delta::ComposableDelta;
pub use view_delta::IntoViewDelta;
pub use view_delta::ViewDelta;
pub use view_delta::ViewDeltaReducer;
pub use view_delta::ViewDeltaRegistry;

Modules§

adapters
Individual handler adapters for the composition system
composite
Composite Handler for combining multiple effect handlers
registry
Effect registry system for dynamic effect dispatch
view_delta
View Delta Reduction Infrastructure