fengling-platform/.planning/phases/03-/03-gateway-infrastructure-update-PLAN.md

3.6 KiB
Raw Permalink Blame History

phase plan type wave depends_on files_modified autonomous requirements must_haves
03- 03 execute 2
03-gateway-cluster-entities
03-gateway-route-update
Fengling.Platform.Infrastructure/PlatformDbContext.cs
Fengling.Platform.Infrastructure/IInstanceStore.cs
Fengling.Platform.Infrastructure/InstanceStore.cs
Fengling.Platform.Infrastructure/IClusterStore.cs
Fengling.Platform.Infrastructure/ClusterStore.cs
true
GATEWAY-RESTRUCTURE-05
GATEWAY-RESTRUCTURE-06
truths artifacts
PlatformDbContext 包含GwCluster DbSet
IClusterStore 替代 IInstanceStore
path provides
Fengling.Platform.Infrastructure/PlatformDbContext.cs 更新的 DbContext
path provides min_lines
Fengling.Platform.Infrastructure/IClusterStore.cs 集群存储接口 40

计划 03: 更新 Infrastructure 层

目标

更新 PlatformDbContext 配置,创建 IClusterStore 接口和实现,替换原有的 IInstanceStore。

目的: 支持新的 GwCluster 聚合根,移除已废弃的实体 DbSet。

输出: 更新的 PlatformDbContext、IClusterStore/ClusterStore。

上下文

@Fengling.Platform.Infrastructure/PlatformDbContext.cs @Fengling.Platform.Infrastructure/IInstanceStore.cs @Fengling.Platform.Infrastructure/RouteStore.cs (参考模式)

任务

任务 1: 更新 PlatformDbContext Fengling.Platform.Infrastructure/PlatformDbContext.cs 1. 移除 DbSet - 移除 DbSet<GwTenant> GwTenants - 移除 DbSet<GwServiceInstance> GwServiceInstances
  1. 添加 DbSet

    • 添加 DbSet<GwCluster> GwClusters
  2. 在 OnModelCreating 中配置:

    • GwCluster 聚合根配置
    • OwnsMany GwDestinations 配置
    • OwnsOne GwHealthCheckConfig 配置
    • OwnsOne GwSessionAffinityConfig 配置

参考 03-RESEARCH.md 中的 EF Core 配置代码。 dotnet build 通过 PlatformDbContext 已更新

任务 2: 创建 IClusterStore 接口 Fengling.Platform.Infrastructure/IClusterStore.cs 创建 IClusterStore 接口,包含: - FindByIdAsync, FindByClusterIdAsync - GetAllAsync, GetPagedAsync, GetCountAsync - CreateAsync, UpdateAsync, DeleteAsync - AddDestinationAsync, UpdateDestinationAsync, RemoveDestinationAsync

参考 IRouteStore 模式。 文件可编译 IClusterStore 接口已创建

任务 3: 创建 ClusterStore 实现 Fengling.Platform.Infrastructure/ClusterStore.cs 创建 ClusterStore<TContext> 实现 IClusterStore - 泛型约束: where TContext : PlatformDbContext - 实现所有接口方法 - 支持软删除 - 支持内嵌 Destination 的 CRUD

参考 RouteStore 模式。 dotnet build 通过 ClusterStore 实现已创建

任务 4: 删除 IInstanceStore 和 InstanceStore Fengling.Platform.Infrastructure/IInstanceStore.cs Fengling.Platform.Infrastructure/InstanceStore.cs 删除这两个文件: - 已被 IClusterStore/ClusterStore 替代 - 确认无其他引用 dotnet build 通过 旧文件已删除

验证

  • PlatformDbContext 已更新
  • IClusterStore/ClusterStore 已创建
  • 旧文件已删除
  • Build 无错误通过

成功标准

Infrastructure 层更新完成,准备更新 DI 注册。