refactor!: rename the project from Monitor to MoShiro [CI]
ci/woodpecker/push/main-amd64-build Pipeline was successful
ci/woodpecker/push/main-amd64-build Pipeline was successful
Namespaces, assemblies, solution, binaries, images, systemd units, config paths, environment variables, protocol methods and the Linux user are all renamed. Breaking: existing databases, node identities and installed units must be recreated.
This commit is contained in:
1 parent
27ac7fb787
commit
2e146d4da7
309 files changed
+1565
-1572
No files matched your search
@@ -0,0 +1,62 @@
|
||||
using Fleet.Core;
|
||||
using Fleet.Server;
|
||||
|
||||
namespace MoShiro.Backend.Application;
|
||||
|
||||
public sealed record AgentRecord(
|
||||
NodeId Id,
|
||||
string Name,
|
||||
NodeStatus Status,
|
||||
byte[] PublicKey,
|
||||
byte[] TlsSpki,
|
||||
string PublicHost,
|
||||
int ProbeTcpPort,
|
||||
IReadOnlyList<int> ProbeUdpPorts,
|
||||
IReadOnlyList<string> Labels,
|
||||
bool PublicVisible,
|
||||
IReadOnlyList<string> Kinds,
|
||||
string? AgentVersion,
|
||||
string? LocalLimitsJson,
|
||||
long TaskVersion,
|
||||
long AppliedTaskVersion,
|
||||
string? RejectedJson,
|
||||
long CreatedAtMs,
|
||||
long? LastSeenAtMs,
|
||||
long RowVersion);
|
||||
|
||||
/// <summary>管理员可以修改的字段(merge-patch 语义:为 null 的字段不改)。</summary>
|
||||
public sealed class AgentPatch
|
||||
{
|
||||
public string? Name { get; init; }
|
||||
|
||||
public IReadOnlyList<string>? Labels { get; init; }
|
||||
|
||||
public string? PublicHost { get; init; }
|
||||
|
||||
public bool? PublicVisible { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>来自 <c>fleet.hello</c> 的信息。</summary>
|
||||
public sealed record AgentHello(
|
||||
IReadOnlyList<string> Kinds,
|
||||
string? AgentVersion,
|
||||
string? LocalLimitsJson,
|
||||
byte[]? TlsSpki,
|
||||
int? ProbeTcpPort,
|
||||
IReadOnlyList<int>? ProbeUdpPorts);
|
||||
|
||||
/// <summary>注册之后 MoShiro 的补充:公开地址和端口。</summary>
|
||||
public sealed record AgentEnrollment(string PublicHost, int ProbeTcpPort, IReadOnlyList<int> ProbeUdpPorts, IReadOnlyList<string> Kinds);
|
||||
|
||||
public sealed record JoinTokenInfo(
|
||||
string Id,
|
||||
string? Note,
|
||||
IReadOnlyList<string> Labels,
|
||||
bool AutoApprove,
|
||||
int MaxUses,
|
||||
int Uses,
|
||||
long ExpiresAtMs,
|
||||
long? RevokedAtMs,
|
||||
long CreatedAtMs);
|
||||
|
||||
public sealed record ProbeRecord(string Id, string Name, byte[] PublicKey, long CreatedAtMs, long? RevokedAtMs);
|
||||
@@ -0,0 +1,64 @@
|
||||
using Fleet.Core;
|
||||
using MoShiro.Protocol;
|
||||
|
||||
namespace MoShiro.Backend.Application;
|
||||
|
||||
/// <summary>原始块的索引信息(块本身在段文件里)。</summary>
|
||||
public sealed record RawChunkMeta(
|
||||
ChunkId ChunkId,
|
||||
NodeId AgentId,
|
||||
string Series,
|
||||
string Kind,
|
||||
TaskId? TaskId,
|
||||
TestId? TestId,
|
||||
int? Phase,
|
||||
long StartTs,
|
||||
int DurationMs,
|
||||
bool Partial,
|
||||
string SegmentPath,
|
||||
long Offset,
|
||||
int Length);
|
||||
|
||||
/// <summary>写入一个原始块:块的完整字节加上用于索引的元数据。</summary>
|
||||
public sealed record RawChunkAppend(RawChunkMeta Meta, ReadOnlyMemory<byte> Bytes, string Day);
|
||||
|
||||
public sealed record RawQuery(
|
||||
NodeId? AgentId = null,
|
||||
string? Series = null,
|
||||
string? Kind = null,
|
||||
TestId? TestId = null,
|
||||
long? FromMs = null,
|
||||
long? ToMs = null,
|
||||
long? AfterStartTs = null,
|
||||
int Limit = 500);
|
||||
|
||||
public sealed record MetricRow(NodeId AgentId, string Series, long WindowStart, bool Partial, byte[] Metrics);
|
||||
|
||||
/// <summary><paramref name="Seq"/> 每次入队递增:处理完成时只删除序号没变的项,处理期间又有迟到的块时不会丢更新。</summary>
|
||||
public sealed record QueueItem(NodeId AgentId, string Series, long WindowStart, long NotBefore, string Reason, long Seq = 0);
|
||||
|
||||
public sealed record MetricVersionRecord(string MetricId, string Fingerprint, long? RecomputeFrom, long? RecomputeCursor);
|
||||
|
||||
/// <summary>指标窗口的层级。数值是窗口宽度(秒)。</summary>
|
||||
public enum MetricLevel
|
||||
{
|
||||
S10 = 10,
|
||||
M1 = 60,
|
||||
M5 = 300,
|
||||
H1 = 3600,
|
||||
}
|
||||
|
||||
public static class MetricLevels
|
||||
{
|
||||
public static readonly IReadOnlyList<MetricLevel> All = [MetricLevel.S10, MetricLevel.M1, MetricLevel.M5, MetricLevel.H1];
|
||||
|
||||
public static long WidthMs(this MetricLevel level) => (long)level * 1000;
|
||||
|
||||
public static string TableName(this MetricLevel level) => level switch
|
||||
{
|
||||
MetricLevel.S10 => "metric_10s",
|
||||
MetricLevel.M1 => "metric_1m",
|
||||
MetricLevel.M5 => "metric_5m",
|
||||
_ => "metric_1h",
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System.Text.Json;
|
||||
using Fleet.Core;
|
||||
using MoShiro.Protocol;
|
||||
|
||||
namespace MoShiro.Backend.Application;
|
||||
|
||||
public sealed record TaskRecord(
|
||||
TaskId Id,
|
||||
string Scope,
|
||||
NodeId? AgentId,
|
||||
TaskId? BaseTaskId,
|
||||
string Kind,
|
||||
string? Target,
|
||||
IReadOnlyDictionary<string, JsonElement> Params,
|
||||
string Schedule,
|
||||
bool Enabled,
|
||||
long UpdatedAtMs,
|
||||
long RowVersion);
|
||||
|
||||
public sealed record TestRecord(
|
||||
TestId Id,
|
||||
NodeId AgentId,
|
||||
ProbeId ProbeId,
|
||||
string Plan,
|
||||
string ParamsJson,
|
||||
string Trigger,
|
||||
string Status,
|
||||
string? ErrorCode,
|
||||
int? Phase,
|
||||
int PhaseCount,
|
||||
long RequestedAtMs,
|
||||
long? StartedAtMs,
|
||||
long? FinishedAtMs);
|
||||
|
||||
/// <summary>测试结果:指标与曲线都以 JSON 保存。</summary>
|
||||
public sealed record TestResultRecord(TestId TestId, byte[] MetricsJson, byte[] SeriesJson);
|
||||
|
||||
public sealed record EventRecord(long Id, NodeId? AgentId, string Kind, long AtMs, string? Detail);
|
||||
Reference in new issue
Block a user