Skip to content

Add backup command#219

Open
peterjan wants to merge 3 commits into
pj/snapshot-orphan-guardfrom
pj/backup-commands
Open

Add backup command#219
peterjan wants to merge 3 commits into
pj/snapshot-orphan-guardfrom
pj/backup-commands

Conversation

@peterjan

@peterjan peterjan commented Jun 24, 2026

Copy link
Copy Markdown
Member

This PR adds a backup command to create/list/delete snapshots.

Small example of the usage:

$ s3d backup create /var/backups/s3d/2026-06-24.sqlite3
Created backup at /var/backups/s3d/2026-06-24.sqlite3

$ s3d backup list
1    2026-06-24T13:50:01+02:00    1 objects    /var/backups/s3d/2026-06-24.sqlite3

$ s3d backup delete 1
Deleted backup 1

$ s3d backup list
No backups found.

References #202

@peterjan peterjan self-assigned this Jun 24, 2026
@peterjan peterjan requested a review from Copilot June 24, 2026 14:00
@github-project-automation github-project-automation Bot moved this to In Progress in Sia Jun 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds backup management capabilities to s3d by exposing snapshot list/delete operations through the admin API and wiring corresponding s3d backup CLI subcommands, building on the existing SQLite snapshot/backup implementation.

Changes:

  • Extend the backend interface and Sia implementation to support listing and deleting recorded snapshot backups.
  • Add new admin API endpoints to list backups and delete a backup snapshot; update OpenAPI accordingly.
  • Add s3d backup create|list|delete CLI commands and a changeset entry documenting the feature.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
sia/sia.go Adds backend methods for listing/deleting snapshots and maps store snapshot records to admin API DTOs.
s3/s3.go Extends admin backend interface and registers new admin API routes for backup listing/deletion.
s3/s3_test.go Updates admin API tests to validate list/delete snapshot endpoints via HTTP.
s3/admin.go Introduces Snapshot response type and handlers for listing/deleting snapshots.
openapi.yml Documents the new /system/sqlite3/backups list and delete endpoints plus Snapshot schema.
cmd/s3d/main.go Wires the new backup command and its subcommands into the CLI command tree.
cmd/s3d/backup.go Implements the `s3d backup create
.changeset/backup_commands.md Records the user-facing change for release tooling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sia/sia.go Outdated
Comment thread s3/admin.go
Comment thread cmd/s3d/backup.go
Comment thread cmd/s3d/backup.go
Comment thread openapi.yml
Comment thread cmd/s3d/main.go
@peterjan peterjan force-pushed the pj/backup-commands branch from 3c98e1e to cfd57b9 Compare June 25, 2026 13:00
@peterjan peterjan force-pushed the pj/backup-commands branch from cfd57b9 to 9569274 Compare June 25, 2026 13:23
@peterjan peterjan marked this pull request as ready for review June 26, 2026 07:17
@chris124567 chris124567 mentioned this pull request Jun 26, 2026
@chris124567 chris124567 requested a review from Copilot June 26, 2026 18:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Comment thread s3/s3.go
Comment on lines +397 to +399
"POST /system/sqlite3/backup": s3.handleBackupSQLite3,
"GET /system/sqlite3/backups": s3.handleListSnapshots,
"DELETE /system/sqlite3/backups/:id": s3.handleDeleteSnapshot,
Comment thread sia/sia.go
Comment on lines +341 to +344
// DeleteSnapshot removes the snapshot with the given id.
func (s *Sia) DeleteSnapshot(_ context.Context, snapshotID int64) error {
return s.store.DeleteSnapshot(snapshotID)
}
Comment thread openapi.yml
Comment on lines 102 to +106
description: The backup could not be created.
/system/sqlite3/backups:
get:
tags:
- system

@chris124567 chris124567 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except for what Copilot said about NewAdmin docstring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

4 participants