12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
-
- package hybridBackup // import "imuslab.com/arozos/mod/disk/hybridBackup"
- FUNCTIONS
- func BufferedLargeFileCopy(src string, dst string, BUFFERSIZE int64) error
- TYPES
- type BackupTask struct {
- JobName string //The name used by the scheduler for executing this config
- CycleCounter int64 //The number of backup executed in the background
- LastCycleTime int64 //The execution time of the last cycle
- Enabled bool //Check if the task is enabled. Will not execute if this is set to false
- DiskUID string //The UID of the target fsandlr
- DiskPath string //The mount point for the disk
- ParentUID string //Parent virtal disk UUID
- ParentPath string //Parent disk path
- DeleteFileMarkers map[string]int64 //Markers for those files delete pending, [file path (relative)] time
- Mode string //Backup mode
- }
- func (backupConfig *BackupTask) HandleBackupProcess() (string, error)
- Main handler function for hybrid backup
- type LinkFileMap struct {
- UnchangedFile map[string]string
- DeletedFiles map[string]string
- }
- type Manager struct {
- Ticker *time.Ticker `json:"-"` //The main ticker
- StopTicker chan bool `json:"-"` //Channel for stopping the backup
- Tasks []*BackupTask //The backup tasks that is running under this manager
- }
- func NewHyperBackupManager() *Manager
- func (m *Manager) AddTask(newtask *BackupTask) error
- func (m *Manager) Close() error
- Stop all managed handlers
- func (m *Manager) GetParentDiskIDByRestoreDiskID(restoreDiskID string) (string, error)
- Get the restore parent disk ID by backup disk ID
- func (m *Manager) HandleRestore(restoreDiskID string, targetFileRelpath string) error
- Restore accidentailly removed file from backup
- func (m *Manager) ListRestorable(parentDiskID string) (RestorableReport, error)
- List the file that is restorable from the given disk
- func (m *Manager) StartTask(jobname string)
- Start a given task given name
- func (m *Manager) StopTask(jobname string)
- Stop a given task given its job name
- type RestorableFile struct {
- Filename string //Filename of this restorable object
- IsHidden bool //Check if the file is hidden or located in a path within hidden folder
- Filesize int64 //The file size to be restorable
- RelpathOnDisk string //Relative path of this file to the root
- RestorePoint string //The location this file should restore to
- BackupDiskUID string //The UID of disk that is hold the backup of this file
- RemainingTime int64 //Remaining time till auto remove
- DeleteTime int64 //Delete time
- IsSnapshot bool //Define is this restorable file point to a snapshot instead
- }
- A file in the backup drive that is restorable
- type RestorableReport struct {
- ParentUID string //The Disk ID to be restored to
- RestorableFiles []*RestorableFile //A list of restorable files
- }
- The restorable report
- type SnapshotSummary struct {
- ChangedFiles map[string]string
- UnchangedFiles map[string]string
- DeletedFiles map[string]string
- }
- A snapshot summary
- func GenerateSnapshotSummary(task *BackupTask, snapshotName string) (*SnapshotSummary, error)
- This function generate and return a snapshot summary
|