eventrail

Deterministic event bus and message trace library for MoonBit

event-bus
message-routing
dead-letter
retry
replay
diagnostics
moon add violetcb/eventrail@0.3.2
Download zip
Author
Version
0.3.2
License
MIT
Last updated
11 hours ago
Downloads
11
README

#EventRail

EventRail 是一个 MoonBit 原生的确定性事件总线与消息轨迹库,用于在测试工具、示例工程、Wasm 应用、业务规则原型和本地开发工具中建立可复现的事件流。

它解决的问题是:在不引入外部服务和复杂运行时的情况下,提供一套可注册订阅、按主题路由、批量校验与发布、记录投递结果、处理重试与死信、查询事件流、生成读模型投影、输出快照与诊断报告、执行事件保留策略、并支持事件回放的基础库。所有核心逻辑均使用 MoonBit 实现。

#适用场景

  • 开发工具中的进程内事件通知和插件消息分发;
  • WebAssembly 示例或教学项目中的事件流建模;
  • API 规则验证、任务编排、资源管线中的可复现 dispatch;
  • 单元测试中需要重放事件、检查死信、验证订阅顺序的场景;
  • 本地开发工具中需要批处理事件、预检订阅计划和导出调试 manifest 的场景。
  • 需要在 CI 或命令行中审计事件流健康状态、保留策略和处理流水线的场景。

#安装

发布后可通过 Mooncakes 包名安装:

moon add violetcb/eventrail

包名对应的 GitHub 仓库为 https://github.com/violetcb/eventrail

#最小示例

let payload = @eventrail.record_value([
@eventrail.field("order_id", @eventrail.text_value("A-1001")),
@eventrail.field("amount", @eventrail.int_value(320)),
])

let event = @eventrail.envelope("order.created", payload, timestamp_ms=20260809)

完整可运行示例:

moon run cmd/main

#核心功能

  • EventValue:支持 null、bool、int、text、list、record 的结构化消息载荷;
  • Envelope:事件 ID、topic、headers、attempt、trace 与稳定 fingerprint;
  • TopicPattern:支持 order.createdorder.*order.** 三类主题模式;
  • Bus:注册订阅、按优先级和匹配精度稳定排序、发布事件;
  • RetryPolicy:确定性的指数退避计划;
  • DeadLetter:失败超过最大尝试次数后进入死信记录;
  • EventTape:事件追加、去重压缩、按 pattern 选择、回放、manifest 导出;
  • EventBatch:批量事件过滤、topic 统计、fingerprint 去重、schema 校验、规则判断、路由预览和批量发布;
  • EventQuery:按 topic、header、timestamp、predicate 查询事件,并提供排序、分页和跳过原因;
  • EventPredicate / RuleSet:基于 topic、header、payload path 的事件规则过滤;
  • EventSchema:声明 topic 与 payload 字段合同,输出结构化校验报告;
  • ProjectionSpec / EventProjection:从 batch 或 tape 构建确定性读模型;
  • BusPlan:以可验证的订阅蓝图生成总线,并预览事件覆盖情况;
  • EventCursor / TapeWindow:对事件 tape 做分页读取和确定性恢复;
  • EventSnapshot / SnapshotDiff:汇总事件、topic、投递指标和订阅状态,并比较快照差异;
  • EventPipeline:组合 schema、rules、route、projection、snapshot 等阶段,生成流水线运行报告;
  • RetentionPolicy:按 topic、timestamp、全局数量、单 topic 数量和 fingerprint 压缩生成保留计划;
  • DiagnosticReport:对 bus、batch、schema、rules、snapshot、pipeline、retention 输出统一健康诊断;
  • DeliveryMode:支持 fanout 和 consumer-group 首选投递;
  • RouteExplanation / BusAudit:输出路由诊断和订阅健康检查结果;
  • DeliveryStats:按总线、发布报告、topic、subscription 汇总投递指标;
  • Outbox:将 retry 投递结果转为可 drain/reschedule 的延迟事件队列;
  • PublishReport / ReplayReport:可用于测试和命令行输出的执行摘要。

#支持范围

  • 进程内事件路由;
  • 确定性主题匹配;
  • 同步 handler 结果建模;
  • 重试计划与死信记录;
  • 规则过滤和延迟重试 outbox;
  • schema 校验、路由诊断、consumer-group 投递、投递指标统计和统一诊断报告;
  • 批量事件校验、批量发布、查询分页、读模型投影、订阅计划预检;
  • 快照导出、快照差异比较、保留策略预览和流水线运行报告;
  • 事件回放、分页读取和统计;
  • wasm 默认 target 下的构建、测试与示例运行。

#暂不支持范围

  • 网络消息队列协议;
  • 多线程调度;
  • 持久化数据库;
  • cron 或真实时间调度;
  • JSON/TOML/YAML 文件解析;
  • 分布式一致性协议。

#本地验收命令

moon fmt --check moon check moon check --deny-warn moon build moon test moon test --deny-warn moon info moon run cmd/main moon package

当前核心库有效 MoonBit 代码已超过 4000 行参考规模,测试覆盖核心路径、错误路径和事件流扩展能力:

  • topic pattern、payload path、schema、rules;
  • fanout / consumer-group 路由、retry、dead letter、outbox;
  • EventTape replay、manifest、cursor window;
  • EventBatch validate / route preview / publish / compact / topic counts;
  • EventProjection 聚合和缺失 key 诊断;
  • BusPlan 配置预检和覆盖率预览;
  • EventQuery 查询、排序、分页与跳过原因;
  • EventSnapshot 汇总、订阅指标和差异比较;
  • EventPipeline 阶段运行报告;
  • RetentionPolicy 保留计划与 EventBatch/EventTape 应用;
  • DiagnosticReport 统一健康诊断。

Mooncakes owner、包名和 GitHub 仓库配置均为 violetcb/eventrail。当前发布版本为 0.3.2

#Mooncakes 包名

工程包名为:

violetcb/eventrail

对应 Mooncakes 文档地址为 https://mooncakes.io/docs/violetcb/eventrail

#开源许可证与来源说明

本项目采用 MIT License。项目为原创 MoonBit 实现,不移植第三方源码,不包含图片、音频、字体或外部测试数据。CI 中使用 MoonBit 官方安装脚本安装工具链。

#
BatchDecision

pub(all) struct BatchDecision {
index : Int
event_id : String
topic : String
decision : RuleDecision
} derive(Eq,
Debug
)

#
BatchDecision::to_wire

fn BatchDecision::to_wire(self : BatchDecision) -> String

#
BatchPublishReport

pub(all) struct BatchPublishReport {
name : String
events : Int
routed_events : Int
unmatched_events : Int
deliveries : Int
dead_letters_added : Int
lines : Array[String]
} derive(Eq,
Debug
)

#
BatchPublishReport::manifest

fn BatchPublishReport::manifest(self : BatchPublishReport) -> String

#
BatchPublishReport::summary

fn BatchPublishReport::summary(self : BatchPublishReport) -> String

#
BatchRouteReport

pub(all) struct BatchRouteReport {
name : String
events : Int
routed_events : Int
unmatched_events : Int
deliveries_planned : Int
rows : Array[BatchRouteRow]
} derive(Eq,
Debug
)

#
BatchRouteReport::route_lines

fn BatchRouteReport::route_lines(self : BatchRouteReport) -> Array[String]

#
BatchRouteReport::summary

fn BatchRouteReport::summary(self : BatchRouteReport) -> String

#
BatchRouteRow

pub(all) struct BatchRouteRow {
index : Int
event_id : String
topic : String
routed : Int
selected : Array[String]
} derive(Eq,
Debug
)

#
BatchRouteRow::to_wire

fn BatchRouteRow::to_wire(self : BatchRouteRow) -> String

#
BatchRuleReport

pub(all) struct BatchRuleReport {
name : String
checked : Int
accepted : Int
rejected : Int
decisions : Array[BatchDecision]
} derive(Eq,
Debug
)

#
BatchRuleReport::decision_lines

fn BatchRuleReport::decision_lines(self : BatchRuleReport) -> Array[String]

#
BatchRuleReport::summary

fn BatchRuleReport::summary(self : BatchRuleReport) -> String

#
BatchTopicCount

pub(all) struct BatchTopicCount {
topic : String
count : Int
first_index : Int
last_index : Int
} derive(Eq,
Debug
)

#
BatchTopicCount::to_wire

fn BatchTopicCount::to_wire(self : BatchTopicCount) -> String

#
BatchValidationIssue

pub(all) struct BatchValidationIssue {
index : Int
event_id : String
topic : String
schema : String
path : String
code : String
message : String
} derive(Eq,
Debug
)

#
BatchValidationIssue::to_wire

fn BatchValidationIssue::to_wire(self : BatchValidationIssue) -> String

#
BatchValidationReport

pub(all) struct BatchValidationReport {
name : String
checked : Int
valid : Int
invalid : Int
issues : Array[BatchValidationIssue]
} derive(Eq,
Debug
)

#
BatchValidationReport::issue_lines

fn BatchValidationReport::issue_lines(self : BatchValidationReport) -> Array[String]

#
BatchValidationReport::summary

fn BatchValidationReport::summary(self : BatchValidationReport) -> String

#
Bus

pub(all) struct Bus {
subscriptions : Array[Subscription]
deliveries : Array[Delivery]
dead_letters : Array[DeadLetter]
} derive(Eq,
Debug
)

#
Bus::audit

fn Bus::audit(self : Bus) -> BusAudit

#
Bus::dead_letter_count

fn Bus::dead_letter_count(self : Bus) -> Int

#
Bus::dead_letters_for_subscription

fn Bus::dead_letters_for_subscription(self : Bus, subscription_id : StringView) -> Array[DeadLetter]

#
Bus::deliveries_for_subscription

fn Bus::deliveries_for_subscription(self : Bus, subscription_id : StringView) -> Array[Delivery]

#
Bus::deliveries_for_topic

fn Bus::deliveries_for_topic(self : Bus, topic : StringView) -> Array[Delivery]

#
Bus::delivery_count

fn Bus::delivery_count(self : Bus) -> Int

#
Bus::delivery_stats

fn Bus::delivery_stats(self : Bus) -> DeliveryStats

#
Bus::explain

fn Bus::explain(self : Bus, event : Envelope, mode? : DeliveryMode) -> Result[RouteExplanation, EventRailError]

#
Bus::has_subscription

fn Bus::has_subscription(self : Bus, id : StringView) -> Bool

#
Bus::last_delivery_for_subscription

fn Bus::last_delivery_for_subscription(self : Bus, subscription_id : StringView) -> Delivery?

#
Bus::publish

fn Bus::publish(self : Bus, event : Envelope, handler : (Subscription, Envelope) -> HandlerResult) -> Result[(Bus, PublishReport), EventRailError]

#
Bus::publish_with_mode

fn Bus::publish_with_mode(self : Bus, event : Envelope, mode : DeliveryMode, handler : (Subscription, Envelope) -> HandlerResult) -> Result[(Bus, PublishReport), EventRailError]

#
Bus::route

fn Bus::route(self : Bus, event : Envelope) -> Result[Array[Subscription], EventRailError]

#
Bus::route_with_mode

fn Bus::route_with_mode(self : Bus, event : Envelope, mode : DeliveryMode) -> Result[Array[Subscription], EventRailError]

#
Bus::size

fn Bus::size(self : Bus) -> Int

#
Bus::subscribe

fn Bus::subscribe(self : Bus, id : StringView, pattern : StringView, priority? : Int, group? : StringView, retry? : RetryPolicy, enabled? : Bool, guards? : ArrayView[EventPredicate]) -> Result[Bus, EventRailError]

#
Bus::subscription_delivery_stats

fn Bus::subscription_delivery_stats(self : Bus) -> Array[SubscriptionDeliveryStats]

#
Bus::topic_delivery_stats

fn Bus::topic_delivery_stats(self : Bus) -> Array[TopicDeliveryStats]

#
BusAudit

pub(all) struct BusAudit {
subscriptions : Int
enabled : Int
disabled : Int
groups : Int
guarded : Int
issues : Array[String]
} derive(Eq,
Debug
)

#
BusPlan

pub(all) struct BusPlan {
name : String
subscriptions : Array[SubscriptionBlueprint]
} derive(Eq,
Debug
)

#
BusPlan::add

fn BusPlan::add(self : BusPlan, blueprint : SubscriptionBlueprint) -> BusPlan

#
BusPlan::build

fn BusPlan::build(self : BusPlan) -> Result[(Bus, PlanBuildReport), EventRailError]

#
BusPlan::coverage

fn BusPlan::coverage(self : BusPlan, events : ArrayView[Envelope], mode? : DeliveryMode) -> Result[PlanCoverageReport, EventRailError]

#
BusPlan::is_empty

fn BusPlan::is_empty(self : BusPlan) -> Bool

#
BusPlan::len

fn BusPlan::len(self : BusPlan) -> Int

#
BusPlan::manifest

fn BusPlan::manifest(self : BusPlan) -> String

#
BusPlan::validate

fn BusPlan::validate(self : BusPlan) -> Array[PlanIssue]

#
DeadLetter

pub(all) struct DeadLetter {
event_id : String
subscription_id : String
topic : String
reason : String
attempt : Int
trace : Array[String]
} derive(Eq,
Debug
)

#
Delivery

pub(all) struct Delivery {
event_id : String
subscription_id : String
topic : String
status : DeliveryStatus
attempt : Int
delay_ms : Int
} derive(Eq,
Debug
)

#
DeliveryMode

pub(all) enum DeliveryMode {
Fanout
FirstPerGroup
} derive(Eq,
Debug
)

#
DeliveryMode::to_wire

fn DeliveryMode::to_wire(self : DeliveryMode) -> String

#
DeliveryStats

pub(all) struct DeliveryStats {
total : Int
delivered : Int
dropped : Int
retry_scheduled : Int
dead_lettered : Int
} derive(Eq,
Debug
)

#
DeliveryStats::failure_count

fn DeliveryStats::failure_count(self : DeliveryStats) -> Int

#
DeliveryStats::is_clean

fn DeliveryStats::is_clean(self : DeliveryStats) -> Bool

#
DeliveryStats::record

#
DeliveryStats::to_wire

fn DeliveryStats::to_wire(self : DeliveryStats) -> String

#
DeliveryStatus

pub(all) enum DeliveryStatus {
Delivered(String)
Dropped(String)
RetryScheduled(String)
DeadLettered(String)
} derive(Eq,
Debug
)

#
DeliveryStatus::to_wire

fn DeliveryStatus::to_wire(self : DeliveryStatus) -> String

#
DiagnosticEntry

pub(all) struct DiagnosticEntry {
severity : DiagnosticSeverity
code : String
subject : String
message : String
} derive(Eq,
Debug
)

