feat(backups): 主人和管理员可删除单个备份,归档由 reaper 下一轮删除、异地副本随下次同步删除,恢复可能在读时拒绝
This commit is contained in:
23 files changed
+969
-45
No files matched your search
@@ -1058,6 +1058,20 @@ func (f *fakeRepo) BackupByID(_ context.Context, id string) (*BackupRecord, erro
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
func (f *fakeRepo) ExpireBackup(_ context.Context, id string, at time.Time) error {
|
||||
for i := range f.backups {
|
||||
b := &f.backups[i]
|
||||
if b.view.Status == "present" && b.view.ID == id {
|
||||
b.view.Status = "expired"
|
||||
if at.Before(b.view.ExpiresAt) {
|
||||
b.view.ExpiresAt = at
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return ErrNotFound
|
||||
}
|
||||
|
||||
// ---- staff / session auth fakes (spec §B, passwordless) ----
|
||||
// Each method mirrors the PGRepo contract: a returned StaffUser is copied so a
|
||||
// test cannot mutate the stored row by reference, SessionUser re-reads the
|
||||
|
||||
Reference in new issue
Block a user