Adds the SSD content setting to the library model and persistence

Stores whether the content of a library is on a solid state drive, off by default, so scans can choose between parallel and sequential reads.
This commit is contained in:
BinaryAlley committed 2026-10-30 22:39:19 +02:00
1 parent 6e77cf3302
commit 6eac3d578e
6 files changed
+3962

No files matched your search

@@ -80,6 +80,11 @@ public class LibraryEntity : IStorageEntity, IAuditableEntity
/// </summary>
public bool ShouldSkipUnchangedDirectoriesDuringScan { get; init; }
/// <summary>
/// Gets whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel.
/// </summary>
public bool IsContentOnSsd { get; init; }
/// <summary>
/// Gets a value indicating whether the consumption progress of the media library items is tracked.
/// </summary>
@@ -79,6 +79,10 @@ public class LibraryConfiguration : IEntityTypeConfiguration<LibraryEntity>
.HasDefaultValue(null)
.HasColumnOrder(17);
builder.Property(library => library.IsContentOnSsd)
.HasDefaultValue(false)
.HasColumnOrder(18);
// one user with many libraries
builder.HasOne(library => library.User)
.WithMany(user => user.Libraries)
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Lumina.DataAccess.Common.Migrations
{
/// <inheritdoc />
public partial class AddsIsContentOnSsdToLibraries : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsContentOnSsd",
table: "Libraries",
type: "INTEGER",
nullable: false,
defaultValue: false)
.Annotation("Relational:ColumnOrder", 18);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsContentOnSsd",
table: "Libraries");
}
}
}
@@ -1521,6 +1521,12 @@ namespace Lumina.DataAccess.Common.Migrations
.HasColumnType("TEXT")
.HasColumnOrder(12);
b.Property<bool>("IsContentOnSsd")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(false)
.HasColumnOrder(18);
b.Property<bool>("IsEnabled")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
@@ -76,6 +76,12 @@ public class Library : AggregateRoot<LibraryId>
/// </summary>
public bool ShouldSkipUnchangedDirectoriesDuringScan { get; private set; }
/// <summary>
/// Gets whether the content of this media library is stored on a solid state drive. When it is, the file discovery and content hashing stages read the files in parallel,
/// which takes advantage of the low latency of solid state drives. Mechanical hard drives keep those reads sequential, because parallel reads can reduce their throughput.
/// </summary>
public bool IsContentOnSsd { get; private set; }
/// <summary>
/// Gets the consumption settings of the media library.
/// </summary>
@@ -111,6 +117,7 @@ public class Library : AggregateRoot<LibraryId>
/// <param name="canDownloadMetadataFromWeb">Whether this media library should update the metadata of its elements from the web, or not.</param>
/// <param name="shouldSaveMetadataInMediaDirectories">Whether this media library should copy the downloaded metadata into the media library content locations, or not.</param>
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not.</param>
/// <param name="isContentOnSsd">Whether the content of this media library is stored on a solid state drive.</param>
/// <param name="consumptionSettings">The consumption settings of the media library.</param>
/// <param name="pathTemplate">The template describing the structure of the media library on disk.</param>
/// <param name="scanIds">The list of objects representing the unique identifier of scans of the media library.</param>
@@ -126,6 +133,7 @@ public class Library : AggregateRoot<LibraryId>
bool canDownloadMetadataFromWeb,
bool shouldSaveMetadataInMediaDirectories,
bool shouldSkipUnchangedDirectoriesDuringScan,
bool isContentOnSsd,
LibraryConsumptionSettings consumptionSettings,
LibraryPathTemplate pathTemplate,
List<ScanId> scanIds) : base(id)
@@ -140,6 +148,7 @@ public class Library : AggregateRoot<LibraryId>
CanDownloadMetadataFromWeb = canDownloadMetadataFromWeb;
ShouldSaveMetadataInMediaDirectories = shouldSaveMetadataInMediaDirectories;
ShouldSkipUnchangedDirectoriesDuringScan = shouldSkipUnchangedDirectoriesDuringScan;
IsContentOnSsd = isContentOnSsd;
ConsumptionSettings = consumptionSettings;
PathTemplate = pathTemplate;
_scanIds = scanIds;
@@ -158,6 +167,7 @@ public class Library : AggregateRoot<LibraryId>
/// <param name="canDownloadMetadataFromWeb">Whether this media library should update the metadata of its elements from the web, or not.</param>
/// <param name="shouldSaveMetadataInMediaDirectories">Whether this media library should copy the downloaded metadata into the media library content locations, or not.</param>
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not.</param>
/// <param name="isContentOnSsd">Whether the content of this media library is stored on a solid state drive.</param>
/// <param name="consumptionSettings">The consumption settings of the media library.</param>
/// <param name="pathTemplate">The template describing the structure of the media library on disk.</param>
/// <param name="scanIds">The list of objects representing the unique identifier of scans of the media library.</param>
@@ -175,6 +185,7 @@ public class Library : AggregateRoot<LibraryId>
bool canDownloadMetadataFromWeb,
bool shouldSaveMetadataInMediaDirectories,
bool shouldSkipUnchangedDirectoriesDuringScan,
bool isContentOnSsd,
LibraryConsumptionSettings consumptionSettings,
LibraryPathTemplate pathTemplate,
List<ScanId> scanIds)
@@ -200,6 +211,7 @@ public class Library : AggregateRoot<LibraryId>
canDownloadMetadataFromWeb,
shouldSaveMetadataInMediaDirectories,
shouldSkipUnchangedDirectoriesDuringScan,
isContentOnSsd,
consumptionSettings,
pathTemplate,
scanIds
@@ -220,6 +232,7 @@ public class Library : AggregateRoot<LibraryId>
/// <param name="canDownloadMetadataFromWeb">Whether this media library should update the metadata of its elements from the web, or not.</param>
/// <param name="shouldSaveMetadataInMediaDirectories">Whether this media library should copy the downloaded metadata into the media library content locations, or not.</param>
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not.</param>
/// <param name="isContentOnSsd">Whether the content of this media library is stored on a solid state drive.</param>
/// <param name="consumptionSettings">The consumption settings of the media library.</param>
/// <param name="pathTemplate">The template describing the structure of the media library on disk.</param>
/// <param name="scanIds">The list of objects representing the unique identifier of scans of the media library.</param>
@@ -238,6 +251,7 @@ public class Library : AggregateRoot<LibraryId>
bool canDownloadMetadataFromWeb,
bool shouldSaveMetadataInMediaDirectories,
bool shouldSkipUnchangedDirectoriesDuringScan,
bool isContentOnSsd,
LibraryConsumptionSettings consumptionSettings,
LibraryPathTemplate pathTemplate,
List<ScanId> scanIds)
@@ -263,6 +277,7 @@ public class Library : AggregateRoot<LibraryId>
canDownloadMetadataFromWeb,
shouldSaveMetadataInMediaDirectories,
shouldSkipUnchangedDirectoriesDuringScan,
isContentOnSsd,
consumptionSettings,
pathTemplate,
scanIds