using Fleet.Rpc; namespace MoShiro.Protocol; /// /// 所有方法和二进制通道的方向声明,单一真源(框架的 fleet.* 见 )。 /// 新增一个方法:在 里加名字和参数,在这里加一行声明,再在对应一侧注册处理函数; /// 声明了但没人处理、或者处理了但没声明,都会被测试和启动时的检查发现。 /// 同一个方法名只有一个发起方;节点面是服务端和节点,对等面是拨号方和监听方。所有节点是同一种角色: /// 能做什么由节点的配置(是否监听)和 Backend 下发的期望状态决定,声明表不区分节点类型。 /// public static class MoShiroMethodTable { public static readonly MethodTable Table = MethodTable.Combine( FleetMethodTable.Table, new MethodTable( [ // 节点面:Backend → 节点 MethodSpec.Request(MoShiroMethods.TestRun, RpcSide.Server), MethodSpec.Request(MoShiroMethods.TestCancel, RpcSide.Server), MethodSpec.Request(MoShiroMethods.DialerDisconnect, RpcSide.Server), MethodSpec.Request(MoShiroMethods.LogsFetch, RpcSide.Server), MethodSpec.Notification(MoShiroMethods.LinkRetry, RpcSide.Server), MethodSpec.Notification(MoShiroMethods.UpdateOffer, RpcSide.Server), MethodSpec.Notification(MoShiroMethods.UpdateApply, RpcSide.Server), MethodSpec.Notification(MoShiroMethods.Schedule, RpcSide.Server), // 节点面:节点 → Backend MethodSpec.Notification(MoShiroMethods.TestStatus, RpcSide.Node), MethodSpec.Notification(MoShiroMethods.Event, RpcSide.Node), MethodSpec.Notification(MoShiroMethods.Host, RpcSide.Node), // 对等面:拨号方 → 监听方 MethodSpec.Request(MoShiroMethods.Clock, RpcSide.Dialer), // 对等面:监听方 → 拨号方 MethodSpec.Request(MoShiroMethods.TestPhase, RpcSide.Listener), MethodSpec.Request(MoShiroMethods.TestPhaseEnd, RpcSide.Listener), MethodSpec.Notification(MoShiroMethods.TestAbort, RpcSide.Listener), ], [ // 原始块:节点往 Backend 发;列块:拨号方经对等会话发给监听方 new ChannelSpec(MoShiroChannels.RawChunk, RpcSide.Node), new ChannelSpec(MoShiroChannels.ColumnBlock, RpcSide.Dialer), ])); }