The convert job planned every sequence again when it ran and checked only the frames version, so a verify, a repaired upload or a tier change between the dry run and the job let it replace photos the confirmed plan had listed as staying unchanged. - Each sequence of a convert job now carries the digest of the photos it converts, each with its SHA-256 (ConvertSequencePlan.Digest, also in the plan's fingerprint). Under the sequence's lease, its sidecar settled, the job plans it again and goes on only while the digest matches; it then pins those photos (convert-<job>.pins), so photos that come in or are verified later stay as they are, a retry included. Stage B checks under the lease that every pinned photo still holds the content converted instead of holding the frames version, so a sequence still receiving uploads converts what was confirmed. - A resumed job settles the journals a crash left in a sequence (a half-done replacement among them) before it plans, and reports a sequence its replacement completed as Converted, never Nothing or a partial swap. - The passes a converted or new sequence needs are queued as soon as its outcome is journaled; the journal records the statuses they follow from and whether they were queued, so a pause, yield, stop or crash no longer loses them. - Staged conversions of a blocked or failed sequence are kept for the retry, which re-verifies and takes them; maintenance keeps a convert job's staging while the job is queued, running or paused, and removes its journal and staging once the job is done or gone from the history. - A dry run counts the sequences of a queued conversion as busy, so the same conversion cannot be confirmed twice. - New sequence copies are owned by the source's owner, else by the requesting user's id (never the user name); a staged copy that vanished fails the sequence instead of leaving its photo out; the job log states how many photos stayed in the source alone. - Free space is measured where the conversion writes: the server takes the tighter of the space path's volume and the archive's own (Unraid cache), the desktop asks Windows (GetDiskFreeSpaceEx), which also measures UNC archives; the job checks again before each sequence and each photo, scaling estimates by the files staged so far, and stops before the volume fills with what it staged kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 2d7d461c33b9f257bf57793cc7cf331d0425c14e)
33 lines
1.4 KiB
C#
33 lines
1.4 KiB
C#
using Chronos.Core.Windows.Devices;
|
|
using Chronos.Testing;
|
|
|
|
namespace Chronos.Core.Windows.Tests.Devices;
|
|
|
|
/// <summary>
|
|
/// The free space of a folder's volume as a conversion checks it on the desktop (owner review 2, R7): a network share's too,
|
|
/// which <see cref="DriveInfo"/> cannot measure. Apart from <see cref="VolumeTests"/>, which enumerate every volume.
|
|
/// </summary>
|
|
public sealed class FreeSpaceTests(TestContext context)
|
|
{
|
|
[Test]
|
|
[WindowsOnly]
|
|
public void AFolderIsMeasuredOnItsVolumeAndAMissingOneIsNot()
|
|
{
|
|
var folder = context.CreateTempDirectory("free");
|
|
Assert.Greater(Assert.NotNull(VolumeInfo.FreeBytesAt(folder)), 0);
|
|
Assert.Greater(Assert.NotNull(VolumeInfo.FreeBytesAt(folder + Path.DirectorySeparatorChar)), 0);
|
|
Assert.Null(VolumeInfo.FreeBytesAt(Path.Combine(folder, "missing", "deeper")));
|
|
}
|
|
|
|
[Test]
|
|
[WindowsOnly]
|
|
public void AFolderOnAShareIsMeasuredWhereTheDriveCannotBe()
|
|
{
|
|
var folder = Path.GetFullPath(context.CreateTempDirectory("share"));
|
|
var share = $@"\\localhost\{char.ToLowerInvariant(folder[0])}$" + folder[2..];
|
|
if (!Directory.Exists(share)) TestContext.Skip("This PC has no administrative share for the test folder.");
|
|
Assert.Throws<ArgumentException>(() => new DriveInfo(Path.GetPathRoot(share)!));
|
|
Assert.Greater(Assert.NotNull(VolumeInfo.FreeBytesAt(share)), 0);
|
|
}
|
|
}
|