A probe now links to the backend like an agent (probe.json carries the server address). The backend sends the agent list as desired state and the probe reports its platform and build in its own hello. The agent no longer relays the list or the probe platform. Existing probes must be re-created.
30 lines
1.1 KiB
C#
30 lines
1.1 KiB
C#
using Fleet.Core;
|
|
using Monitor.Protocol;
|
|
|
|
namespace Monitor.Backend.Application;
|
|
|
|
/// <summary>
|
|
/// Application 通往 Agent 连接的端口(由 Gateway 实现):下发状态变化、发起按需测试。
|
|
/// </summary>
|
|
public interface IAgentGateway
|
|
{
|
|
IReadOnlyCollection<NodeId> OnlineAgents { get; }
|
|
|
|
bool IsOnline(NodeId agent);
|
|
|
|
/// <summary>某个 Agent 的期望状态变了:Gateway 重新计算并推送。</summary>
|
|
void NotifyTaskSetChanged(NodeId agent);
|
|
|
|
void NotifyAllTaskSetsChanged();
|
|
|
|
/// <summary>失败时错误码为 <c>probe_offline</c>、<c>test_busy</c>、<c>agent_offline</c> 等。</summary>
|
|
ValueTask<Result<bool>> RunTestAsync(NodeId agent, TestRunParams run, CancellationToken ct);
|
|
|
|
ValueTask CancelTestAsync(NodeId agent, TestId test, CancellationToken ct);
|
|
|
|
/// <summary>让 Agent 断开某个 Probe 的会话。返回 Agent 是否真的有这个会话。</summary>
|
|
ValueTask<Result<bool>> DisconnectProbeAsync(NodeId agent, ProbeId probe, CancellationToken ct);
|
|
|
|
ValueTask DisconnectAsync(NodeId agent, string reason, CancellationToken ct);
|
|
}
|