fix(servers): 同名重建服务器时旧行从头开始,不再继承上一任的主人、别名、allowlist 和回收警告

This commit is contained in:
Lemon-miaow committed 2026-09-27 02:30:54 +08:00
1 parent 7aa5034c1a
commit d807fd5887
4 files changed
+130 -10

No files matched your search

+7 -4
View File
@@ -387,10 +387,13 @@ type Repo interface {
BackupStoreBytes(ctx context.Context) (int64, error)
// SeedServer inserts the business-layer rows for a newly created server (spec
// §15): a servers row (owner_id NULL — claimed later, spec §9.3) and its
// subdomain alias, both idempotent. The resource cache (cpuMilli, memoryMB,
// storageMB) is seeded alongside so QuotaCheck can aggregate per-owner usage
// without cross-system CRD reads. It returns ErrConflict if the subdomain is
// already bound to a different server.
// subdomain alias. A row left by an earlier server of the same name starts over:
// no owner, claim, activity clock, reaper warnings, other aliases or allowlist
// carry over, and a retried create lands on the same fresh state. The resource
// cache (cpuMilli, memoryMB, storageMB) is seeded alongside so QuotaCheck can
// aggregate per-owner usage without cross-system CRD reads. It returns
// ErrConflict, and changes nothing, if the subdomain is already bound to a
// different server.
SeedServer(ctx context.Context, name, subdomain string, cpuMilli, memoryMB, storageMB int) error
// UpdateServerResources updates the resource cache columns for a server
// after a spec mutation (spec §7 PATCH), so the per-owner aggregate stays in