IBackupService.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using System.IO;
  3. using System.Threading.Tasks;
  4. using MediaBrowser.Controller.SystemBackupService;
  5. namespace Jellyfin.Server.Implementations.SystemBackupService;
  6. /// <summary>
  7. /// Defines an interface to restore and backup the jellyfin system.
  8. /// </summary>
  9. public interface IBackupService
  10. {
  11. /// <summary>
  12. /// Creates a new Backup zip file containing the current state of the application.
  13. /// </summary>
  14. /// <param name="backupOptions">The backup options.</param>
  15. /// <returns>A task.</returns>
  16. Task<BackupManifestDto> CreateBackupAsync(BackupOptionsDto backupOptions);
  17. /// <summary>
  18. /// Gets a list of backups that are available to be restored from.
  19. /// </summary>
  20. /// <returns>A list of backup paths.</returns>
  21. Task<BackupManifestDto[]> EnumerateBackups();
  22. /// <summary>
  23. /// Gets a single backup manifest if the path defines a valid Jellyfin backup archive.
  24. /// </summary>
  25. /// <param name="archivePath">The path to be loaded.</param>
  26. /// <returns>The containing backup manifest or null if not existing or compatiable.</returns>
  27. Task<BackupManifestDto?> GetBackupManifest(string archivePath);
  28. /// <summary>
  29. /// Restores an backup zip file created by jellyfin.
  30. /// </summary>
  31. /// <param name="archivePath">Path to the archive.</param>
  32. /// <returns>A Task.</returns>
  33. /// <exception cref="FileNotFoundException">Thrown when an invalid or missing file is specified.</exception>
  34. /// <exception cref="NotSupportedException">Thrown when attempt to load an unsupported backup is made.</exception>
  35. /// <exception cref="InvalidOperationException">Thrown for errors during the restore.</exception>
  36. Task RestoreBackupAsync(string archivePath);
  37. /// <summary>
  38. /// Schedules a Restore and restarts the server.
  39. /// </summary>
  40. /// <param name="archivePath">The path to the archive to restore from.</param>
  41. void ScheduleRestoreAndRestartServer(string archivePath);
  42. }