#
DiagnosticEntry::to_wire

fn DiagnosticEntry::to_wire(self : DiagnosticEntry) -> String

#
DiagnosticReport

pub(all) struct DiagnosticReport {
name : String
checked : Int
infos : Int
warnings : Int
errors : Int
entries : Array[DiagnosticEntry]
} derive(Eq,
Debug
)

#
DiagnosticReport::add

fn DiagnosticReport::add(self : DiagnosticReport, severity : DiagnosticSeverity, code : StringView, subject : StringView, message : StringView) -> DiagnosticReport

#
DiagnosticReport::codes

fn DiagnosticReport::codes(self : DiagnosticReport) -> Array[String]

#
DiagnosticReport::error

fn DiagnosticReport::error(self : DiagnosticReport, code : StringView, subject : StringView, message : StringView) -> DiagnosticReport

#
DiagnosticReport::has_warnings

fn DiagnosticReport::has_warnings(self : DiagnosticReport) -> Bool

#
DiagnosticReport::info

fn DiagnosticReport::info(self : DiagnosticReport, code : StringView, subject : StringView, message : StringView) -> DiagnosticReport

#
DiagnosticReport::lines

fn DiagnosticReport::lines(self : DiagnosticReport) -> Array[String]

#
DiagnosticReport::manifest

fn DiagnosticReport::manifest(self : DiagnosticReport) -> String

#
DiagnosticReport::manifest_lines

fn DiagnosticReport::manifest_lines(self : DiagnosticReport) -> Array[String]

#
DiagnosticReport::merge

#
DiagnosticReport::ok

fn DiagnosticReport::ok(self : DiagnosticReport) -> Bool

#
DiagnosticReport::summary

fn DiagnosticReport::summary(self : DiagnosticReport) -> String

#
DiagnosticReport::warning

fn DiagnosticReport::warning(self : DiagnosticReport, code : StringView, subject : StringView, message : StringView) -> DiagnosticReport

#
DiagnosticSeverity

pub(all) enum DiagnosticSeverity {
DiagnosticInfo
DiagnosticWarning
DiagnosticError
} derive(Eq,
Debug
)

#
DiagnosticSeverity::to_wire

fn DiagnosticSeverity::to_wire(self : DiagnosticSeverity) -> String

#
Envelope

pub(all) struct Envelope {
id : String
topic : String
payload : EventValue
headers : Array[Pair]
timestamp_ms : Int
attempt : Int
trace : Array[String]
} derive(Eq,
Debug
)

Event envelope routed through the bus.

#
Envelope::add_trace

fn Envelope::add_trace(self : Envelope, step : StringView) -> Envelope

#
Envelope::fingerprint

fn Envelope::fingerprint(self : Envelope) -> String

#
Envelope::header

fn Envelope::header(self : Envelope, key : StringView) -> String?

#
Envelope::next_attempt

fn Envelope::next_attempt(self : Envelope) -> Envelope

#
Envelope::payload_path

fn Envelope::payload_path(self : Envelope, path : StringView) -> EventValue?

#
Envelope::summary

fn Envelope::summary(self : Envelope) -> String

#
Envelope::with_header

fn Envelope::with_header(self : Envelope, key : StringView, value : StringView) -> Envelope

#
EventBatch

pub(all) struct EventBatch {
name : String
events : Array[Envelope]
} derive(Eq,
Debug
)

#
EventBatch::append

fn EventBatch::append(self : EventBatch, event : Envelope) -> EventBatch

#
EventBatch::append_many

fn EventBatch::append_many(self : EventBatch, events : ArrayView[Envelope]) -> EventBatch

#
EventBatch::apply_retention

fn EventBatch::apply_retention(self : EventBatch, policy : RetentionPolicy) -> Result[(EventBatch, RetentionReport), EventRailError]

#
EventBatch::compact_by_fingerprint

fn EventBatch::compact_by_fingerprint(self : EventBatch) -> EventBatch

#
EventBatch::evaluate_rules

fn EventBatch::evaluate_rules(self : EventBatch, rules : RuleSet) -> BatchRuleReport

#
EventBatch::filter

fn EventBatch::filter(self : EventBatch, pattern : StringView) -> Result[EventBatch, EventRailError]

#
EventBatch::fingerprints

fn EventBatch::fingerprints(self : EventBatch) -> Array[String]

#
EventBatch::is_empty

fn EventBatch::is_empty(self : EventBatch) -> Bool

#
EventBatch::len

fn EventBatch::len(self : EventBatch) -> Int

#
EventBatch::manifest

fn EventBatch::manifest(self : EventBatch) -> String

#
EventBatch::manifest_lines

fn EventBatch::manifest_lines(self : EventBatch) -> Array[String]

#
EventBatch::project

fn EventBatch::project(self : EventBatch, spec : ProjectionSpec) -> Result[EventProjection, EventRailError]

#
EventBatch::publish

fn EventBatch::publish(self : EventBatch, bus : Bus, handler : (Subscription, Envelope) -> HandlerResult, mode? : DeliveryMode) -> Result[(Bus, BatchPublishReport), EventRailError]

#
EventBatch::query

fn EventBatch::query(self : EventBatch, query : EventQuery) -> Result[QueryResult, EventRailError]

#
EventBatch::retention_plan

fn EventBatch::retention_plan(self : EventBatch, policy : RetentionPolicy) -> Result[RetentionReport, EventRailError]

#
EventBatch::route_preview

fn EventBatch::route_preview(self : EventBatch, bus : Bus, mode? : DeliveryMode) -> Result[BatchRouteReport, EventRailError]

#
EventBatch::snapshot

fn EventBatch::snapshot(self : EventBatch, bus : Bus, name? : StringView, timestamp_ms? : Int) -> EventSnapshot

#
EventBatch::sort_by_timestamp

fn EventBatch::sort_by_timestamp(self : EventBatch) -> EventBatch

#
EventBatch::to_tape

fn EventBatch::to_tape(self : EventBatch) -> EventTape

#
EventBatch::topic_counts

fn EventBatch::topic_counts(self : EventBatch) -> Array[BatchTopicCount]

#
EventBatch::validate

fn EventBatch::validate(self : EventBatch, schema : EventSchema) -> BatchValidationReport

#
EventBatch::with_name

fn EventBatch::with_name(self : EventBatch, name : StringView) -> EventBatch

#
EventCursor

pub(all) struct EventCursor {
start_sequence : Int
limit : Int
pattern : String
} derive(Eq,
Debug
)

#
EventCursor::next_from

fn EventCursor::next_from(self : EventCursor, sequence : Int) -> EventCursor

#
EventCursor::to_wire

fn EventCursor::to_wire(self : EventCursor) -> String

#
EventCursor::with_limit

fn EventCursor::with_limit(self : EventCursor, limit : Int) -> EventCursor

#
EventCursor::with_pattern

fn EventCursor::with_pattern(self : EventCursor, pattern : StringView) -> EventCursor

#
EventDigest

pub(all) struct EventDigest {
index : Int
event_id : String
topic : String
timestamp_ms : Int
attempt : Int
fingerprint : String
header_count : Int
trace_count : Int
payload_fields : Int
} derive(Eq,
Debug
)

#
EventDigest::to_wire

fn EventDigest::to_wire(self : EventDigest) -> String

#
EventPipeline

pub(all) struct EventPipeline {
name : String
batch : EventBatch
actions : Array[PipelineAction]
} derive(Eq,
Debug
)

#
EventPipeline::add

