Files
MoShiro/backend/src/MoShiro.Backend.Storage.Sqlite/StorageServiceCollectionExtensions.cs
T
justme 904ea2b0ae
ci/woodpecker/push/main-amd64-build Pipeline was successful
refactor: remove the runtime binary binding; every release registration path verifies the CI signature [CI]
The hash a node reports about itself cannot be trusted (a swapped binary can
copy the old hash), so the runtime binding only caught files that were replaced
by something that did not lie. Provenance stays where it can be verified: the
signed release manifest (digest) and the signed SHA256SUMS.

- Remove BinaryBindingService, the node_bindings table (schema v15 drops it),
  BinaryPolicy, the handshake hash/manifest fields and the admin binary column.
- Drop the per-platform "binaries" list from the release manifest, the hash
  scripts and the updater's installed.manifest copy.
- ReleaseService.PublishAsync now verifies the release signature, so the admin
  POST /releases route is no longer an unsigned path; tests sign with a test key.
- Docs: section 16 explains why the runtime check is gone.
2026-10-08 18:30:05 +08:00

34 lines
1.8 KiB
C#

using Fleet.Server;
using Microsoft.Extensions.DependencyInjection;
using MoShiro.Backend.Application;
namespace MoShiro.Backend.Storage.Sqlite;
public static class StorageServiceCollectionExtensions
{
/// <summary>注册 SQLite + 段文件存储:实现 Application 的全部存储端口,同时实现 Fleet 的 <see cref="IFleetStore"/>。</summary>
public static IServiceCollection AddMoShiroSqlite(this IServiceCollection services, string dataDirectory)
{
services.AddSingleton(_ => new SqliteDatabase(dataDirectory));
services.AddSingleton<SqliteAgentStore>();
services.AddSingleton<IAgentStore>(p => p.GetRequiredService<SqliteAgentStore>());
services.AddSingleton<IFleetStore>(p => p.GetRequiredService<SqliteAgentStore>());
services.AddSingleton<IJoinTokenStore, SqliteJoinTokenStore>();
services.AddSingleton<IProbeStore, SqliteProbeStore>();
services.AddSingleton<ISettingsStore, SqliteSettingsStore>();
services.AddSingleton<ITaskStore, SqliteTaskStore>();
services.AddSingleton<ITestStore, SqliteTestStore>();
services.AddSingleton<IEventStore, SqliteEventStore>();
services.AddSingleton<IHostStore, SqliteHostStore>();
services.AddSingleton<INodeMetaStore, SqliteNodeMetaStore>();
services.AddSingleton<IAuthStore, SqliteAuthStore>();
services.AddSingleton<IAuditStore, SqliteAuditStore>();
services.AddSingleton<IOperatorSetStore, SqliteOperatorSetStore>();
services.AddSingleton<IRawStore, SqliteRawStore>();
services.AddSingleton<IMetricStore, SqliteMetricStore>();
services.AddSingleton<IStorageHealth, SqliteStorageHealth>();
services.AddSingleton<IBackendUpdateFiles, BackendUpdateFiles>();
return services;
}
}