Documentation
¶
Overview ¶
backupinterface.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitGlobalBackupManager ¶
func InitGlobalBackupManager(config BackupConfig) error
InitGlobalBackupManager initializes the global backup manager instance
func ReloadBackupManagerFromConfig ¶
func ReloadBackupManagerFromConfig() error
ReloadBackupManagerFromConfig reloads the global backup manager with the current config. This should be called whenever the config is changed.
Types ¶
type BackupConfig ¶
type BackupConfig struct {
WorldName string
BackupDir string
SafeBackupDir string
RetentionPolicy RetentionPolicy
WaitTime time.Duration
}
BackupConfig holds configuration for backup operations
func GetBackupConfig ¶
func GetBackupConfig() BackupConfig
GetBackupConfig returns a properly configured BackupConfig
type BackupGroup ¶
type BackupGroup struct {
Index int
BinFile string
XMLFile string
MetaFile string
ModTime time.Time
}
BackupGroup represents a set of backup files
type BackupManager ¶
type BackupManager struct {
// contains filtered or unexported fields
}
BackupManager manages backup operations
var GlobalBackupManager *BackupManager
GlobalBackupManager is the singleton instance of the backup manager
func NewBackupManager ¶
func NewBackupManager(cfg BackupConfig) *BackupManager
NewBackupManager creates a new BackupManager instance
func (*BackupManager) Cleanup ¶
func (m *BackupManager) Cleanup() error
Cleanup performs backup cleanup according to retention policy
func (*BackupManager) Initialize ¶
func (m *BackupManager) Initialize() error
Initialize sets up required directories
func (*BackupManager) ListBackups ¶
func (m *BackupManager) ListBackups(limit int) ([]BackupGroup, error)
ListBackups returns information about available backups limit: number of recent backups to return (0 for all)
func (*BackupManager) RestoreBackup ¶
func (m *BackupManager) RestoreBackup(index int) error
RestoreBackup restores a backup with the given index
func (*BackupManager) Shutdown ¶
func (m *BackupManager) Shutdown()
Shutdown stops all backup operations
func (*BackupManager) Start ¶
func (m *BackupManager) Start() error
Start begins the backup monitoring and cleanup routines
type HTTPHandler ¶
type HTTPHandler struct {
// contains filtered or unexported fields
}
HTTPHandler provides HTTP endpoints for backup operations
func NewHTTPHandler ¶
func NewHTTPHandler(manager *BackupManager) *HTTPHandler
NewHTTPHandler creates a new HTTP handler for backups
func (*HTTPHandler) ListBackupsHandler ¶
func (h *HTTPHandler) ListBackupsHandler(w http.ResponseWriter, r *http.Request)
ListBackupsHandler handles requests to list available backups
func (*HTTPHandler) RestoreBackupHandler ¶
func (h *HTTPHandler) RestoreBackupHandler(w http.ResponseWriter, r *http.Request)
RestoreBackupHandler handles requests to restore a backup
type RetentionPolicy ¶
type RetentionPolicy struct {
KeepLastN int // Keep last N backups regardless of age
KeepDailyFor time.Duration // Keep daily backups for this duration
KeepWeeklyFor time.Duration // Keep weekly backups for this duration
KeepMonthlyFor time.Duration // Keep monthly backups for this duration
CleanupInterval time.Duration // How often to run cleanup
}
RetentionPolicy defines backup retention rules