#
EventPipeline::describe

fn EventPipeline::describe(self : EventPipeline) -> String

#
EventPipeline::is_empty

fn EventPipeline::is_empty(self : EventPipeline) -> Bool

#
EventPipeline::len

fn EventPipeline::len(self : EventPipeline) -> Int

#
EventPipeline::run

#
EventPredicate

pub(all) enum EventPredicate {
TopicMatches(String)
HeaderEquals(String, String)
HeaderExists(String)
PayloadExists(String)
TextEquals(String, String)
TextContains(String, String)
IntAtLeast(String, Int)
IntAtMost(String, Int)
IntBetween(String, Int, Int)
BoolEquals(String, Bool)
AllOf(Array[EventPredicate])
AnyOf(Array[EventPredicate])
Not(EventPredicate)
} derive(Eq,
Debug
)

#
EventPredicate::evaluate

fn EventPredicate::evaluate(self : EventPredicate, event : Envelope) -> RuleResult

#
EventProjection

pub(all) struct EventProjection {
spec : ProjectionSpec
rows : Array[ProjectionRow]
skipped : Int
issues : Array[ProjectionIssue]
} derive(Eq,
Debug
)

#
EventProjection::apply

#
EventProjection::find

fn EventProjection::find(self : EventProjection, key : StringView) -> ProjectionRow?

#
EventProjection::is_empty

fn EventProjection::is_empty(self : EventProjection) -> Bool

#
EventProjection::issue_lines

fn EventProjection::issue_lines(self : EventProjection) -> Array[String]

#
EventProjection::len

fn EventProjection::len(self : EventProjection) -> Int

#
EventProjection::manifest

fn EventProjection::manifest(self : EventProjection) -> String

#
EventProjection::manifest_lines

fn EventProjection::manifest_lines(self : EventProjection) -> Array[String]

#
EventProjection::summary

fn EventProjection::summary(self : EventProjection) -> String

#
EventQuery

pub(all) struct EventQuery {
name : String
topic : TopicPattern?
headers : Array[HeaderFilter]
predicates : Array[EventPredicate]
min_timestamp_ms : Int?
max_timestamp_ms : Int?
offset : Int
limit : Int
sort : QuerySort
} derive(Eq,
Debug
)

#
EventQuery::apply

fn EventQuery::apply(self : EventQuery, events : ArrayView[Envelope]) -> Result[QueryResult, EventRailError]

#
EventQuery::matches

fn EventQuery::matches(self : EventQuery, event : Envelope) -> Result[(Bool, String), EventRailError]

#
EventQuery::to_wire

fn EventQuery::to_wire(self : EventQuery) -> String

#
EventQuery::with_header

fn EventQuery::with_header(self : EventQuery, key : StringView, value? : StringView) -> EventQuery

#
EventQuery::with_page

fn EventQuery::with_page(self : EventQuery, offset : Int, limit : Int) -> EventQuery

#
EventQuery::with_predicate

fn EventQuery::with_predicate(self : EventQuery, predicate : EventPredicate) -> EventQuery

#
EventQuery::with_sort

fn EventQuery::with_sort(self : EventQuery, sort : QuerySort) -> EventQuery

#
EventQuery::with_time_range

fn EventQuery::with_time_range(self : EventQuery, min_timestamp_ms? : Int, max_timestamp_ms? : Int) -> EventQuery

#
EventQuery::with_topic

fn EventQuery::with_topic(self : EventQuery, topic : StringView) -> Result[EventQuery, EventRailError]

#
EventQuery::without_topic

fn EventQuery::without_topic(self : EventQuery) -> EventQuery

#
EventRailError

pub(all) enum EventRailError {
EmptyTopic
EmptyPattern
EmptySegment(String)
InvalidPattern(String)
InvalidSubscription(String)
DuplicateSubscription(String)
MissingField(String)
HandlerFailure(String)
RetryLimitReached(String)
} derive(Eq,
Debug
)

Error values returned by EventRail builders and validators.

#
EventRailError::is_configuration_error

fn EventRailError::is_configuration_error(self : EventRailError) -> Bool

#
EventRailError::message

fn EventRailError::message(self : EventRailError) -> String

#
EventSchema

pub(all) struct EventSchema {
name : String
topic : TopicPattern?
fields : Array[FieldSpec]
} derive(Eq,
Debug
)

#
EventSchema::validate

fn EventSchema::validate(self : EventSchema, event : Envelope) -> SchemaReport

#
EventSnapshot

pub(all) struct EventSnapshot {
name : String
source : String
timestamp_ms : Int
event_count : Int
delivery_count : Int
dead_letter_count : Int
digests : Array[EventDigest]
topic_counts : Array[TopicCount]
delivery_stats : DeliveryStats
subscription_stats : Array[SnapshotDeliveryRow]
} derive(Eq,
Debug
)

#
EventSnapshot::diff

#
EventSnapshot::event_ids

fn EventSnapshot::event_ids(self : EventSnapshot) -> Array[String]

#
EventSnapshot::find_event

fn EventSnapshot::find_event(self : EventSnapshot, event_id : StringView) -> EventDigest?

#
EventSnapshot::manifest

fn EventSnapshot::manifest(self : EventSnapshot) -> String

#
EventSnapshot::manifest_lines

fn EventSnapshot::manifest_lines(self : EventSnapshot) -> Array[String]

#
EventSnapshot::subscription_stats_for

fn EventSnapshot::subscription_stats_for(self : EventSnapshot, subscription_id : StringView) -> DeliveryStats?

#
EventSnapshot::summary

fn EventSnapshot::summary(self : EventSnapshot) -> String

#
EventSnapshot::topic_count

fn EventSnapshot::topic_count(self : EventSnapshot, topic : StringView) -> Int

#
EventTape

pub(all) struct EventTape {
entries : Array[TapeEntry]
next_sequence : Int
} derive(Eq,
Debug
)

#
EventTape::append

fn EventTape::append(self : EventTape, event : Envelope) -> EventTape

#
EventTape::append_many

fn EventTape::append_many(self : EventTape, events : ArrayView[Envelope]) -> EventTape

#
EventTape::apply_retention

fn EventTape::apply_retention(self : EventTape, policy : RetentionPolicy) -> Result[(EventTape, RetentionReport), EventRailError]

#
EventTape::compact_by_fingerprint

fn EventTape::compact_by_fingerprint(self : EventTape) -> EventTape

#
EventTape::is_empty

fn EventTape::is_empty(self : EventTape) -> Bool

#
EventTape::len

fn EventTape::len(self : EventTape) -> Int

#
EventTape::manifest

fn EventTape::manifest(self : EventTape) -> String

#
EventTape::page_count

fn EventTape::page_count(self : EventTape, limit : Int) -> Int

#
EventTape::project

fn EventTape::project(self : EventTape, spec : ProjectionSpec) -> Result[EventProjection, EventRailError]

#
EventTape::query

fn EventTape::query(self : EventTape, query : EventQuery) -> Result[QueryResult, EventRailError]

#
EventTape::replay

fn EventTape::replay(self : EventTape, bus : Bus, handler : (Subscription, Envelope) -> HandlerResult) -> Result[(Bus, ReplayReport), EventRailError]

#
EventTape::retention_plan

fn EventTape::retention_plan(self : EventTape, policy : RetentionPolicy) -> Result[RetentionReport, EventRailError]

#
EventTape::select

fn EventTape::select(self : EventTape, pattern : StringView) -> Result[Array[Envelope], EventRailError]

