IServerSyncProvider.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using MediaBrowser.Model.Querying;
  2. using MediaBrowser.Model.Sync;
  3. using System;
  4. using System.IO;
  5. using System.Threading;
  6. using System.Threading.Tasks;
  7. using MediaBrowser.Model.IO;
  8. namespace MediaBrowser.Controller.Sync
  9. {
  10. public interface IServerSyncProvider : ISyncProvider
  11. {
  12. /// <summary>
  13. /// Transfers the file.
  14. /// </summary>
  15. /// <param name="stream">The stream.</param>
  16. /// <param name="pathParts">The path parts.</param>
  17. /// <param name="target">The target.</param>
  18. /// <param name="progress">The progress.</param>
  19. /// <param name="cancellationToken">The cancellation token.</param>
  20. /// <returns>Task.</returns>
  21. Task<SyncedFileInfo> SendFile(Stream stream, string[] pathParts, SyncTarget target, IProgress<double> progress, CancellationToken cancellationToken);
  22. /// <summary>
  23. /// Deletes the file.
  24. /// </summary>
  25. /// <param name="id">The identifier.</param>
  26. /// <param name="target">The target.</param>
  27. /// <param name="cancellationToken">The cancellation token.</param>
  28. /// <returns>Task.</returns>
  29. Task DeleteFile(string id, SyncTarget target, CancellationToken cancellationToken);
  30. /// <summary>
  31. /// Gets the file.
  32. /// </summary>
  33. /// <param name="id">The identifier.</param>
  34. /// <param name="target">The target.</param>
  35. /// <param name="progress">The progress.</param>
  36. /// <param name="cancellationToken">The cancellation token.</param>
  37. /// <returns>Task&lt;Stream&gt;.</returns>
  38. Task<Stream> GetFile(string id, SyncTarget target, IProgress<double> progress, CancellationToken cancellationToken);
  39. /// <summary>
  40. /// Gets the files.
  41. /// </summary>
  42. Task<QueryResult<FileSystemMetadata>> GetFiles(string id, SyncTarget target, CancellationToken cancellationToken);
  43. Task<QueryResult<FileSystemMetadata>> GetFiles(string[] pathParts, SyncTarget target, CancellationToken cancellationToken);
  44. Task<QueryResult<FileSystemMetadata>> GetFiles(SyncTarget target, CancellationToken cancellationToken);
  45. }
  46. public interface ISupportsDirectCopy
  47. {
  48. /// <summary>
  49. /// Sends the file.
  50. /// </summary>
  51. /// <param name="path">The path.</param>
  52. /// <param name="pathParts">The path parts.</param>
  53. /// <param name="target">The target.</param>
  54. /// <param name="progress">The progress.</param>
  55. /// <param name="cancellationToken">The cancellation token.</param>
  56. /// <returns>Task&lt;SyncedFileInfo&gt;.</returns>
  57. Task<SyncedFileInfo> SendFile(string path, string[] pathParts, SyncTarget target, IProgress<double> progress, CancellationToken cancellationToken);
  58. }
  59. public interface IHasDuplicateCheck
  60. {
  61. /// <summary>
  62. /// Allows the duplicate job item.
  63. /// </summary>
  64. /// <param name="original">The original.</param>
  65. /// <param name="duplicate">The duplicate.</param>
  66. /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
  67. bool AllowDuplicateJobItem(SyncJobItem original, SyncJobItem duplicate);
  68. }
  69. }