IServerSyncProvider.cs 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. Task<QueryResult<FileSystemMetadata>> GetFiles(string[] pathParts, SyncTarget target, CancellationToken cancellationToken);
  40. Task<QueryResult<FileSystemMetadata>> GetFiles(SyncTarget target, CancellationToken cancellationToken);
  41. }
  42. public interface ISupportsDirectCopy
  43. {
  44. /// <summary>
  45. /// Sends the file.
  46. /// </summary>
  47. /// <param name="path">The path.</param>
  48. /// <param name="pathParts">The path parts.</param>
  49. /// <param name="target">The target.</param>
  50. /// <param name="progress">The progress.</param>
  51. /// <param name="cancellationToken">The cancellation token.</param>
  52. /// <returns>Task&lt;SyncedFileInfo&gt;.</returns>
  53. Task<SyncedFileInfo> SendFile(string path, string[] pathParts, SyncTarget target, IProgress<double> progress, CancellationToken cancellationToken);
  54. }
  55. public interface IHasDuplicateCheck
  56. {
  57. /// <summary>
  58. /// Allows the duplicate job item.
  59. /// </summary>
  60. /// <param name="original">The original.</param>
  61. /// <param name="duplicate">The duplicate.</param>
  62. /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
  63. bool AllowDuplicateJobItem(SyncJobItem original, SyncJobItem duplicate);
  64. }
  65. }