Erlang 节点高层连接管理(重连退避/心跳/多节点表/连接状态机;核心零依赖,状态/迁移数据化)
| 包 | 内容 |
|---|---|
| thy1016/moonbit-beam-node(根) | 状态机(transitions_gen)+NodeRetry+NodeManager 组合根 |
| logic | 运行时镜像(模型 fn——proof.mbtp 同名 logic fn,金罐对拍根包) |
| mesh | 心跳常驻编排位(轮原语形——长驻循环由消费方组装) |
| protocol | node_fsm.toml(状态机迁移表数据源) |
| server | dist 连接编排(被动 listen 泵+发起向 dist_dial_serve+五钩) |
| gns | GNS 分片名册真件(OTP26 global 语义,见「特性」) |
| cmd | 组合根 demos(accept_gate/gate_demo/probe) |
moon check --deny-warn && moon test --target nativepub(open) trait ConnectPort {
async fn connect(self : Self, node : String) -> Bool
}pub(open) trait NodeEvents {
fn on_nodedown(self : Self, node : String) -> Unit
}pub(open) trait TickPort {
fn now_ms(self : Self) -> Int64
}pub(all) struct HeartbeatPolicy {
interval_ms : Int64
tolerance : Int
}pub struct NodeAccount {
node : String
// private fields
}pub struct NodeManager {
node : String
retry : NodeRetry
conn : &ConnectPort
events : &NodeEvents
// private fields
}impl Debug for NodeManagerfn NodeManager::new(node~ : String, retry~ : NodeRetry, conn~ : &ConnectPort, events~ : &NodeEvents) -> NodeManagerpub struct NodeRegistry {
// private fields
}pub(all) struct NodeRetry {
base_ms : Int
cap_ms : Int
max : Int
}pub struct NodeSupervisor {
// private fields
}impl NodeEvents for NodeSupervisorpub(all) struct RefKey {
a : Int64
b : Int64
c : Int64
}Install
Download zipErlang 节点高层连接管理(重连退避/心跳/多节点表/连接状态机;核心零依赖,状态/迁移数据化)