39 lines
1.6 KiB
C#
39 lines
1.6 KiB
C#
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Jellyfin.Plugin.JRay.Models;
|
|
|
|
namespace Jellyfin.Plugin.JRay.Services.Interfaces;
|
|
|
|
/// <summary>
|
|
/// Stores and retrieves truth files that were pushed to JRay directly
|
|
/// (e.g. by a remote extraction worker), independent of any sidecar file
|
|
/// on the media filesystem.
|
|
/// </summary>
|
|
public interface IManagedTruthStore
|
|
{
|
|
/// <summary>
|
|
/// Loads the managed truth file for the given item, if one was uploaded.
|
|
/// </summary>
|
|
/// <param name="itemId">The Jellyfin library item id.</param>
|
|
/// <param name="cancellationToken">Cancellation token.</param>
|
|
/// <returns>The parsed truth file, or null if none has been uploaded for this item.</returns>
|
|
Task<TruthFile?> LoadAsync(Guid itemId, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Saves (creates or replaces) the managed truth file for the given item.
|
|
/// </summary>
|
|
/// <param name="itemId">The Jellyfin library item id.</param>
|
|
/// <param name="truth">The truth file contents to persist.</param>
|
|
/// <param name="cancellationToken">Cancellation token.</param>
|
|
/// <returns>A task that completes when the file has been written.</returns>
|
|
Task SaveAsync(Guid itemId, TruthFile truth, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Deletes the managed truth file for the given item, if one exists.
|
|
/// </summary>
|
|
/// <param name="itemId">The Jellyfin library item id.</param>
|
|
/// <returns><c>true</c> if a file was deleted; <c>false</c> if none existed.</returns>
|
|
bool Delete(Guid itemId);
|
|
}
|