#
EventTape::snapshot

fn EventTape::snapshot(self : EventTape, bus : Bus, name? : StringView, timestamp_ms? : Int) -> EventSnapshot

#
EventTape::to_manifest_lines

fn EventTape::to_manifest_lines(self : EventTape) -> Array[String]

#
EventTape::topic_counts

fn EventTape::topic_counts(self : EventTape) -> Array[TopicCount]

#
EventTape::window

fn EventTape::window(self : EventTape, cursor : EventCursor) -> Result[TapeWindow, EventRailError]

#
EventValue

pub(all) enum EventValue {
VNull
VBool(Bool)
VInt(Int)
VText(String)
VList(Array[EventValue])
VRecord(Array[(String, EventValue)])
} derive(Eq,
Debug
)

Structured event payload. Records keep declaration order so exported snapshots stay deterministic across targets and test runs.

#
EventValue::as_bool

fn EventValue::as_bool(self : EventValue) -> Bool?

#
EventValue::as_int

fn EventValue::as_int(self : EventValue) -> Int?

#
EventValue::as_text

fn EventValue::as_text(self : EventValue) -> String?

#
EventValue::field_count

fn EventValue::field_count(self : EventValue) -> Int

#
EventValue::get

fn EventValue::get(self : EventValue, key : StringView) -> EventValue?

#
EventValue::get_path

fn EventValue::get_path(self : EventValue, path : StringView) -> EventValue?

#
EventValue::is_scalar

fn EventValue::is_scalar(self : EventValue) -> Bool

#
EventValue::list_count

fn EventValue::list_count(self : EventValue) -> Int

#
EventValue::require_path

fn EventValue::require_path(self : EventValue, path : StringView) -> Result[EventValue, EventRailError]

#
EventValue::to_wire

fn EventValue::to_wire(self : EventValue) -> String

#
FieldSpec

pub(all) struct FieldSpec {
path : String
kind : ValueKind
required : Bool
min_int : Int?
max_int : Int?
min_len : Int?
max_len : Int?
} derive(Eq,
Debug
)

#
HandlerResult

pub(all) enum HandlerResult {
HandlerAck(String)
HandlerDrop(String)
HandlerRetry(String)
HandlerFail(String)
} derive(Eq,
Debug
)

#
HeaderFilter

pub(all) struct HeaderFilter {
key : String
value : String?
} derive(Eq,
Debug
)

#
HeaderFilter::to_wire

fn HeaderFilter::to_wire(self : HeaderFilter) -> String

#
MatchReport

pub(all) struct MatchReport {
pattern : String
topic : String
matched : Bool
specificity : Int
topic_segments : Int
} derive(Eq,
Debug
)

#
Outbox

pub(all) struct Outbox {
scheduled : Array[ScheduledEvent]
} derive(Eq,
Debug
)

#
Outbox::drain_due

fn Outbox::drain_due(self : Outbox, now_ms : Int) -> OutboxDrain

#
Outbox::drop_subscription

fn Outbox::drop_subscription(self : Outbox, subscription_id : StringView) -> Outbox

#
Outbox::due

fn Outbox::due(self : Outbox, now_ms : Int) -> Array[ScheduledEvent]

#
Outbox::from_report

fn Outbox::from_report(self : Outbox, event : Envelope, report : PublishReport, now_ms : Int) -> Outbox

#
Outbox::is_empty

fn Outbox::is_empty(self : Outbox) -> Bool

#
Outbox::len

fn Outbox::len(self : Outbox) -> Int

#
Outbox::manifest

fn Outbox::manifest(self : Outbox) -> String

#
Outbox::push

fn Outbox::push(self : Outbox, item : ScheduledEvent) -> Outbox

#
Outbox::reschedule_all

fn Outbox::reschedule_all(self : Outbox, delta_ms : Int) -> Outbox

#
OutboxDrain

pub(all) struct OutboxDrain {
due : Array[ScheduledEvent]
remaining : Outbox
} derive(Eq,
Debug
)

#
OutboxDrain::summary

fn OutboxDrain::summary(self : OutboxDrain) -> String

#
Pair

pub(all) struct Pair {
key : String
value : String
} derive(Eq,
Debug
)

Ordered key-value pair used by record payloads and event headers.

#
PipelineAction

pub(all) enum PipelineAction {
PipelineValidate(EventSchema)
PipelineRules(RuleSet)
PipelineRoute(Bus, DeliveryMode)
PipelineProject(ProjectionSpec)
PipelineSnapshot(Bus)
} derive(Eq,
Debug
)

#
PipelineAction::to_wire

fn PipelineAction::to_wire(self : PipelineAction) -> String

#
PipelineRun

pub(all) struct PipelineRun {
name : String
stages : Array[PipelineStage]
passed : Int
failed : Int
warnings : Int
} derive(Eq,
Debug
)

#
PipelineRun::failed_stages

fn PipelineRun::failed_stages(self : PipelineRun) -> Array[PipelineStage]

#
PipelineRun::manifest

fn PipelineRun::manifest(self : PipelineRun) -> String

#
PipelineRun::manifest_lines

fn PipelineRun::manifest_lines(self : PipelineRun) -> Array[String]

#
PipelineRun::ok

fn PipelineRun::ok(self : PipelineRun) -> Bool

#
PipelineRun::summary

fn PipelineRun::summary(self : PipelineRun) -> String

#
PipelineRun::warning_stages

fn PipelineRun::warning_stages(self : PipelineRun) -> Array[PipelineStage]

#
PipelineStage

pub(all) struct PipelineStage {
index : Int
action : PipelineAction
status : PipelineStageStatus
summary : String
lines : Array[String]
} derive(Eq,
Debug
)

#
PipelineStage::to_wire

fn PipelineStage::to_wire(self : PipelineStage) -> String

#
PipelineStageStatus

pub(all) enum PipelineStageStatus {
StagePassed
StageFailed
StageWarning
} derive(Eq,
Debug
)

#
PipelineStageStatus::to_wire

fn PipelineStageStatus::to_wire(self : PipelineStageStatus) -> String

#
PlanBuildReport

pub(all) struct PlanBuildReport {
name : String
subscriptions : Int
enabled : Int
groups : Int
guarded : Int
issues : Array[PlanIssue]
} derive(Eq,
Debug
)

#
PlanBuildReport::issue_lines

fn PlanBuildReport::issue_lines(self : PlanBuildReport) -> Array[String]

#
PlanBuildReport::summary

fn PlanBuildReport::summary(self : PlanBuildReport) -> String

#
PlanCoverageReport

pub(all) struct PlanCoverageReport {
name : String
events : Int
matched : Int
unmatched : Int
deliveries_planned : Int
rows : Array[PlanCoverageRow]
issues : Array[PlanIssue]
} derive(Eq,
Debug
)

#
PlanCoverageReport::coverage_lines

fn PlanCoverageReport::coverage_lines(self : PlanCoverageReport) -> Array[String]

#
PlanCoverageReport::summary

fn PlanCoverageReport::summary(self : PlanCoverageReport) -> String

#
PlanCoverageRow

pub(all) struct PlanCoverageRow {
index : Int
event_id : String
topic : String
selected : Array[String]
} derive(Eq,
Debug
)

#
PlanCoverageRow::to_wire

fn PlanCoverageRow::to_wire(self : PlanCoverageRow) -> String

#
PlanIssue

pub(all) struct PlanIssue {
severity : PlanSeverity
code : String
message : String
} derive(Eq,
Debug
)

