mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-31 10:32:24 +00:00
4ecb2e47e7
Persist the scheduled deletion deadline in the Local (StoredMasterKey / MasterKeyInfo) and Vault KV2 (VaultKeyData) records as an optional, serde(default) field so old records keep deserializing, surface it from describe_key, and clear it on cancel. Previously both backends lost the deadline on restart and KV2 describe always reported none. Add KmsBackend::remove_expired_key: a race-safe removal primitive that re-checks state and deadline under the backend's own synchronization (per-key write lock on Local), writes a tombstone (Deleted/Unavailable record) before destroying material so a crashed removal can simply be re-run, treats an already-removed key as success, and never auto-removes pending records without a persisted deadline. The user-facing force delete paths now write the same tombstone first. Add a background deletion worker owned by each KmsServiceManager service version: spawned at publish time when the backend supports deletion scheduling, cancelled on stop/restart/reconfigure via a CancellationToken, and sweeping every 60s for expired pending deletions and leftover tombstones. Sweeps are stateless and idempotent, so they are restart-safe and safe to run on every node concurrently without leader election. Before removing anything the worker refuses keys that are still the configured default key or that an injectable DeletionReferenceChecker reports as referenced. Refs rustfs/backlog#1571 (part of rustfs/backlog#1562)