hybridBackup.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package hybridBackup
  2. import (
  3. "log"
  4. )
  5. /*
  6. Hybrid Backup
  7. This module handle backup functions from the drive with Hieracchy labeled as "backup"
  8. Backup modes suport in this module currently consists of
  9. Denote P drive as parent drive and B drive as backup drive.
  10. 1. Smart (smart):
  11. - Any new file created in P will be copied to B within 5 minutes
  12. - Any file removed in P will be delete from backup after 24 hours
  13. 2. Nightly (nightly):
  14. - The whole P drive will be copied to N drive every night
  15. 3. Append Only (append)
  16. - Any new file created in P will be copied to B within 5 minutes
  17. - No file will be removed from B unless drive is fulled (Similar to CCTV recorder)
  18. */
  19. type BackupConfig struct {
  20. CycleCounter int64 //The number of backup executed in the background
  21. DiskUID string //The UID of the target fsandlr
  22. DiskPath string //The mount point for the disk
  23. ParentUID string //Parent virtal disk UUID
  24. ParentPath string //Parent disk path
  25. Mode string //Backup mode
  26. }
  27. func HandleBackupProcess(backupConfig *BackupConfig) (string, error) {
  28. log.Println(">>>>>> Running backup process: ", backupConfig)
  29. if backupConfig.Mode == "smart" {
  30. } else if backupConfig.Mode == "nightly" {
  31. } else if backupConfig.Mode == "append" {
  32. }
  33. //Add one to the cycle counter
  34. backupConfig.CycleCounter++
  35. //Return the log information
  36. return "", nil
  37. }