docs: merge the Fleet docs into backend/fleet/README.md, add TODO.md, unify the Backend compose, fix stale references [CI SKIP]
This commit is contained in:
1 parent
a286a453f4
commit
c974a7dddb
24 files changed
+218
-525
No files matched your search
@@ -0,0 +1,71 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Fleet.Core;
|
||||
|
||||
namespace MoShiro.Protocol;
|
||||
|
||||
[JsonConverter(typeof(ProbeIdJsonConverter))]
|
||||
public readonly record struct ProbeId(string Value)
|
||||
{
|
||||
public const string Prefix = "prb";
|
||||
|
||||
public override string ToString() => Value;
|
||||
}
|
||||
|
||||
[JsonConverter(typeof(TaskIdJsonConverter))]
|
||||
public readonly record struct TaskId(string Value)
|
||||
{
|
||||
public const string Prefix = "tsk";
|
||||
|
||||
public override string ToString() => Value;
|
||||
}
|
||||
|
||||
[JsonConverter(typeof(TestIdJsonConverter))]
|
||||
public readonly record struct TestId(string Value)
|
||||
{
|
||||
public const string Prefix = "tst";
|
||||
|
||||
public override string ToString() => Value;
|
||||
}
|
||||
|
||||
/// <summary>原始块 ID(UUIDv7,同时是发件箱的 msg_id)。</summary>
|
||||
[JsonConverter(typeof(ChunkIdJsonConverter))]
|
||||
public readonly record struct ChunkId(Guid Value)
|
||||
{
|
||||
public static ChunkId New(TimeProvider time) => new(Guid.CreateVersion7(time.GetUtcNow()));
|
||||
|
||||
public override string ToString() => Value.ToString();
|
||||
}
|
||||
|
||||
public static class AgentIds
|
||||
{
|
||||
/// <summary>Agent 就是 Fleet 节点,ID 前缀为 <c>agt</c>。</summary>
|
||||
public const string Prefix = "agt";
|
||||
}
|
||||
|
||||
public sealed class ProbeIdJsonConverter : StringIdJsonConverter<ProbeId>
|
||||
{
|
||||
protected override ProbeId Create(string value) => new(value);
|
||||
|
||||
protected override string GetValue(ProbeId id) => id.Value;
|
||||
}
|
||||
|
||||
public sealed class TaskIdJsonConverter : StringIdJsonConverter<TaskId>
|
||||
{
|
||||
protected override TaskId Create(string value) => new(value);
|
||||
|
||||
protected override string GetValue(TaskId id) => id.Value;
|
||||
}
|
||||
|
||||
public sealed class TestIdJsonConverter : StringIdJsonConverter<TestId>
|
||||
{
|
||||
protected override TestId Create(string value) => new(value);
|
||||
|
||||
protected override string GetValue(TestId id) => id.Value;
|
||||
}
|
||||
|
||||
public sealed class ChunkIdJsonConverter : StringIdJsonConverter<ChunkId>
|
||||
{
|
||||
protected override ChunkId Create(string value) => new(Guid.Parse(value));
|
||||
|
||||
protected override string GetValue(ChunkId id) => id.Value.ToString();
|
||||
}
|
||||
Reference in new issue
Block a user