moonamqp1

    AMQP 1.0 typed wire codec and bounded sans-I/O messaging state machines

    amqp1
    messaging
    sans-io
    Download zip
    Version
    0.3.0
    License
    Apache-2.0
    Last updated
    2 hours ago
    Downloads
    126

    #MoonAMQP1

    MoonBit 原生 AMQP 1.0 类型、消息、增量分帧与有界协议状态核心。同一实现用于 native、JavaScript、Wasm、Wasm-GC。核心不绑定 Rhea、C 消息库或网络运行时;原生示例宿主使用 async 处理文件和标准输入输出。

    模块 binhongcha/moonamqp1@0.3.0。GitHub · Mooncakes。

    #生态定位与使用场景

    AMQP 1.0 的类型、described value、会话窗口、单向 link、credit 与 settlement 构成跨系统消息交换能力。RabbitMQ 官方明确它与 AMQP 0-9-1 使用不同线协议和客户端。已有 MoonBit 0-9-1 库仍适用于其自身协议;本项目补充独立的 1.0 协议核心,不提供 0-9-1 exchange/queue 方法或透明转码。

    • 后台任务与服务作业:发送 5KB 作业,只有一个 credit,消息分为多个 transfer;工作端明确 accepted 或 released,上层自行决定是否重试。适用于文件处理、构建任务、通知作业、订单异步步骤。运行 examples/tasks。
    • 设备和应用遥测:慢速历史链路没有 credit 时,实时样本和告警链路仍能使用共享 session;精确传递 uint64 ID、timestamp 和单位。适用于采集网关、监控、应用事件和边缘上报。运行 examples/telemetry。
    • 跨系统消息桥与 Web/Wasm 宿主:两个独立连接保留带类型的属性、注解、多个 data section 与 footer,下游接受后再确认上游。适用于消息代理适配、迁移工具、离线诊断和可嵌入集成测试。运行 examples/bridge;该场景可直接编译为 JS,不附带浏览器 UI。

    本地已有项目分别处理文件格式、HTTP 缓存、更新信任、编码恢复、事件日志挖掘等,本项目处理的是 AMQP 1.0 线上消息与链路状态。检索属于有日期、有关键词范围的排重证据,不能证明整个生态绝无相近工作。

    #安装与运行

    安装官方 MoonBit 工具链。本机验证 moonc 0.10.20,符合赛事最低要求;CI 固定 compiler/core 0.10.20+65efd5b93;依赖版本见 moon.mod。

    moon version --all moon check --target all --deny-warn moon build --target all --deny-warn moon test --target all --deny-warn moon run examples/tasks --target native --deny-warn moon run examples/telemetry --target native --deny-warn moon run examples/bridge --target js --deny-warn moon run examples/scale --target native --deny-warn moon fmt --check moon info git diff --exit-code

    从项目目录运行即可复现,示例已配置导入。Moon20261016 的 Windows OCaml 子工具可能拒绝 \\?\ 路径,可使用进程参数适配器;首次构建需要 MSVC Build Tools,不修改全局环境或编译器:

    .\tools\windows\moon.ps1 check --target all --deny-warn .\tools\windows\moon.ps1 test --target all --deny-warn .\tools\windows\moon.ps1 run examples/tasks --target native --deny-warn

    #最小使用样例

    在已有 MoonBit 工程中安装:

    moon add binhongcha/moonamqp1@0.3.0

    使用方 moon.pkg 配置导入:

    import { "binhongcha/moonamqp1" @amqp, }
    pkgtype(kind: "executable")

    fn main raise {
    let message = @amqp.Message::data(b"payload", properties=[
    ("sequence", ULong(18446744073709551615UL)),
    ("kind", Text("job")),
    ])
    let bytes = @amqp.encode_message(message)
    let restored = @amqp.decode_message(bytes)
    assert_eq(restored.data_bytes(), b"payload")
    }

    消息编解码可以独立使用。Message::new 接受已知 section 的有序列表;sections() 返回深层副本,调用方修改数组不会改变消息。无 body、amqp-value(null) 和空 data section 保持区别。data_bytes() 连接 data sections,遇到 sequence/value body 会报错。

    #兼容范围

    0.2.0 的架构、三项协议语义、功能复杂度及互操作复现见 协议范围与复审验证。

    层次支持当前边界
    值全部原始域、十进制原始字节、精确整数/时间戳、list/map、typed array、数字或符号 descriptor十进制不提供算术;数组公共 constructor 最多一层 descriptor;编码采用全宽 canonical 形式
    文本严格 UTF-8、Unicode scalar、ASCII symbol,保留 BOM 和 ASCII NUL拒绝非法 UTF-8 与未配对 UTF-16 代理项,不静默替换
    帧AMQP1.0 header、9 类 transport performative、扩展头、空 heartbeat、任意 feed 分块SASL frame/type、TLS header、未知额外 performative 字段明确拒绝
    消息header、注解、properties、application-properties、data/sequence/value body、footer检查顺序、唯一性、互斥及字段域;未知 section 不静默跳过
    状态一个 connection 内多个 session、多 link、独立 channel 和 handle 映射最多 64 个本地会话,默认 16;启用 recoverable 后支持在原会话或新会话重挂。动态节点、持久化终端及过滤扩展仍受限
    收发link credit、session window、自动发送分片、接收组装/aborted、三种 sender settle mode、receiver First/Second、link drain暂不提供 resume、事务、非零 message-format、分片中改变 settlement
    确认accepted、rejected(保留无 error 的拒绝)、released、modified 的两个布尔标志、范围 dispositionReceived 用于待结算续传。Modified 保留符号键与带类型注解,事务状态由选用的事务能力负责;确认不等同业务 exactly-once
    宿主bytes/commands → bytes/events;原生 CLI 文件及 stdio 示例无内置 broker、TCP 客户端、SASL、TLS、持久 outbox、自动重连、定时器或自动重试

    定时端点通过显式宿主时钟支持非零 idle-time-out。旧的 receive / drain 驱动方式适用于零超时。source/target 的非空高级字段会被明确拒绝,而不是假装完成过滤或 durability。typed value/message 层可独立处理状态核心尚不协商的内容。

    Value::ArrayValue(code, descriptor, bodies) 的 code 使用全宽基础类型,如 uint 0x70、symbol 0xb3、list 0xd0;bodies 不重复包含公共 descriptor。读取接受 array8/32 及 compact/zero-width constructor,再规范化。通用 map 保留顺序,键按类型与规范化值检查重复;注解、fields、application-properties 另有各自键域限制。

    #驱动连接与处理流控

    1. 创建 Endpoint;调用 start(),将 drain() 字节交给宿主的可靠有序传输。
    2. 每次输入调用 receive(bytes),处理 events(),再发送 drain()。被动端收到协议 header 会自动响应 open。
    3. 主动一方在 RemoteOpen 后调用 begin() 或 begin(channel=…)。对端分配自己的本地 channel,收到 SessionReady 后 attach sender/receiver。其他会话的命令传入对应的本地 channel。
    4. 接收 link ready 后调用 grant(handle, credit)。这设置以当前 delivery-count 为基准的新额度,不是累加旧额度。
    5. sender 使用本地 handle 调用 send(message, tag);收到完整 Received 后按业务结果 acknowledge(id, outcome)。tag 最多 32 字节,同一 link 的在途未确认标签必须唯一;标签不提供跨重连幂等性。
    6. 显式 refresh_windows(incoming, outgoing) 重新通告宿主可承担的会话窗口;对端 flow 会更新远端容量。它与 grant link credit 是两个独立操作。
    7. 正常结束用 end_session() 或 close() 完成相应握手;传输 EOF 调用 finish_input(),无正常 close 会被报告。

    每个 transfer 帧消耗一次会话窗口,一条多帧 delivery 只消耗一次 link credit。send 在编码全部分片并通过队列/窗口预检后才更新状态;失败可以在补足窗口或清空队列后重试。首版不暂存“发送一半等待窗口”的命令,因此整条 delivery 的帧数必须能装入当前两个发送窗口。其 frame count 可从前后 session_positions() 差值观察。

    未支持的协议头会回送本端版本并关闭连接。未挂接的 handle 使用 End 结束相应会话。其他连接级线格式错误使端点失败并释放连接状态。正常 detach 会产生 UnsettledLost,向宿主说明未确认结果不能再等待。启用恢复的链路可经 RecoveryStore 保留未结算协议状态。宿主负责保存业务任务状态。核心对象不支持多个执行者并发修改,需串行驱动。

    #资源与复杂度

    Limits 默认限制:单值/输入 feed/逻辑聚合接收载荷/输出队列 16MiB、单帧 1MiB、单消息 16MiB、总值节点 65536、嵌套32层、link256、事件/各方向未确认256、每消息4096片。可调整,深度上限128;本地 session window 和 link credit 限于不产生 serial 歧义的半范围。接受合法 UINT_MAX 远端 session 容量;不会据其大小直接分配内存。

    增量分帧按字节追加,输入总长 N 时 O(N),只保留一个未完成帧;消息分片按字节组装 O(M)。嵌套容器编码临时缓冲与 map key 规范化的成本至多 O(N·D),D 为受限深度。handle 查找 O(L)。收到范围确认时扫描已有的 pending ID 与相关会话的链路,处理最坏 O(P log P + L),不按对端声明的区间逐个遍历。

    预算限制的是逻辑字节和节点数量,不是精确进程 RSS:编码/解码副本、JS 对象、Message 树与宿主已取走的事件仍有开销。核心保留输出字节;drain() 不代表网络已可靠发送。examples/scale 验证2048条、6144帧、64条有界批次的持续正确性,不是跨语言速度基准。

    #独立互操作与 CLI

    moon build --target native --deny-warn npm ci --ignore-scripts --no-audit --no-fund npm run interop moon run cmd/main --target native -- value INPUT.bin NEW_OUTPUT.bin moon run cmd/main --target native -- message INPUT.bin NEW_OUTPUT.bin moon run cmd/main --target native -- frames INPUT.bin NEW_OUTPUT.bin

    CLI 拒绝覆盖已有输出。peer 使用二进制 stdin/stdout 承载 AMQP1.0:为接收 link 授予32个 credit 并 accepted;为获额度的发送 link 发送一次5KB原创测试消息。它是互操作示例宿主,不是生产服务。

    固定 Rhea3.0.5 为开发依赖:27组合法类型(含准确 UINT64、数组/描述类型)、消息 section 和帧流双向对照;真实 Rhea 客户端通过 stdio 与 MoonBit 双向收发5KB消息,协商512字节帧并验证分片、accepted、关闭。复审同时验证 Rhea 的 First、Second 握手。真实 Broker 测试单独走 Artemis 2.44.0 的两条队列,并复查接收确认后无重投。Rhea 的宽松解码不作为恶意输入合法性的依据,截断/错类型/错状态/预算路径另行测试。

    Linux/Windows CI 覆盖检查、构建、四后端测试、格式、接口、业务示例、独立 Rhea 互操作、Linux 下的 Artemis 双向队列测试和包内容;工程验证不等于正式赛事验收。申报书及审查/AI/汇总材料可在项目本地文件夹保存,由忽略及历史/包检查排除,不进入 Git 或发行包。许可证为 Apache-2.0,来源与 AI 辅助范围见 THIRD_PARTY.md。规范参考:Types、Transport、Messaging。

    #十一月新增功能

    完整交付发送预检(Endpoint::plan_send)与显式消息到期判断(Message::expiry_status)自 0.1.0 起提供。详见 功能、用途和边界,运行 moon run examples/november --target native --deny-warn。

    #应用属性编辑与端点诊断

    新增 不可变应用属性编辑、端点与链路诊断快照,用途、限制和复杂度见 功能文档。 从本仓库源码运行 moon run examples/expansion --target native --deny-warn。 本节 API 自 0.2.0 起提供。

    #十一月复审增量

    • 支持多 Session、Receiver Settle Mode Second 和 link drain。次要会话事件携带本地 channel,默认会话沿用原事件形状。
    • 新增批量结果确认 Endpoint::acknowledge_range 和会话流控快照 Endpoint::session_diagnostics。运行 moon run examples/review --target native --deny-warn。
    • 通过 Artemis 2.44.0 真实队列验证双向收发、分片、First 确认和两种 drain 场景,分别为有一条待交付消息和空队列。通过独立 Rhea 3.0.5 对端验证 Second。复现命令和用例边界见 协议范围。

    #空闲超时与未结算链路恢复

    使用 Endpoint::new(idle_advertised_ms=...) 声明接收间隔,并由宿主以同一单调毫秒时钟调用 receive_at、poll_idle、drain_at。完整入站帧更新接收时刻,部分帧不会延长超时。对端间隔到一半且无待写帧时排入心跳,本端接收静默达到声明间隔两倍时尝试发送带原因的 Close。attach(..., recoverable=true) 保留待结算交付。suspend_link / resume_link 在同一会话中重挂,transport_lost 与 RecoveryStore 支持跨连接交接。发送方通过 resumable_deliveries 和 resume_delivery 按对端状态推进,通过 recovery_status 判断是否需要再次重挂。运行 npm run interop:recovery 可复现带部分表、偏移续传和最终 Second 结算的线级对照。恢复契约与标准边界

    同一服务的多个连接可以共享 RecoveryStore。新连接挂接同一对容器、同一方向的同名链路时,旧链路收到 amqp:link:stolen,已保留的待结算记录交给新链路。宿主应在传输断开时调用 transport_lost,并让旧连接的写循环取走排队的 Detach。

    运行 npm run interop:recovery:tcp 可启动独立的本地 TCP 测试对端。它用 Rhea 编解码并驱动两个角色的重挂,检查部分待结算表、续传偏移、结算以及恢复后的普通交付。

    #November additions

    Use idle_deadlines to schedule peer heartbeats and local receive timeouts separately. When the output transport has a packet budget, drain_bounded_at returns a prefix of the ordered queue and updates the transmit clock only when it returns bytes. The initial protocol header and Open can occupy one queued packet. A smaller transport buffer may require a larger drain budget or subsequent transport-level framing.

    Use suspend_readiness before issuing Detach and suspended_links after the peer acknowledges it. The inventory retains the link name, direction, address and delivery count. The implementation resumes quiescent links on one live session. Reconciliation of nonempty unsettled maps remains a separate protocol milestone.

    AmqpError

    pub suberror AmqpError {
    Invalid(String, Int)
    Unsupported(String)
    Limit(String)
    State(String)
    } derive(
    Debug
    )

    AmqpError::to_repr

    automatically derived

    Delivery

    pub(all) struct Delivery {
    handle : UInt
    id : UInt
    tag : Bytes
    settled : Bool
    message : Message
    }

    Endpoint

    pub struct Endpoint {
    // private fields
    }

    Endpoint::acknowledge

    fn Endpoint::acknowledge(self : Endpoint, id : UInt, outcome : Outcome, channel? : Int) -> Unit raise AmqpError

    Endpoint::acknowledge_range

    fn Endpoint::acknowledge_range(self : Endpoint, first : UInt, last : UInt, outcome : Outcome, channel? : Int) -> Unit raise AmqpError

    Report the same outcome for a contiguous range of complete incoming deliveries.

    Endpoint::attach

    fn Endpoint::attach(self : Endpoint, name : String, sender : Bool, address : String, handle? : UInt, receiver_mode? : ReceiverSettleMode, recoverable? : Bool, channel? : Int) -> UInt raise AmqpError

    Endpoint::begin

    fn Endpoint::begin(self : Endpoint, channel? : Int) -> Unit raise AmqpError

    Start a session on the selected local channel after exchanging Open.

    Endpoint::close

    fn Endpoint::close(self : Endpoint) -> Unit raise AmqpError

    Endpoint::complete_drain

    fn Endpoint::complete_drain(self : Endpoint, handle : UInt, channel? : Int) -> Unit raise AmqpError

    After sending available messages, return unused link credit to the receiver.

    Endpoint::detach

    fn Endpoint::detach(self : Endpoint, channel? : Int, handle : UInt) -> Unit raise AmqpError

    Endpoint::diagnostics

    fn Endpoint::diagnostics(self : Endpoint) -> EndpointDiagnostic

    Detached snapshot. Does not consume credit, queued bytes or events.

    Endpoint::drain

    fn Endpoint::drain(self : Endpoint) -> Bytes

    Endpoint::drain_at

    fn Endpoint::drain_at(self : Endpoint, now_ms : UInt64) -> Bytes raise AmqpError

    Pull bytes when the host can immediately hand them to its ordered transport.

    Endpoint::drain_bounded_at

    fn Endpoint::drain_bounded_at(self : Endpoint, max_bytes : Int, now_ms : UInt64) -> Bytes raise AmqpError

    Drain a prefix of queued wire packets that fits the transport budget. An oversized head packet stays queued and is reported to the caller.

    Endpoint::end_session

    fn Endpoint::end_session(self : Endpoint, channel? : Int) -> Unit raise AmqpError

    Endpoint::events

    fn Endpoint::events(self : Endpoint) -> Array[Event]

    Endpoint::finish_input

    fn Endpoint::finish_input(self : Endpoint) -> Unit raise AmqpError

    Endpoint::grant

    fn Endpoint::grant(self : Endpoint, channel? : Int, handle : UInt, credit : UInt, drain? : Bool) -> Unit raise AmqpError

    Endpoint::heartbeat

    fn Endpoint::heartbeat(self : Endpoint) -> Unit raise AmqpError

    Endpoint::idle_deadlines

    fn Endpoint::idle_deadlines(self : Endpoint, now_ms : UInt64) -> (UInt64?, UInt64?) raise AmqpError

    Return remaining time for receive timeout and outbound heartbeat respectively.

    Endpoint::idle_delay_ms

    fn Endpoint::idle_delay_ms(self : Endpoint, now_ms : UInt64) -> UInt64? raise AmqpError

    Milliseconds until the next actionable idle event. A queued outbound frame suppresses keepalive scheduling until the host drains it.

    Endpoint::is_closed

    fn Endpoint::is_closed(self : Endpoint) -> Bool

    Endpoint::is_failed

    fn Endpoint::is_failed(self : Endpoint) -> Bool

    fn Endpoint::link_credit(self : Endpoint, channel? : Int, handle : UInt) -> UInt raise AmqpError

    Endpoint::new

    fn Endpoint::new(container : String, channel? : Int, window? : UInt, max_sessions? : Int, idle_advertised_ms? : UInt, recovery? : RecoveryStore?, limits? : Limits) -> Endpoint raise AmqpError

    Endpoint::pending

    fn Endpoint::pending(self : Endpoint) -> (Int, Int)

    Endpoint::plan_send

    fn Endpoint::plan_send(self : Endpoint, channel? : Int, handle : UInt, message : Message, tag : Bytes, settled? : Bool) -> SendPlan raise AmqpError

    Encode and validate a delivery without consuming credit or modifying queues.

    Endpoint::poll_idle

    fn Endpoint::poll_idle(self : Endpoint, now_ms : UInt64) -> IdleAction raise AmqpError

    The advertised receive interval is half the local failure threshold. Hosts call this periodically and write queued output as soon as possible.

    Endpoint::receive

    fn Endpoint::receive(self : Endpoint, bytes : Bytes) -> Unit raise AmqpError

    Endpoint::receive_at

    fn Endpoint::receive_at(self : Endpoint, bytes : Bytes, now_ms : UInt64) -> Unit raise AmqpError

    Feed transport bytes. Only an accepted complete frame refreshes receive activity.

    Endpoint::recovery_status

    fn Endpoint::recovery_status(self : Endpoint, handle : UInt, channel? : Int) -> RecoveryStatus raise AmqpError

    Inspect recovery after LinkReady and decide whether to detach and reattach.

    Endpoint::refresh_windows

    fn Endpoint::refresh_windows(self : Endpoint, channel? : Int, incoming : UInt, outgoing : UInt) -> Unit raise AmqpError

    Endpoint::resumable_deliveries

    fn Endpoint::resumable_deliveries(self : Endpoint, handle : UInt, channel? : Int) -> Array[Bytes] raise AmqpError

    Peer-visible deliveries that can be resumed in the current Attach round.

    Endpoint::resume_delivery

    fn Endpoint::resume_delivery(self : Endpoint, handle : UInt, tag : Bytes, channel? : Int) -> UInt raise AmqpError

    Resume one previously unsettled delivery once the receiver grants credit. The sender retains the complete encoded payload until a terminal outcome.
    fn Endpoint::resume_link(self : Endpoint, name : String, handle? : UInt, channel? : Int) -> UInt raise AmqpError

    Reattach a suspended link in the same session or import it from the endpoint recovery store. Obtain fresh credit before sending transfers.

    Endpoint::send

    fn Endpoint::send(self : Endpoint, channel? : Int, handle : UInt, message : Message, tag : Bytes, settled? : Bool) -> UInt raise AmqpError

    Endpoint::session_diagnostics

    fn Endpoint::session_diagnostics(self : Endpoint) -> Array[SessionDiagnostic]

    Endpoint::session_positions

    fn Endpoint::session_positions(self : Endpoint) -> (UInt, UInt)

    Endpoint::start

    fn Endpoint::start(self : Endpoint) -> Unit raise AmqpError

    Start both the protocol header and local open. No network I/O occurs here.
    fn Endpoint::suspend_link(self : Endpoint, handle : UInt, channel? : Int) -> Unit raise AmqpError

    Detach while preserving the link and any opted-in unsettled state.

    Endpoint::suspend_readiness

    fn Endpoint::suspend_readiness(self : Endpoint, handle : UInt, channel? : Int) -> SuspendReadiness raise AmqpError

    Determine if the link is quiescent before scheduling a detach.
    fn Endpoint::suspended_links(self : Endpoint, channel? : Int) -> Array[SuspendedLink] raise AmqpError

    Endpoint::take_unseen

    fn Endpoint::take_unseen(self : Endpoint, handle : UInt, tag : Bytes, channel? : Int) -> Message? raise AmqpError

    Release a source-only recovery record and return its message for a new send.

    Endpoint::transport_lost

    fn Endpoint::transport_lost(self : Endpoint) -> Unit

    Report transport interruption before constructing the next endpoint.

    Endpoint::unseen_deliveries

    fn Endpoint::unseen_deliveries(self : Endpoint, handle : UInt, channel? : Int) -> Array[Bytes] raise AmqpError

    Deliveries the peer omitted from a complete map may be retried by the host as new deliveries. They are never treated as omitted from a partial map.

    EndpointDiagnostic

    pub(all) struct EndpointDiagnostic {
    closed : Bool
    failed : Bool
    session_ready : Bool
    queued_bytes : Int
    partial_bytes : Int
    queued_events : Int
    links : Array[LinkDiagnostic]
    }

    Event

    pub enum Event {
    RemoteOpen(String)
    SessionReady
    LinkReady(UInt, String, Bool)
    Credit(UInt, UInt)
    Received(Delivery)
    Settled(UInt, Outcome)
    PeerSettled(UInt)
    UnsettledLost(UInt, Bool)
    Aborted(UInt, UInt)
    Detached(UInt)
    LinkSuspended(String, UInt)
    RecoverySettled(UInt, Bytes)
    DeliveryRebound(UInt, UInt, Bytes)
    RecoveryStoreFull(String)
    SessionEnded(Value)
    RemoteClosed(Value)
    SessionEvent(Int, Event)
    DrainRequested(UInt, UInt)
    DrainCompleted(UInt, UInt)
    }

    ExpiryStatus

    pub(all) struct ExpiryStatus {
    expired : Bool
    remaining_milliseconds : UInt64?
    } derive(
    Debug
    )

    ExpiryStatus::to_repr

    automatically derived

    Frame

    pub(all) struct Frame {
    channel : Int
    performative : Performative?
    payload : Bytes
    extended_header : Bytes
    }

    FrameStream

    pub struct FrameStream {
    // private fields
    }

    FrameStream::buffered_bytes

    fn FrameStream::buffered_bytes(self : FrameStream) -> Int

    FrameStream::feed

    fn FrameStream::feed(self : FrameStream, bytes : Bytes) -> Array[StreamItem] raise AmqpError

    Each byte is appended once; no prefix rescanning on one-byte input feeds.

    FrameStream::finish

    fn FrameStream::finish(self : FrameStream) -> Unit raise AmqpError

    FrameStream::new

    fn FrameStream::new(expect_header? : Bool, limits? : Limits) -> FrameStream raise AmqpError

    IdleAction

    pub(all) enum IdleAction {
    Idle
    HeartbeatQueued
    IdleCloseQueued
    } derive(Eq,
    Debug
    )

    IdleAction::equal

    fn IdleAction::equal(IdleAction, IdleAction) -> Bool
    automatically derived

    IdleAction::not_equal

    fn IdleAction::not_equal(x : IdleAction, y : IdleAction) -> Bool
    automatically derived

    IdleAction::to_repr

    automatically derived

    Limits

    pub(all) struct Limits {
    max_value_bytes : Int
    max_frame_bytes : Int
    max_message_bytes : Int
    max_items : Int
    max_depth : Int
    max_links : Int
    max_pending : Int
    max_fragments : Int
    } derive(Eq,
    Debug
    )

    Limits::default

    fn Limits::default() -> Limits

    Limits::equal

    fn Limits::equal(Limits, Limits) -> Bool
    automatically derived

    Limits::not_equal

    fn Limits::not_equal(x : Limits, y : Limits) -> Bool
    automatically derived

    Limits::to_repr

    automatically derived

    LinkDiagnostic

    pub(all) struct LinkDiagnostic {
    name : String
    address : String
    handle : UInt
    remote_handle : UInt?
    sender : Bool
    ready : Bool
    closed : Bool
    credit : UInt
    outgoing_unsettled : Int
    incoming_unsettled : Int
    receiving_fragment : Bool
    }

    Message

    pub struct Message {
    // private fields
    }

    Message::data

    fn Message::data(bytes : Bytes, properties? : Array[(String, Value)], limits? : Limits) -> Message raise AmqpError

    Message::data_bytes

    fn Message::data_bytes(self : Message) -> Bytes raise AmqpError

    Message::expiry_status

    fn Message::expiry_status(self : Message, acquired_at : Int64, now : Int64) -> ExpiryStatus raise AmqpError

    Caller-supplied UTC milliseconds. TTL is measured since local acquisition; absolute-expiry-time and TTL are both enforced, without adding timestamps.

    Message::new

    fn Message::new(sections : Array[Section], limits? : Limits) -> Message raise AmqpError

    Message::sections

    fn Message::sections(self : Message) -> Array[Section]

    Message::with_application_property

    fn Message::with_application_property(self : Message, name : String, value : Value?, limits? : Limits) -> Message raise AmqpError

    Some(Null) stores AMQP null; None removes the named application property.

    Outcome

    pub(all) enum Outcome {
    Accepted
    Rejected(String, String?)
    RejectedWithoutError
    Released
    Modified(Bool, Bool)
    ModifiedWithAnnotations(Bool, Bool, OutcomeAnnotations)
    } derive(Eq,
    Debug
    )

    Outcome::equal

    fn Outcome::equal(Outcome, Outcome) -> Bool
    automatically derived

    Outcome::from_value

    fn Outcome::from_value(value : Value) -> Outcome raise AmqpError

    Outcome::not_equal

    fn Outcome::not_equal(x : Outcome, y : Outcome) -> Bool
    automatically derived

    Outcome::to_repr

    automatically derived

    Outcome::value

    fn Outcome::value(self : Outcome) -> Value

    OutcomeAnnotations

    pub struct OutcomeAnnotations {
    // private fields
    } derive(
    Debug
    )

    Symbols and their typed values carried in the Modified outcome.

    OutcomeAnnotations::equal

    fn OutcomeAnnotations::equal(self : OutcomeAnnotations, other : OutcomeAnnotations) -> Bool

    OutcomeAnnotations::new

    fn OutcomeAnnotations::new(pairs : Array[(String, Value)]) -> OutcomeAnnotations raise AmqpError

    OutcomeAnnotations::not_equal

    OutcomeAnnotations::to_repr

    automatically derived

    OutcomeAnnotations::value

    Performative

    pub struct Performative {
    // private fields
    }

    Validated transport list. Accessors return detached snapshots.

    Performative::descriptor

    fn Performative::descriptor(self : Performative) -> Int

    Performative::field

    fn Performative::field(self : Performative, index : Int) -> Value

    Performative::from_value

    fn Performative::from_value(value : Value, limits? : Limits) -> Performative raise AmqpError

    Performative::new

    fn Performative::new(code : Int, fields : Array[Value], limits? : Limits) -> Performative raise AmqpError

    Performative::value

    fn Performative::value(self : Performative) -> Value

    ReceiverSettleMode

    pub(all) enum ReceiverSettleMode {
    First
    Second
    } derive(Eq)

    ReceiverSettleMode::equal

    automatically derived

    ReceiverSettleMode::not_equal

    automatically derived

    RecoveryStatus

    pub(all) struct RecoveryStatus {
    local_incomplete : Bool
    peer_incomplete : Bool
    retained : Int
    } derive(Eq,
    Debug
    )

    Snapshot of the current Attach round, including the gate for new deliveries.

    RecoveryStatus::equal

    automatically derived

    RecoveryStatus::not_equal

    fn RecoveryStatus::not_equal(x : RecoveryStatus, y : RecoveryStatus) -> Bool
    automatically derived

    RecoveryStatus::to_repr

    automatically derived

    RecoveryStore

    pub struct RecoveryStore {
    // private fields
    }

    In-memory terminus state shared by consecutive connections of one host. Select the store only after the host has authenticated the remote principal.

    RecoveryStore::forget

    fn RecoveryStore::forget(self : RecoveryStore, local_container : String, remote : String, name : String, sender : Bool) -> Bool

    Explicitly expire an inactive terminus and release its retained deliveries.

    RecoveryStore::new

    fn RecoveryStore::new(max_links? : Int, max_payload_bytes? : Int) -> RecoveryStore raise AmqpError

    fn RecoveryStore::retained_links(self : RecoveryStore) -> Int

    Section

    pub(all) struct Section {
    descriptor : Int
    body : Value
    }

    SendPlan

    pub(all) struct SendPlan {
    frames : Int
    wire_bytes : Int
    link_credit : UInt
    } derive(
    Debug
    )

    SendPlan::to_repr

    automatically derived

    SessionDiagnostic

    pub(all) struct SessionDiagnostic {
    channel : Int
    remote_channel : Int?
    ending : Bool
    next_incoming : UInt
    next_outgoing : UInt
    incoming_window : UInt
    outgoing_window : UInt
    peer_incoming_window : UInt
    outgoing_unsettled : Int
    incoming_unsettled : Int
    awaiting_sender_confirmation : Int
    links : Array[LinkDiagnostic]
    }

    Window and settlement pressure for one session, detached from mutable state.

    SessionWindow

    pub struct SessionWindow {
    // private fields
    }

    SessionWindow::can_send

    fn SessionWindow::can_send(self : SessionWindow, frames? : Int) -> Bool

    SessionWindow::establish

    fn SessionWindow::establish(self : SessionWindow, next_incoming : UInt, peer_incoming : UInt, peer_outgoing : UInt) -> Unit raise AmqpError

    SessionWindow::new

    fn SessionWindow::new(incoming : UInt, outgoing : UInt, next_outgoing? : UInt) -> SessionWindow raise AmqpError

    SessionWindow::positions

    fn SessionWindow::positions(self : SessionWindow) -> (UInt, UInt)

    SessionWindow::received

    fn SessionWindow::received(self : SessionWindow) -> Unit raise AmqpError

    SessionWindow::refresh

    fn SessionWindow::refresh(self : SessionWindow, incoming : UInt, outgoing : UInt) -> Unit raise AmqpError

    SessionWindow::remaining

    fn SessionWindow::remaining(self : SessionWindow) -> (UInt, UInt, UInt)

    SessionWindow::sent

    fn SessionWindow::sent(self : SessionWindow, frames? : Int) -> Unit raise AmqpError

    SessionWindow::update_peer

    fn SessionWindow::update_peer(self : SessionWindow, next_incoming : UInt?, incoming : UInt, next_outgoing : UInt, outgoing : UInt) -> Unit raise AmqpError

    StreamItem

    pub enum StreamItem {
    Header
    AmqpFrame(Frame)
    }

    SuspendReadiness

    pub(all) enum SuspendReadiness {
    SuspendReady
    LinkNotReady
    ReceiverHasCredit
    DeliveryInProgress
    } derive(Eq,
    Debug
    )

    SuspendReadiness::equal

    automatically derived

    SuspendReadiness::not_equal

    fn SuspendReadiness::not_equal(x : SuspendReadiness, y : SuspendReadiness) -> Bool
    automatically derived

    SuspendReadiness::to_repr

    automatically derived
    pub(all) struct SuspendedLink {
    name : String
    address : String
    sender : Bool
    delivery_count : UInt
    } derive(Eq,
    Debug
    )

    SuspendedLink::equal

    automatically derived

    SuspendedLink::not_equal

    fn SuspendedLink::not_equal(x : SuspendedLink, y : SuspendedLink) -> Bool
    automatically derived

    SuspendedLink::to_repr

    automatically derived

    Value

    pub(all) enum Value {
    Null
    Boolean(Bool)
    UByte(Int)
    UShort(Int)
    UInt(UInt)
    ULong(UInt64)
    ByteValue(Int)
    Short(Int)
    IntValue(Int)
    Long(Int64)
    FloatValue(Float)
    DoubleValue(Double)
    Decimal32(Bytes)
    Decimal64(Bytes)
    Decimal128(Bytes)
    Character(UInt)
    Timestamp(Int64)
    Uuid(Bytes)
    Binary(Bytes)
    Text(String)
    Symbol(String)
    List(Array[Value])
    MapValue(Array[(Value, Value)])
    ArrayValue(Int, Value?, Array[Value])
    Described(Value, Value)
    } derive(
    Debug
    )

    Exact wire domains; ULong/Long never travel through Double.

    Value::as_text

    fn Value::as_text(self : Value) -> String raise AmqpError

    Value::as_uint

    fn Value::as_uint(self : Value) -> UInt raise AmqpError

    Value::to_repr

    automatically derived

    decode_frame

    fn decode_frame(bytes : Bytes, limits? : Limits) -> Frame raise AmqpError

    decode_message

    fn decode_message(bytes : Bytes, limits? : Limits) -> Message raise AmqpError

    decode_value

    fn decode_value(bytes : Bytes, limits? : Limits) -> Value raise AmqpError

    encode_frame

    fn encode_frame(frame : Frame, limits? : Limits) -> Bytes raise AmqpError

    encode_message

    fn encode_message(message : Message, limits? : Limits) -> Bytes raise AmqpError

    encode_value

    fn encode_value(value : Value, limits? : Limits) -> Bytes raise AmqpError

    Canonical full-width forms simplify deterministic output and homogeneous arrays.

    protocol_header

    fn protocol_header() -> Bytes

    serial_distance

    fn serial_distance(first : UInt, last : UInt) -> UInt raise AmqpError

    Serial distance in the unambiguous half of the 32-bit sequence space.

    source

    fn source(address : String) -> Value

    Non-durable, non-dynamic termini. Applications own node creation and lifetime.

    target

    fn target(address : String) -> Value

    validate_protocol_header

    fn validate_protocol_header(bytes : Bytes) -> Unit raise AmqpError