agent: unify listening and dialing with directed mutual measurements
Replace Probe with Agent across node runtime, Fleet contracts, backend state, API and storage. Report incoming sessions and outgoing link health through each Agent uplink, and retain directed link controls and retry. Update protocol fixtures and end-to-end coverage for the unified model; accept requested cancellation during the Fleet timeout test cleanup.
This commit is contained in:
1 parent
d5ebf29e57
commit
ad5efc62ff
206 files changed
+4202
-4964
No files matched your search
@@ -2,23 +2,12 @@ using Fleet.Rpc;
|
||||
|
||||
namespace MoShiro.Protocol;
|
||||
|
||||
/// <summary>节点的角色。服务端按节点 ID 的前缀判断;声明表用它限定哪些角色可以参与某个方法或通道。</summary>
|
||||
public static class NodeRoles
|
||||
{
|
||||
public const string Agent = "agent";
|
||||
public const string Probe = "probe";
|
||||
|
||||
public static string? Of(string nodeId) =>
|
||||
nodeId.StartsWith(AgentIds.Prefix, StringComparison.Ordinal) ? Agent
|
||||
: nodeId.StartsWith(ProbeId.Prefix, StringComparison.Ordinal) ? Probe
|
||||
: null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 所有方法和二进制通道的方向声明,单一真源(框架的 <c>fleet.*</c> 见 <see cref="FleetMethodTable"/>)。
|
||||
/// 新增一个方法:在 <see cref="MoShiroMethods"/> 里加名字和参数,在这里加一行声明,再在对应一侧注册处理函数;
|
||||
/// 声明了但没人处理、或者处理了但没声明,都会被测试和启动时的检查发现。
|
||||
/// 同一个方法名只有一个发起方;节点面是服务端和节点(B 和 A、P),对等面是 Probe(拨号方)和 Agent(监听方)。
|
||||
/// 同一个方法名只有一个发起方;节点面是服务端和节点,对等面是拨号方和监听方。所有节点是同一种角色:
|
||||
/// 能做什么由节点的配置(是否监听)和 Backend 下发的期望状态决定,声明表不区分节点类型。
|
||||
/// </summary>
|
||||
public static class MoShiroMethodTable
|
||||
{
|
||||
@@ -27,30 +16,30 @@ public static class MoShiroMethodTable
|
||||
new MethodTable(
|
||||
[
|
||||
// 节点面:Backend → 节点
|
||||
MethodSpec.Request(MoShiroMethods.TestRun, RpcSide.Server, NodeRoles.Agent),
|
||||
MethodSpec.Request(MoShiroMethods.TestCancel, RpcSide.Server, NodeRoles.Agent),
|
||||
MethodSpec.Request(MoShiroMethods.ProbeDisconnect, RpcSide.Server, NodeRoles.Agent),
|
||||
MethodSpec.Notification(MoShiroMethods.ProbeLinkRetry, RpcSide.Server, NodeRoles.Probe),
|
||||
MethodSpec.Request(MoShiroMethods.TestRun, RpcSide.Server),
|
||||
MethodSpec.Request(MoShiroMethods.TestCancel, RpcSide.Server),
|
||||
MethodSpec.Request(MoShiroMethods.DialerDisconnect, 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, NodeRoles.Agent),
|
||||
MethodSpec.Notification(MoShiroMethods.Event, RpcSide.Node, NodeRoles.Agent),
|
||||
MethodSpec.Notification(MoShiroMethods.Host, RpcSide.Node), // Agent 和 Probe 都上报主机资源占用的汇总
|
||||
MethodSpec.Notification(MoShiroMethods.TestStatus, RpcSide.Node),
|
||||
MethodSpec.Notification(MoShiroMethods.Event, RpcSide.Node),
|
||||
MethodSpec.Notification(MoShiroMethods.Host, RpcSide.Node),
|
||||
|
||||
// 对等面:Probe(拨号方)→ Agent(监听方)
|
||||
// 对等面:拨号方 → 监听方
|
||||
MethodSpec.Request(MoShiroMethods.Clock, RpcSide.Dialer),
|
||||
|
||||
// 对等面:Agent → Probe
|
||||
// 对等面:监听方 → 拨号方
|
||||
MethodSpec.Request(MoShiroMethods.TestPhase, RpcSide.Listener),
|
||||
MethodSpec.Request(MoShiroMethods.TestPhaseEnd, RpcSide.Listener),
|
||||
MethodSpec.Notification(MoShiroMethods.TestAbort, RpcSide.Listener),
|
||||
],
|
||||
[
|
||||
// 原始块:只有 Agent 往 Backend 发;列块:Probe 经对等会话发给 Agent
|
||||
new ChannelSpec(MoShiroChannels.RawChunk, RpcSide.Node, [NodeRoles.Agent]),
|
||||
// 原始块:节点往 Backend 发;列块:拨号方经对等会话发给监听方
|
||||
new ChannelSpec(MoShiroChannels.RawChunk, RpcSide.Node),
|
||||
new ChannelSpec(MoShiroChannels.ColumnBlock, RpcSide.Dialer),
|
||||
]));
|
||||
}
|
||||
Reference in new issue
Block a user