Skip to content

Conversation

@NikolayS
Copy link
Contributor

Implement auto-deletion modes and deletion protection for branches and snapshots, similar to existing clone features:

  • Add AutoDeleteMode type with three modes:

    • Off (0): auto-deletion disabled
    • Soft (1): auto-delete only if no dependencies
    • Force (2): auto-delete with recursive destroy
  • Update models (Branch, Snapshot, Clone) with:

    • Protected: boolean to prevent deletion
    • DeleteAt: scheduled deletion timestamp
    • AutoDeleteMode: auto-deletion behavior
  • Add API endpoints:

    • PATCH /branch/{branchName}: update branch metadata
    • PATCH /snapshot/{id}: update snapshot metadata
  • Add protection checks to delete operations:

    • Branches cannot be deleted if protected
    • Snapshots cannot be deleted if protected
  • Add background auto-deletion job that:

    • Checks for expired clones, branches, and snapshots
    • Respects auto-delete mode when handling dependencies
    • Force mode deletes dependent entities recursively
    • Soft mode skips if dependencies exist
  • Add entity storage for persisting branch/snapshot metadata

Implement auto-deletion modes and deletion protection for branches and
snapshots, similar to existing clone features:

- Add AutoDeleteMode type with three modes:
  - Off (0): auto-deletion disabled
  - Soft (1): auto-delete only if no dependencies
  - Force (2): auto-delete with recursive destroy

- Update models (Branch, Snapshot, Clone) with:
  - Protected: boolean to prevent deletion
  - DeleteAt: scheduled deletion timestamp
  - AutoDeleteMode: auto-deletion behavior

- Add API endpoints:
  - PATCH /branch/{branchName}: update branch metadata
  - PATCH /snapshot/{id}: update snapshot metadata

- Add protection checks to delete operations:
  - Branches cannot be deleted if protected
  - Snapshots cannot be deleted if protected

- Add background auto-deletion job that:
  - Checks for expired clones, branches, and snapshots
  - Respects auto-delete mode when handling dependencies
  - Force mode deletes dependent entities recursively
  - Soft mode skips if dependencies exist

- Add entity storage for persisting branch/snapshot metadata
- Fix LocalTime conversion in base.go and entity_storage.go (use .Time field)
- Fix CLI actions.go to use pointer for Protected field
- Fix routes.go to use updatedClone.Protected for telemetry event
- Add thinclones import and DestroyOptions parameter in auto_delete.go
- Fix clone_test.go to handle Protected pointer properly
- Break long function signatures into multiple lines (base.go, entity_storage.go)
- Fix wsl issues by adding blank lines before if statements
- Pre-allocate slices in canDeleteSnapshot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants