Erlang 节点高层连接管理(重连退避/心跳/多节点表/连接状态机;核心零依赖,状态/迁移数据化)
| 包 | 内容 |
|---|---|
| thy1016/moonbit-beam-node | 状态机+NodeRetry+NodeManager 组合根(唯一包) |
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
}fn 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 节点高层连接管理(重连退避/心跳/多节点表/连接状态机;核心零依赖,状态/迁移数据化)