Implements file hashing media library scan job

This commit is contained in:
BinaryAlley committed 2025-03-01 16:44:10 +02:00
1 parent 66998055f0
commit 03a000e1e4
63 files changed
+2009 -287

No files matched your search

@@ -36,7 +36,7 @@ public class LibraryScanResultEntity : IStorageEntity
/// <summary>
/// Gets the hash calculated for the media library scan file.
/// </summary>
public required string ContentHash { get; init; }
public required ulong ContentHash { get; init; }
/// <summary>
/// Gets the size of the media library scan file.
@@ -4,7 +4,6 @@ using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management;
using Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
using Lumina.Application.Common.DataAccess.Repositories.Common.Base;
using Lumina.Domain.Common.Enums.MediaLibrary;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate;
using System;
using System.Collections.Generic;
using System.Threading;
@@ -0,0 +1,27 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management;
using Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
using Lumina.Application.Common.DataAccess.Repositories.Common.Base;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Common.DataAccess.Repositories.MediaLibrary;
/// <summary>
/// Interface for the repository for media library scan results.
/// </summary>
public interface ILibraryScanResultRepository : IRepository<LibraryScanResultEntity>,
IInsertRepositoryAction<LibraryScanResultEntity>
{
/// <summary>
/// Gets all media library scan results that belong to the last scan of a library identified by <paramref name="libraryId"/>, from the storage medium.
/// </summary>
/// <param name="libraryId">The unique identifier of the library for which to get the results of the last scans.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="ErrorOr{TValue}"/> containing either a path mapped dictionary of <see cref="LibraryScanResultEntity"/>, or an error.</returns>
Task<ErrorOr<Dictionary<string, LibraryScanResultEntity>>> GetPathMappedByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken);
}