Module runtime

Module runtime 

Source
Expand description

AlloraRuntime: aggregate of built runtime components (extensible).

Current contents:

  • channels: vector of in-memory channels (single kind)

Future extensions (not yet wired):

  • endpoints
  • filters / routers
  • adapters
  • correlation groups

Design goals:

  • Single return object from top-level build to avoid signature churn as components grow.
  • Provide accessor methods with owned + borrowed variants.
  • Keep internal storage concrete now; migrate to trait objects (ChannelRef) when multiple channel kinds arrive.

Backward compatibility note removed: prefer build() which returns AlloraRuntime.

§Overview

AlloraRuntime is the single return object from the top-level build() DSL facade. It bundles all instantiated runtime components derived from a configuration spec. Currently it only contains channels (in-memory kind); future releases will extend it with endpoints, filters/routers, adapters, and correlation utilities without changing the public build() signature.

§Guarantees

  • The collection of channels preserves the order they were defined in the source spec.
  • Channel IDs are unique (enforced at build time); missing IDs receive deterministic channel:auto.N identifiers within the same build invocation.
  • Lookup (channel_by_id) performs a linear scan; acceptable for small collections. This can be optimized later by introducing an internal index without API changes.

§Usage Example

use allora_core::Channel;
use allora_runtime::build;
// Requires a valid allora.yml at the given path.
let rt = build("tests/fixtures/allora.yml").unwrap();
assert!(rt.channel_by_id("inbound.orders").is_some());
for ch in rt.channels() { println!("id={}", ch.id()); }

§Future Extensions (Illustrative)

  • endpoints() -> &[Endpoint]
  • filters() / routers() -> pattern components
  • adapters() -> inbound / outbound integration points
  • correlations() -> tracking groups for aggregation patterns These will be added as additional fields with accessor methods while keeping AlloraRuntime construction centralized in the DSL facade.

Structs§

AlloraRuntime
Aggregated runtime container for all built components (channels today, more later).