#
PlanIssue::to_wire

fn PlanIssue::to_wire(self : PlanIssue) -> String

#
PlanSeverity

pub(all) enum PlanSeverity {
PlanInfo
PlanWarning
PlanError
} derive(Eq,
Debug
)

#
PlanSeverity::to_wire

fn PlanSeverity::to_wire(self : PlanSeverity) -> String

#
ProjectionIssue

pub(all) struct ProjectionIssue {
event_id : String
topic : String
code : String
message : String
} derive(Eq,
Debug
)

#
ProjectionIssue::to_wire

fn ProjectionIssue::to_wire(self : ProjectionIssue) -> String

#
ProjectionRow

pub(all) struct ProjectionRow {
key : String
topic : String
count : Int
first_timestamp_ms : Int
last_timestamp_ms : Int
last_event_id : String
fields : Array[Pair]
} derive(Eq,
Debug
)

#
ProjectionRow::field

fn ProjectionRow::field(self : ProjectionRow, key : StringView) -> String?

#
ProjectionRow::to_wire

fn ProjectionRow::to_wire(self : ProjectionRow) -> String

#
ProjectionSpec

pub(all) struct ProjectionSpec {
name : String
topic : TopicPattern
key_path : String
include_paths : Array[String]
require_key : Bool
} derive(Eq,
Debug
)

#
ProjectionSpec::empty

#
ProjectionSpec::project_events

fn ProjectionSpec::project_events(self : ProjectionSpec, events : ArrayView[Envelope]) -> Result[EventProjection, EventRailError]

#
PublishReport

pub(all) struct PublishReport {
event_id : String
topic : String
routed : Int
deliveries : Array[Delivery]
dead_letters_added : Int
} derive(Eq,
Debug
)

#
PublishReport::delivery_stats

fn PublishReport::delivery_stats(self : PublishReport) -> DeliveryStats

#
PublishReport::status_line

fn PublishReport::status_line(self : PublishReport) -> String

#
QueryResult

pub(all) struct QueryResult {
name : String
scanned : Int
matched_before_page : Int
returned : Int
skipped : Array[QuerySkip]
rows : Array[QueryRow]
} derive(Eq,
Debug
)

#
QueryResult::events

fn QueryResult::events(self : QueryResult) -> Array[Envelope]

#
QueryResult::is_empty

fn QueryResult::is_empty(self : QueryResult) -> Bool

#
QueryResult::manifest

fn QueryResult::manifest(self : QueryResult) -> String

#
QueryResult::manifest_lines

fn QueryResult::manifest_lines(self : QueryResult) -> Array[String]

#
QueryResult::skip_lines

fn QueryResult::skip_lines(self : QueryResult) -> Array[String]

#
QueryResult::summary

fn QueryResult::summary(self : QueryResult) -> String

#
QueryRow

pub(all) struct QueryRow {
index : Int
event : Envelope
fingerprint : String
} derive(Eq,
Debug
)

#
QueryRow::to_wire

fn QueryRow::to_wire(self : QueryRow) -> String

#
QuerySkip

pub(all) struct QuerySkip {
event_id : String
topic : String
reason : String
} derive(Eq,
Debug
)

#
QuerySkip::to_wire

fn QuerySkip::to_wire(self : QuerySkip) -> String

#
QuerySort

pub(all) enum QuerySort {
QueryOriginal
QueryTimestampAsc
QueryTimestampDesc
QueryTopicAsc
} derive(Eq,
Debug
)

#
QuerySort::to_wire

fn QuerySort::to_wire(self : QuerySort) -> String

#
ReplayReport

pub(all) struct ReplayReport {
events_replayed : Int
deliveries : Int
dead_letters_added : Int
lines : Array[String]
} derive(Eq,
Debug
)

#
ReplayReport::summary

fn ReplayReport::summary(self : ReplayReport) -> String

#
RetentionCandidate

type RetentionCandidate derive(Eq,
Debug
)

#
RetentionCounter

type RetentionCounter derive(Eq,
Debug
)

#
RetentionDecision

pub(all) struct RetentionDecision {
index : Int
sequence : Int
event_id : String
topic : String
timestamp_ms : Int
fingerprint : String
keep : Bool
reason : String
} derive(Eq,
Debug
)

#
RetentionDecision::to_wire

fn RetentionDecision::to_wire(self : RetentionDecision) -> String

#
RetentionPolicy

pub(all) struct RetentionPolicy {
name : String
topic : TopicPattern?
min_timestamp_ms : Int?
max_timestamp_ms : Int?
max_events : Int
max_events_per_topic : Int
compact_fingerprints : Bool
} derive(Eq,
Debug
)

#
RetentionPolicy::bounded

fn RetentionPolicy::bounded(self : RetentionPolicy) -> Bool

#
RetentionPolicy::to_wire

fn RetentionPolicy::to_wire(self : RetentionPolicy) -> String

#
RetentionPolicy::with_compaction

fn RetentionPolicy::with_compaction(self : RetentionPolicy, compact_fingerprints : Bool) -> RetentionPolicy

#
RetentionPolicy::with_limits

fn RetentionPolicy::with_limits(self : RetentionPolicy, max_events? : Int, max_events_per_topic? : Int) -> RetentionPolicy

#
RetentionPolicy::with_time_range

fn RetentionPolicy::with_time_range(self : RetentionPolicy, min_timestamp_ms? : Int, max_timestamp_ms? : Int) -> RetentionPolicy

#
RetentionPolicy::with_topic

fn RetentionPolicy::with_topic(self : RetentionPolicy, topic : StringView) -> Result[RetentionPolicy, EventRailError]

#
RetentionPolicy::without_topic

fn RetentionPolicy::without_topic(self : RetentionPolicy) -> RetentionPolicy

#
RetentionReport

pub(all) struct RetentionReport {
policy : String
source : String
scanned : Int
kept : Int
dropped : Int
topic_summaries : Array[RetentionTopicSummary]
decisions : Array[RetentionDecision]
} derive(Eq,
Debug
)

#
RetentionReport::decision_lines

fn RetentionReport::decision_lines(self : RetentionReport) -> Array[String]

#
RetentionReport::drop_lines

fn RetentionReport::drop_lines(self : RetentionReport) -> Array[String]

#
RetentionReport::dropped_event_ids

fn RetentionReport::dropped_event_ids(self : RetentionReport) -> Array[String]

#
RetentionReport::dropped_indices

fn RetentionReport::dropped_indices(self : RetentionReport) -> Array[Int]

#
RetentionReport::dropped_sequences

fn RetentionReport::dropped_sequences(self : RetentionReport) -> Array[Int]

#
RetentionReport::keep_lines

fn RetentionReport::keep_lines(self : RetentionReport) -> Array[String]

#
RetentionReport::kept_event_ids

fn RetentionReport::kept_event_ids(self : RetentionReport) -> Array[String]

#
RetentionReport::kept_indices

fn RetentionReport::kept_indices(self : RetentionReport) -> Array[Int]

#
RetentionReport::kept_sequences

fn RetentionReport::kept_sequences(self : RetentionReport) -> Array[Int]

#
RetentionReport::manifest

fn RetentionReport::manifest(self : RetentionReport) -> String

#
RetentionReport::manifest_lines

fn RetentionReport::manifest_lines(self : RetentionReport) -> Array[String]

#
RetentionReport::ok

fn RetentionReport::ok(self : RetentionReport) -> Bool

#
RetentionReport::summary

