feat(server): show the Unraid array's free space and check the archive volume before filing uploads
On Unraid the archive is a user share (FUSE shfs), which reports the share's primary storage, often the cache, while the mover sends the photos to the array: the admin panel showed the cache's free space (owner review 2, R2). - New option SpacePath (server.json) / CHRONOS_SPACE_PATH: the admin panel shows that folder's volume; empty, or a folder that cannot be measured, falls back to the archive's volume (one warning, at start, not per request). - VolumeSpace measures folders (DriveInfo; the path root on Windows) and reads the filesystem type and mount from /proc/self/mountinfo on Linux (longest mount point on segment boundaries, octal escapes, optional fields, the top of stacked mounts), since DriveFormat calls an shfs share only "fuse". It is an injectable service, so tests simulate a full volume; the /data checks use it. - ArchiveStatsDto keeps FreeBytes/CapacityBytes for the shown volume and gains optional trailing members: the write volume's figures (when a space path is in use and they differ), the filesystem type and UsesSpacePath. - Admin panel (dashboard and archive): a tooltip on the storage figures names the volume and its filesystem and, on an shfs share without a space path, says they are the primary storage and to map the array view to /space; a "Write volume" line shows the archive's own volume when it differs. - Completing an upload, a render upload or a render node's result checks the archive volume for its size plus the 64 MiB reserve before the staging copy and answers 507 insufficient_storage, the upload still receiving. - Diagnostics list the archive and space volumes with filesystem and mount. - Unraid template: optional read-only "Array view" /space (default /mnt/user0/Timelapse) and "Space path" CHRONOS_SPACE_PATH=/space; compose and the releases README describe the same as an option. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5209579631
commit
d560b41b81
22 files changed
+641
-66
No files matched your search
@@ -1,8 +1,10 @@
|
||||
using System.Collections.Concurrent;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data;
|
||||
using Chronos.Data.Archiving;
|
||||
using Chronos.Data.Jobs;
|
||||
using Chronos.Server.Configuration;
|
||||
using Chronos.Server.Storage;
|
||||
|
||||
namespace Chronos.Server.Tests;
|
||||
@@ -99,6 +101,23 @@ public sealed class FakeAssetLocator : IFrameAssetLocator
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Measures volumes for real, except the folders given figures of their own (a full archive, a separate array).</summary>
|
||||
public sealed class FakeVolumeSpace(ServerOptions options, ILogger<VolumeSpace> logger) : VolumeSpace(options, logger)
|
||||
{
|
||||
private readonly ConcurrentDictionary<string, VolumeFigures> _figures = new(StringComparer.Ordinal);
|
||||
|
||||
/// <summary>Gives <paramref name="path"/> these figures; null measures it for real again.</summary>
|
||||
public void Set(string path, VolumeFigures? figures)
|
||||
{
|
||||
if (figures is null) _figures.TryRemove(Key(path), out _);
|
||||
else _figures[Key(path)] = figures;
|
||||
}
|
||||
|
||||
public override VolumeFigures? Measure(string path) => _figures.TryGetValue(Key(path), out var figures) ? figures : base.Measure(path);
|
||||
|
||||
private static string Key(string path) => Path.TrimEndingDirectorySeparator(Path.GetFullPath(path));
|
||||
}
|
||||
|
||||
/// <summary>A clock tests move by hand (token expiry, heartbeat timeouts).</summary>
|
||||
public sealed class ManualTimeProvider : TimeProvider
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user