Documentation
¶
Index ¶
- func MarshalManifest(m *Manifest) ([]byte, error)
- type BackupOptions
- type BackupResult
- type BackupSummary
- type DatabaseInfo
- type Manager
- func (m *Manager) CreateBackup(ctx context.Context, opts BackupOptions) (*BackupResult, error)
- func (m *Manager) DeleteBackup(ctx context.Context, backupID string) error
- func (m *Manager) GetBackup(ctx context.Context, backupID string) (*Manifest, error)
- func (m *Manager) GetProgress() *Progress
- func (m *Manager) ListBackups(ctx context.Context) ([]BackupSummary, error)
- func (m *Manager) RestoreBackup(ctx context.Context, opts RestoreOptions) (*RestoreResult, error)
- type ManagerConfig
- type Manifest
- type MeasurementInfo
- type Progress
- type RestoreOptions
- type RestoreResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalManifest ¶
MarshalManifest serializes a manifest to JSON.
Types ¶
type BackupOptions ¶
type BackupOptions struct {
IncludeMetadata bool // back up the SQLite database
IncludeConfig bool // back up arc.toml
}
BackupOptions controls what gets backed up and where.
type BackupResult ¶
BackupResult is returned when a backup completes.
type BackupSummary ¶
type BackupSummary struct {
BackupID string `json:"backup_id"`
CreatedAt time.Time `json:"created_at"`
BackupType string `json:"backup_type"`
TotalFiles int64 `json:"total_files"`
TotalBytes int64 `json:"total_size_bytes"`
DatabaseCount int `json:"database_count"`
}
BackupSummary is a compact representation of a backup for listing.
func SummaryFromManifest ¶
func SummaryFromManifest(m *Manifest) BackupSummary
SummaryFromManifest creates a compact summary from a full manifest.
type DatabaseInfo ¶
type DatabaseInfo struct {
Name string `json:"name"`
Measurements []MeasurementInfo `json:"measurements"`
FileCount int `json:"file_count"`
SizeBytes int64 `json:"size_bytes"`
}
DatabaseInfo describes a single database within a backup.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager orchestrates backup and restore operations.
func NewManager ¶
func NewManager(cfg *ManagerConfig) (*Manager, error)
NewManager creates a new backup manager.
func (*Manager) CreateBackup ¶
func (m *Manager) CreateBackup(ctx context.Context, opts BackupOptions) (*BackupResult, error)
CreateBackup performs a full backup. It runs synchronously; the API layer launches it in a goroutine and exposes progress via GetProgress().
func (*Manager) DeleteBackup ¶
DeleteBackup removes all files for a backup from the default backup storage.
func (*Manager) GetProgress ¶
GetProgress returns the current active operation progress, or nil if idle.
func (*Manager) ListBackups ¶
func (m *Manager) ListBackups(ctx context.Context) ([]BackupSummary, error)
ListBackups returns summaries of all available backups in the default backup storage.
func (*Manager) RestoreBackup ¶
func (m *Manager) RestoreBackup(ctx context.Context, opts RestoreOptions) (*RestoreResult, error)
RestoreBackup restores data from a backup. It runs synchronously; the API layer launches it in a goroutine and exposes progress via GetProgress().
type ManagerConfig ¶
type ManagerConfig struct {
DataStorage storage.Backend
BackupPath string // local directory for backups
SQLiteDBPath string
ConfigPath string
Logger zerolog.Logger
}
ManagerConfig holds configuration for creating a backup manager.
type Manifest ¶
type Manifest struct {
Version string `json:"version"`
BackupID string `json:"backup_id"`
CreatedAt time.Time `json:"created_at"`
BackupType string `json:"backup_type"` // "full" (future: "incremental")
Databases []DatabaseInfo `json:"databases"`
TotalFiles int64 `json:"total_files"`
TotalSizeBytes int64 `json:"total_size_bytes"`
HasMetadata bool `json:"has_metadata"`
HasConfig bool `json:"has_config"`
}
Manifest describes the contents of a backup.
func UnmarshalManifest ¶
UnmarshalManifest deserializes a manifest from JSON.
type MeasurementInfo ¶
type MeasurementInfo struct {
Name string `json:"name"`
FileCount int `json:"file_count"`
SizeBytes int64 `json:"size_bytes"`
}
MeasurementInfo describes a single measurement within a database backup.
type Progress ¶
type Progress struct {
Operation string `json:"operation"` // "backup" or "restore"
BackupID string `json:"backup_id"`
Status string `json:"status"` // "running", "completed", "failed"
TotalFiles int64 `json:"total_files"`
ProcessedFiles int64 `json:"processed_files"`
TotalBytes int64 `json:"total_bytes"`
ProcessedBytes int64 `json:"processed_bytes"`
StartedAt time.Time `json:"started_at"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
Error string `json:"error,omitempty"`
}
Progress tracks the state of a running backup or restore operation.
type RestoreOptions ¶
type RestoreOptions struct {
BackupID string
RestoreData bool // restore parquet files
RestoreMetadata bool // restore SQLite database
RestoreConfig bool // restore arc.toml (requires restart)
}
RestoreOptions controls what gets restored and from where.
type RestoreResult ¶
RestoreResult is returned when a restore completes.