Adds the media library scan snapshot, staging and directory fingerprint data model

This commit is contained in:
BinaryAlley committed 2026-08-09 13:17:34 -07:00
1 parent 4fec67a1f8
commit 1dc3da3da1
37 files changed
+7315 -89

No files matched your search

@@ -0,0 +1,34 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.Common;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management;
/// <summary>
/// Repository entity for a directory scan fingerprint, holding the last write time of a directory of a media library, used to skip the scanning of directories that have not changed since the last scan.
/// </summary>
[DebuggerDisplay("Id: {Id}; Path: {Path}")]
public class DirectoryScanFingerprintEntity : IStorageEntity
{
/// <summary>
/// Gets the Id of the directory scan fingerprint.
/// </summary>
public required Guid Id { get; init; }
/// <summary>
/// Gets the Id of the media library to which this directory scan fingerprint belongs.
/// </summary>
public required Guid LibraryId { get; init; }
/// <summary>
/// Gets the path of the directory to which this directory scan fingerprint belongs.
/// </summary>
public required string Path { get; init; }
/// <summary>
/// Gets the last write time of the directory, in UTC, at the moment when the directory was scanned.
/// </summary>
public required DateTime LastWriteTimeUtc { get; init; }
}
@@ -23,6 +23,11 @@ public class LibraryScanResultEntity : IStorageEntity
/// </summary>
public required Guid LibraryScanId { get; init; }
/// <summary>
/// Gets the status of the media library scan file.
/// </summary>
public required LibraryScanFileStatus Status { get; init; }
/// <summary>
/// Gets the path of the media library scan file.
/// </summary>
@@ -39,9 +44,9 @@ public class LibraryScanResultEntity : IStorageEntity
public required long FileSize { get; init; }
/// <summary>
/// Gets the modification date of the media library scan file.
/// Gets the time and date when the file system file was last modified, stored in ticks.
/// </summary>
public required DateTime LastModified { get; init; }
public required long Ticks { get; init; }
/// <summary>
/// Gets the media library scan that this scan result belongs to.
@@ -0,0 +1,69 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.Common;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management;
/// <summary>
/// Repository entity for a media library item, representing the current state of a previously scanned media item, as a snapshot.
/// </summary>
[DebuggerDisplay("Id: {Id}; Path: {Path}")]
public class LibraryScanSnapshotEntity : IStorageEntity, IAuditableEntity
{
/// <summary>
/// Gets the Id of the media library scan snapshot item.
/// </summary>
public required Guid Id { get; init; }
/// <summary>
/// Gets the Id of the media library to which this media library scan snapshot item belongs.
/// </summary>
public required Guid LibraryId { get; init; }
/// <summary>
/// Gets the path of the media library scan snapshot item.
/// </summary>
public required string Path { get; init; }
/// <summary>
/// Gets the hash calculated for the media library scan snapshot item.
/// </summary>
public required ulong ContentHash { get; init; }
/// <summary>
/// Gets the size of the media library scan snapshot item, in bytes.
/// </summary>
public required long FileSize { get; init; }
/// <summary>
/// Gets the time and date when the media library scan snapshot item was last modified, stored in ticks.
/// </summary>
public required long Ticks { get; init; }
/// <summary>
/// Gets the media library to which this media library scan snapshot item belongs.
/// </summary>
public required LibraryEntity Library { get; init; } = null!;
/// <summary>
/// Gets or sets the time and date when the entity was added.
/// </summary>
public required DateTime CreatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the Id of the user that created the entity.
/// </summary>
public required Guid CreatedBy { get; set; }
/// <summary>
/// Gets or sets the optional time and date when the entity was updated.
/// </summary>
public DateTime? UpdatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the optional Id of the user that updated the entity.
/// </summary>
public required Guid? UpdatedBy { get; set; }
}
@@ -0,0 +1,59 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.Common;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management;
/// <summary>
/// Repository entity for a media library scan staging result, holding the file system items discovered during a scan, before they are compared against the media library scan snapshot of the previous scan.
/// </summary>
[DebuggerDisplay("Id: {Id}; Path: {Path}")]
public class LibraryScanStagingResultsEntity : IStorageEntity
{
/// <summary>
/// Gets the Id of the media library scan staging result.
/// </summary>
public required Guid Id { get; init; }
/// <summary>
/// Gets the Id of the media library scan that this staging result belongs to.
/// </summary>
public required Guid LibraryScanId { get; init; }
/// <summary>
/// Gets the path of the media library scan staging result.
/// </summary>
public required string Path { get; init; }
/// <summary>
/// Gets the size of the media library scan staging result, in bytes.
/// </summary>
public required long Size { get; init; }
/// <summary>
/// Gets the time and date when the file system item was last modified, stored in ticks.
/// </summary>
public required long Ticks { get; init; }
/// <summary>
/// Gets the hash calculated for the media library scan staging result.
/// </summary>
public required ulong ContentHash { get; init; }
/// <summary>
/// Gets the hash of the same file system item, as stored in the media library scan snapshot of a previous scan, or 0 if the file system item is new.
/// </summary>
public required ulong PreviousContentHash { get; init; }
/// <summary>
/// Gets whether this media library scan staging result represents a file system item that needs its content to be hashed, because it is either new, or it has changed since the previous scan.
/// </summary>
public required bool NeedsRehash { get; init; }
/// <summary>
/// Gets whether this media library scan staging result represents a file system item that was not present in the media library scan snapshot of a previous scan.
/// </summary>
public required bool IsNew { get; init; }
}