fn RetentionReport::summary(self : RetentionReport) -> String

#
RetentionReport::topic_lines

fn RetentionReport::topic_lines(self : RetentionReport) -> Array[String]

#
RetentionTopicSummary

pub(all) struct RetentionTopicSummary {
topic : String
kept : Int
dropped : Int
} derive(Eq,
Debug
)

#
RetentionTopicSummary::to_wire

fn RetentionTopicSummary::to_wire(self : RetentionTopicSummary) -> String

#
RetryPolicy

pub(all) struct RetryPolicy {
max_attempts : Int
base_delay_ms : Int
backoff_factor : Int
} derive(Eq,
Debug
)

Policy used when a handler asks for retry or returns failure.

#
RetryPolicy::next_delay

fn RetryPolicy::next_delay(self : RetryPolicy, attempt : Int) -> Int

#
RouteExplanation

pub(all) struct RouteExplanation {
event_id : String
topic : String
mode : DeliveryMode
selected : Array[String]
probes : Array[RouteProbe]
} derive(Eq,
Debug
)

#
RouteProbe

pub(all) struct RouteProbe {
subscription_id : String
pattern : String
group : String
matched : Bool
selected : Bool
reason : String
priority : Int
specificity : Int
} derive(Eq,
Debug
)

#
RuleDecision

pub(all) enum RuleDecision {
Accept(String)
Reject(String)
} derive(Eq,
Debug
)

#
RuleDecision::to_handler_result

fn RuleDecision::to_handler_result(self : RuleDecision) -> HandlerResult

#
RuleDecision::to_wire

fn RuleDecision::to_wire(self : RuleDecision) -> String

#
RuleResult

pub(all) struct RuleResult {
passed : Bool
code : String
reason : String
} derive(Eq,
Debug
)

#
RuleResult::fail

fn RuleResult::fail(code : StringView, reason : StringView) -> RuleResult

#
RuleResult::ok

fn RuleResult::ok(code : StringView, reason : StringView) -> RuleResult

#
RuleSet

pub(all) struct RuleSet {
name : String
predicates : Array[EventPredicate]
} derive(Eq,
Debug
)

#
RuleSet::decide

fn RuleSet::decide(self : RuleSet, event : Envelope) -> RuleDecision

#
RuleSet::evaluate

fn RuleSet::evaluate(self : RuleSet, event : Envelope) -> RuleResult

#
ScheduledEvent

pub(all) struct ScheduledEvent {
due_ms : Int
subscription_id : String
reason : String
event : Envelope
} derive(Eq,
Debug
)

#
ScheduledEvent::to_manifest_line

fn ScheduledEvent::to_manifest_line(self : ScheduledEvent) -> String

#
SchemaIssue

pub(all) struct SchemaIssue {
path : String
code : String
message : String
} derive(Eq,
Debug
)

#
SchemaIssue::to_wire

fn SchemaIssue::to_wire(self : SchemaIssue) -> String

#
SchemaReport

pub(all) struct SchemaReport {
name : String
valid : Bool
issues : Array[SchemaIssue]
} derive(Eq,
Debug
)

#
SchemaReport::issue_lines

fn SchemaReport::issue_lines(self : SchemaReport) -> Array[String]

#
SchemaReport::summary

fn SchemaReport::summary(self : SchemaReport) -> String

#
SchemaReport::to_handler_result

fn SchemaReport::to_handler_result(self : SchemaReport) -> HandlerResult

#
SnapshotChange

pub(all) struct SnapshotChange {
kind : SnapshotChangeKind
event_id : String
before_fingerprint : String
after_fingerprint : String
} derive(Eq,
Debug
)

#
SnapshotChange::to_wire

fn SnapshotChange::to_wire(self : SnapshotChange) -> String

#
SnapshotChangeKind

pub(all) enum SnapshotChangeKind {
SnapshotAdded
SnapshotRemoved
SnapshotChanged
} derive(Eq,
Debug
)

#
SnapshotChangeKind::to_wire

fn SnapshotChangeKind::to_wire(self : SnapshotChangeKind) -> String

#
SnapshotDeliveryRow

pub(all) struct SnapshotDeliveryRow {
subscription_id : String
stats : DeliveryStats
} derive(Eq,
Debug
)

#
SnapshotDeliveryRow::to_wire

fn SnapshotDeliveryRow::to_wire(self : SnapshotDeliveryRow) -> String

#
SnapshotDiff

pub(all) struct SnapshotDiff {
left : String
right : String
added : Int
removed : Int
changed : Int
changes : Array[SnapshotChange]
} derive(Eq,
Debug
)

#
SnapshotDiff::change_lines

fn SnapshotDiff::change_lines(self : SnapshotDiff) -> Array[String]

#
SnapshotDiff::summary

fn SnapshotDiff::summary(self : SnapshotDiff) -> String

#
Subscription

pub(all) struct Subscription {
id : String
pattern : TopicPattern
priority : Int
group : String
order : Int
retry : RetryPolicy
enabled : Bool
guards : Array[EventPredicate]
} derive(Eq,
Debug
)

#
Subscription::first_guard_failure

fn Subscription::first_guard_failure(self : Subscription, event : Envelope) -> RuleResult?

#
Subscription::guards_pass

fn Subscription::guards_pass(self : Subscription, event : Envelope) -> Bool

#
Subscription::matches

fn Subscription::matches(self : Subscription, event : Envelope) -> Result[Bool, EventRailError]

#
SubscriptionBlueprint

pub(all) struct SubscriptionBlueprint {
id : String
pattern : String
priority : Int
group : String
retry : RetryPolicy
enabled : Bool
guards : Array[EventPredicate]
} derive(Eq,
Debug
)

#
SubscriptionBlueprint::to_wire

fn SubscriptionBlueprint::to_wire(self : SubscriptionBlueprint) -> String

#
SubscriptionDeliveryStats

pub(all) struct SubscriptionDeliveryStats {
subscription_id : String
stats : DeliveryStats
} derive(Eq,
Debug
)

#
SubscriptionDeliveryStats::to_wire

#
TapeEntry

pub(all) struct TapeEntry {
sequence : Int
event : Envelope
state : TapeState
} derive(Eq,
Debug
)

#
TapeEntry::to_manifest_line

fn TapeEntry::to_manifest_line(self : TapeEntry) -> String

#
TapeState

pub(all) enum TapeState {
Recorded
Replayed
Skipped(String)
} derive(Eq,
Debug
)

#
TapeState::to_wire

fn TapeState::to_wire(self : TapeState) -> String

#
TapeWindow

pub(all) struct TapeWindow {
cursor : EventCursor
entries : Array[TapeEntry]
next_cursor : EventCursor
complete : Bool
} derive(Eq,
Debug
)

#
TapeWindow::events

fn TapeWindow::events(self : TapeWindow) -> Array[Envelope]

#
TapeWindow::is_empty

fn TapeWindow::is_empty(self : TapeWindow) -> Bool

#
TapeWindow::len

fn TapeWindow::len(self : TapeWindow) -> Int

#
TapeWindow::manifest

fn TapeWindow::manifest(self : TapeWindow) -> String

#
TapeWindow::manifest_lines

fn TapeWindow::manifest_lines(self : TapeWindow) -> Array[String]

#
TapeWindow::summary

fn TapeWindow::summary(self : TapeWindow) -> String

#
TapeWindow::to_tape

fn TapeWindow::to_tape(self : TapeWindow) -> EventTape

#
TopicCount

