refactor: split node agent and Go control plane

This commit is contained in:
2026-09-11 16:57:31 +08:00
parent 078c22c73b
commit c86ba9c4d7
129 changed files with 654 additions and 77 deletions
@@ -0,0 +1,32 @@
namespace WxAgent.Core;
public sealed record AccountDatabaseEntry(string Fingerprint, string RelativePath);
/// <summary>Decides which verified keys may be reused from cache, avoiding repeated memory scans for cached accounts.</summary>
public static class KeyCachePlanner
{
public static string Key(string accountFingerprint, string relativePath) =>
$"{accountFingerprint}|{relativePath}";
public static IReadOnlySet<string> VerifiedKeys(IEnumerable<AccountKeySet> cached)
{
var set = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
foreach (var account in cached)
foreach (var database in account.Databases)
set.Add(Key(account.AccountRootFingerprint, database.RelativePath));
return set;
}
public static bool HasPending(IEnumerable<AccountDatabaseEntry> discovered, IReadOnlySet<string> verified)
{
foreach (var entry in discovered)
{
if (!verified.Contains(Key(entry.Fingerprint, entry.RelativePath)))
{
return true;
}
}
return false;
}
}