Parallelizes discovery and hashing reads for SSD libraries

Uses parallel file system reads when the library content is on a solid state drive, and keeps sequential reads for mechanical drives. Discovery keeps bounded batching and sequential repository writes.
This commit is contained in:
BinaryAlley committed 2026-10-30 22:40:09 +02:00
1 parent 499647f7bb
commit 811addf8d4
5 files changed
+327 -133

No files matched your search

@@ -17,10 +17,11 @@ public interface IFileHashService
/// Hashes <paramref name="files"/> by sampling chunks from them.
/// </summary>
/// <param name="files">The collection of files to hash.</param>
/// <param name="shouldParallelizeReads">Whether the files should be read in parallel. Parallel reads benefit solid state drives, while mechanical hard drives are faster with sequential reads.</param>
/// <param name="callback">Callback to invoke during processing of elements.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>A collection of the hashed files, along with their hashes.</returns>
Task<List<HashedFileSystemFileDto>> HashFilesAsync(IReadOnlyCollection<HashedFileSystemFileDto> files, Func<Task> callback, CancellationToken cancellationToken);
Task<List<HashedFileSystemFileDto>> HashFilesAsync(IReadOnlyCollection<HashedFileSystemFileDto> files, bool shouldParallelizeReads, Func<Task> callback, CancellationToken cancellationToken);
/// <summary>
/// Computes the content hash of the file stored at <paramref name="filePath"/>, by sampling chunks from it.