chunkstore: volume delete

- Catalog.DeleteVolume refuses a volume in use (an active HEAD with a
  holder, or the caller's InUseCheck: the CLI asks the blockmaster
  whether it is assigned or served) with volume_in_use, and a volume
  whose snapshot a live fork claims with snapshot_claimed, before any
  write.
- Then: HEAD becomes a tombstone (state deleted, no chunks) by a
  conditional write on the HEAD read, so an attach in between wins;
  VOLUME is marked deleted; every snapshot goes through markDeleting
  (the one mark path) and its name is freed; a fork's claim on its
  parent is released. GC reclaims (the tombstone holds no roots; the
  snapshots drop out after grace). A rerun finishes a partial delete.
- A deleted id is never reused: EnsureVolume (attach, create) refuses a
  deleted VOLUME or HEAD with volume_deleted, and so does Fork for a
  deleted target or source (the source checked after the claim).
- storage: HEAD state "deleted"; the HEAD decoder accepts it only with
  no chunks, holder or detachedBy.
- CLI: sw-block ops chunk volume-delete <vol> --chunk-filer --master;
  gc and volume-delete share masterEvidence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
pingqiuandClaude Opus 5.5 committed 2026-11-15 18:49:18 -08:00
1 parent a73001b121
commit 626c7de1a2
1 file changed
-3
@@ -61,9 +61,6 @@ type VolumeDeleteResult struct {
// DeleteVolume deletes vol (see the header). inUse may be nil.
func (c *Catalog) DeleteVolume(ctx context.Context, vol string, inUse InUseCheck) (VolumeDeleteResult, error) {
res := VolumeDeleteResult{VolumeID: vol, SnapshotsDeleted: []string{}}
if red := true; red { // RED: deletes nothing
return res, nil
}
root, err := c.volRoot(vol)
if err != nil {
return res, err