chore: initial project import

This commit is contained in:
justme committed 2026-10-04 21:46:39 +08:00
commit 26620707a0
347 files changed
+56172

No files matched your search

@@ -0,0 +1,28 @@
using Fleet.Server;
using Monitor.Backend.Application;
using Monitor.Protocol;
namespace Monitor.Backend.Gateway;
/// <summary>
/// RawChunk 收件箱(二进制通道 16):持久化之后才返回,Fleet 随后才回复 ACK,按 chunk_id 去重。
/// 永远不可能被接受的块(损坏、冒名、未知 Kind)也确认掉并记录原因,否则节点会无限重发。
/// </summary>
public sealed class RawChunkInbox : IInbox
{
private readonly IngestService _ingest;
public RawChunkInbox(IngestService ingest)
{
_ingest = ingest;
}
public byte Channel => MonitorChannels.RawChunk;
public async ValueTask<InboxOutcome> HandleAsync(NodeRecord node, Guid msgId, ReadOnlyMemory<byte> payload, CancellationToken ct) =>
await _ingest.IngestAsync(node.Id, msgId, payload, ct) switch
{
IngestOutcome.Stored => InboxOutcome.Stored,
_ => InboxOutcome.Duplicate,
};
}