backup

package
v0.0.0-...-1746241 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2026 License: MIT Imports: 24 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Backup Service

Responsibility

Backup listing, creation, upload, restore, download authorization and deletion orchestration.

Structure

  • service.go — service descriptor and constructor.
  • config.go — small service config/defaults boundary.
  • forms/ — create/upload validation and submit flows.
  • apis/ — /api/backups route binding and HTTP handlers.
  • models/ — backup read-side DTOs returned by the API.
  • queries/ — reserved for future backup metadata queries.
  • migrations/ — explicit backup migration pack boundary. No DB schema is registered yet.
  • runtime.go — filesystem/runtime operations and active backup state checks.

Dependencies

  • core.App for backup filesystem, app backup/restore operations and app store state.
  • services/base/forms for submit interceptors.
  • services/file + services/team for download token and admin-team authorization checks.
  • tools/filesystem and uploaded-file helpers.

Public flows

  • GET /api/backups — list backup archives.
  • POST /api/backups — create a new backup archive.
  • POST /api/backups/upload — upload a backup archive.
  • GET /api/backups/:key?token=... — download an archive after file-token authorization.
  • POST /api/backups/:key/restore — start asynchronous restore.
  • DELETE /api/backups/:key — delete an archive when it is not actively used.

Migration notes

Backups currently live in the configured backups filesystem, so the service does not need backup-owned tables. migrations/register.go intentionally registers no migrations for now, but keeps the domain migration boundary ready for future backup metadata/audit tables.

Documentation

Index

Constants

View Source
const StoreKeyActiveBackup = "@activeBackup"

Variables

View Source
var Descriptor = servicebase.Descriptor{
	Name:    "backup",
	Purpose: "Wraps backup listing, creation, upload, restore and deletion workflows.",
	Dependencies: []string{
		"core.App",
		"services/backup/apis",
		"services/backup/forms",
		"services/backup/models",
		"services/base/forms",
		"file service",
		"team service",
		"filesystem",
	},
	RuntimeState: []string{
		"observes active backup/restore state via app store",
		"uses configured backups filesystem for archive storage",
	},
	Operations: []string{
		"Bind HTTP routes via services/backup/apis",
		"HasActiveBackup",
		"List",
		"NewCreateForm",
		"SubmitCreate",
		"NewUploadForm",
		"SubmitUpload",
		"CanDelete",
		"CanDownload",
		"BackupExists",
		"RestoreAsync",
		"Delete",
	},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled bool
}

func DefaultConfig

func DefaultConfig() Config

type Service

type Service struct {
	servicebase.Service
}

func New

func New(app core.App) *Service

func (*Service) BackupExists

func (s *Service) BackupExists(key string) (bool, error)

func (*Service) CanDelete

func (s *Service) CanDelete(key string) bool

func (*Service) CanDownload

func (s *Service) CanDownload(fileToken string) error

func (*Service) CreateBackup

func (s *Service) CreateBackup(ctx context.Context, name string) error

func (*Service) Delete

func (s *Service) Delete(key string) error

func (*Service) HasActiveBackup

func (s *Service) HasActiveBackup() bool

func (*Service) List

func (s *Service) List() ([]backupmodels.BackupFileInfo, error)

func (*Service) NewCreateForm

func (s *Service) NewCreateForm() *forms.BackupCreate

func (*Service) NewUploadForm

func (s *Service) NewUploadForm() *forms.BackupUpload

func (*Service) RestoreAsync

func (s *Service) RestoreAsync(key string)

func (*Service) RestoreBackup

func (s *Service) RestoreBackup(ctx context.Context, name string) error

func (*Service) SubmitCreate

func (s *Service) SubmitCreate(
	form *forms.BackupCreate,
	interceptors ...baseforms.InterceptorFunc[string],
) error

func (*Service) SubmitUpload

func (s *Service) SubmitUpload(
	form *forms.BackupUpload,
	interceptors ...baseforms.InterceptorFunc[*filesystem.File],
) error

Directories

Path Synopsis
Package apis owns the HTTP endpoints for the backup service.
Package apis owns the HTTP endpoints for the backup service.
Package migrations contains backup-owned schema migrations.
Package migrations contains backup-owned schema migrations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL