IServerSyncProvider.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using MediaBrowser.Model.Querying;
  2. using MediaBrowser.Model.Sync;
  3. using Interfaces.IO;
  4. using System;
  5. using System.IO;
  6. using System.Threading;
  7. using System.Threading.Tasks;
  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. /// <param name="query">The query.</param>
  43. /// <param name="target">The target.</param>
  44. /// <param name="cancellationToken">The cancellation token.</param>
  45. /// <returns>Task&lt;QueryResult&lt;FileMetadata&gt;&gt;.</returns>
  46. Task<QueryResult<FileMetadata>> GetFiles(FileQuery query, SyncTarget target, CancellationToken cancellationToken);
  47. }
  48. public interface ISupportsDirectCopy
  49. {
  50. /// <summary>
  51. /// Sends the file.
  52. /// </summary>
  53. /// <param name="path">The path.</param>
  54. /// <param name="pathParts">The path parts.</param>
  55. /// <param name="target">The target.</param>
  56. /// <param name="progress">The progress.</param>
  57. /// <param name="cancellationToken">The cancellation token.</param>
  58. /// <returns>Task&lt;SyncedFileInfo&gt;.</returns>
  59. Task<SyncedFileInfo> SendFile(string path, string[] pathParts, SyncTarget target, IProgress<double> progress, CancellationToken cancellationToken);
  60. }
  61. }