pub(all) struct TopicCount {
topic : String
count : Int
first_sequence : Int
last_sequence : Int
} derive(Eq,
Debug
)

#
TopicDeliveryStats

pub(all) struct TopicDeliveryStats {
topic : String
stats : DeliveryStats
} derive(Eq,
Debug
)

#
TopicDeliveryStats::to_wire

fn TopicDeliveryStats::to_wire(self : TopicDeliveryStats) -> String

#
TopicPattern

pub(all) struct TopicPattern {
raw : String
tokens : Array[TopicToken]
specificity : Int
} derive(Eq,
Debug
)

Parsed topic pattern. Higher specificity wins when routes are sorted.

#
TopicPattern::is_catch_all

fn TopicPattern::is_catch_all(self : TopicPattern) -> Bool

#
TopicPattern::matches_topic

fn TopicPattern::matches_topic(self : TopicPattern, topic : StringView) -> Result[Bool, EventRailError]

#
TopicPattern::prefix

fn TopicPattern::prefix(self : TopicPattern) -> String

#
TopicPattern::report

fn TopicPattern::report(self : TopicPattern, topic : StringView) -> Result[MatchReport, EventRailError]

#
TopicToken

pub(all) enum TopicToken {
ExactSegment(String)
OneSegment
TailSegments
} derive(Eq,
Debug
)

Token in a topic pattern.

#
ValueKind

pub(all) enum ValueKind {
KindAny
KindNull
KindBool
KindInt
KindText
KindList
KindRecord
} derive(Eq,
Debug
)

#
ValueKind::to_wire

fn ValueKind::to_wire(self : ValueKind) -> String

#
bool_value

fn bool_value(value : Bool) -> EventValue

#
bus

fn bus() -> Bus

#
bus_plan

fn bus_plan(name? : StringView, subscriptions? : ArrayView[SubscriptionBlueprint]) -> BusPlan

#
compare_pattern_priority

fn compare_pattern_priority(left : TopicPattern, right : TopicPattern) -> Int

#
delivery_stats

fn delivery_stats() -> DeliveryStats

#
diagnose_batch

fn diagnose_batch(name : StringView, batch : EventBatch) -> DiagnosticReport

#
diagnose_batch_rules

fn diagnose_batch_rules(name : StringView, batch : EventBatch, rules : RuleSet) -> DiagnosticReport

#
diagnose_batch_schema

fn diagnose_batch_schema(name : StringView, batch : EventBatch, schema : EventSchema) -> DiagnosticReport

#
diagnose_bus

fn diagnose_bus(name : StringView, bus : Bus) -> DiagnosticReport

#
diagnose_pipeline_run

fn diagnose_pipeline_run(name : StringView, run : PipelineRun) -> DiagnosticReport

#
diagnose_retention

fn diagnose_retention(name : StringView, retention : RetentionReport) -> DiagnosticReport

#
diagnose_snapshot

fn diagnose_snapshot(name : StringView, snapshot : EventSnapshot) -> DiagnosticReport

#
diagnostic_report

fn diagnostic_report(name? : StringView) -> DiagnosticReport

#
envelope

fn envelope(id? : StringView, topic : StringView, payload : EventValue, headers? : ArrayView[Pair], timestamp_ms? : Int, attempt? : Int, trace? : ArrayView[String]) -> Envelope

#
escape_wire_text

fn escape_wire_text(value : String) -> String

#
event_batch

fn event_batch(name? : StringView, events? : ArrayView[Envelope]) -> EventBatch

#
event_cursor

fn event_cursor(start_sequence? : Int, limit? : Int, pattern? : StringView) -> EventCursor

#
event_pipeline

fn event_pipeline(name : StringView, batch : EventBatch, actions? : ArrayView[PipelineAction]) -> EventPipeline

#
event_projection

fn event_projection(spec : ProjectionSpec) -> EventProjection

#
event_query

fn event_query(name? : StringView, topic? : StringView, headers? : ArrayView[HeaderFilter], predicates? : ArrayView[EventPredicate], min_timestamp_ms? : Int, max_timestamp_ms? : Int, offset? : Int, limit? : Int, sort? : QuerySort) -> Result[EventQuery, EventRailError]

#
event_schema

fn event_schema(name : StringView, topic? : StringView, fields? : ArrayView[FieldSpec]) -> Result[EventSchema, EventRailError]

#
event_snapshot

fn event_snapshot(name : StringView, source : StringView, events : ArrayView[Envelope], bus : Bus, timestamp_ms? : Int) -> EventSnapshot

#
event_tape

fn event_tape() -> EventTape

#
field

fn field(key : StringView, value : EventValue) -> (String, EventValue)

#
field_spec

fn field_spec(path : StringView, kind : ValueKind, required? : Bool, min_int? : Int, max_int? : Int, min_len? : Int, max_len? : Int) -> FieldSpec

#
header_filter

fn header_filter(key : StringView, value? : StringView) -> HeaderFilter

#
int_value

fn int_value(value : Int) -> EventValue

#
list_value

fn list_value(values : ArrayView[EventValue]) -> EventValue

#
null_value

fn null_value() -> EventValue

#
outbox

fn outbox() -> Outbox

#
package_name

fn package_name() -> String

EventRail is a deterministic in-process event bus and message trace library. The implementation is dependency-light so it can run in tests, examples, WebAssembly demos, and command-line tooling with the same behavior.

#
package_version

fn package_version() -> String

#
pair

fn pair(key : StringView, value : StringView) -> Pair

Construct an ordered string pair.

#
pairs_to_wire

fn pairs_to_wire(pairs : ArrayView[Pair]) -> String

#
projection_spec

fn projection_spec(name : StringView, key_path : StringView, topic? : StringView, include_paths? : ArrayView[String], require_key? : Bool) -> Result[ProjectionSpec, EventRailError]

#
record_value

fn record_value(fields : ArrayView[(String, EventValue)]) -> EventValue

#
retention_policy

fn retention_policy(name? : StringView, topic? : StringView, min_timestamp_ms? : Int, max_timestamp_ms? : Int, max_events? : Int, max_events_per_topic? : Int, compact_fingerprints? : Bool) -> Result[RetentionPolicy, EventRailError]

#
retry_policy

fn retry_policy(max_attempts? : Int, base_delay_ms? : Int, backoff_factor? : Int) -> RetryPolicy

#
rule_set

fn rule_set(name : StringView, predicates : ArrayView[EventPredicate]) -> RuleSet

#
scheduled_event

fn scheduled_event(due_ms : Int, subscription_id : StringView, reason : StringView, event : Envelope) -> ScheduledEvent

#
stable_event_id

fn stable_event_id(topic : StringView, payload : EventValue, timestamp_ms : Int) -> String

#
subscription

fn subscription(id : StringView, pattern : StringView, priority? : Int, group? : StringView, order? : Int, retry? : RetryPolicy, enabled? : Bool, guards? : ArrayView[EventPredicate]) -> Result[Subscription, EventRailError]

#
subscription_blueprint

fn subscription_blueprint(id : StringView, pattern : StringView, priority? : Int, group? : StringView, retry? : RetryPolicy, enabled? : Bool, guards? : ArrayView[EventPredicate]) -> SubscriptionBlueprint

#
text_value

fn text_value(value : StringView) -> EventValue

#
topic_pattern

fn topic_pattern(pattern : StringView) -> Result[TopicPattern, EventRailError]

#
topic_segments

fn topic_segments(topic : StringView) -> Result[Array[String], EventRailError]