feat: single setup, mass-pass progress, per-server homes, Desktop shares its library (owner review 5, v1.1.0) (#68)
CI / Build and test (push) Successful in 11m36s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 12s
Release / Build, test and publish (push) Successful in 14m56s
CI / PostgreSQL 16 integration (push) Successful in 10m11s
CI / PostgreSQL 17 integration (push) Successful in 10m15s
CI / Docker image (push) Successful in 45s
Release / Server image (push) Successful in 4m55s

Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #68.
This commit is contained in:
Alby96 authored and Alby96 committed 2026-11-15 18:11:43 +01:00
1 parent 988068ee8e
commit 20d64af4a4
793 files changed
+23882 -2096

No files matched your search

+35 -3
View File
@@ -26,9 +26,23 @@ public sealed record SyncOptions
/// <summary>Decoders, lease owner and lease timing for sidecar and project writes (shared with the archive engine).</summary>
public ArchiveServiceOptions Archive { get; init; } = new();
/// <summary>Folder of the proxy cache of server sequences (inside the client's cache).</summary>
/// <summary>
/// Folder of the proxy cache of server sequences as 1.0 laid it out (<c>&lt;cache&gt;\proxies\&lt;address hash&gt;</c>):
/// where proxies go without <see cref="ServersDirectory"/>, and where a sequence's proxies are still read from, with it,
/// until they are moved into their server's home.
/// </summary>
public required string ProxyCacheDirectory { get; init; }
/// <summary>
/// The servers' homes in the client's cache (<c>&lt;cache&gt;\servers</c>, owner review 5, #66): with it, a server's
/// proxies go to <c>&lt;servers&gt;\&lt;home folder&gt;\proxies\&lt;sequence id&gt;</c>
/// (<see cref="Core.IO.HomeFolders.ServerFolder"/>). Null keeps the 1.0 layout under <see cref="ProxyCacheDirectory"/>.
/// </summary>
public string? ServersDirectory { get; init; }
/// <summary>The alias table the cache finds a server's home by (<see cref="ServerIdentity"/>); null: every key is its own.</summary>
public Func<ServerIdentity>? Identity { get; init; }
/// <summary>Concurrent frame downloads of one job.</summary>
public int Downloads { get; init; } = 4;
@@ -74,7 +88,7 @@ public sealed class SyncService
Options = options;
_links = new SyncLinkStore(db);
_writer = new SequenceWriter(options.Archive);
Proxies = new ProxyCache(options.ProxyCacheDirectory);
Proxies = new ProxyCache(options.ProxyCacheDirectory, options.ServersDirectory, options.Identity);
}
public SyncOptions Options { get; }
@@ -90,9 +104,27 @@ public sealed class SyncService
internal ArchiveService Archives { get; }
/// <summary>"https://nas.local:8443": the key links are stored under (scheme, lower-case host, port, path).</summary>
/// <summary>
/// "https://nas.local:8443": the address key (scheme, lower-case host, port, path), the key every server had in 1.0 and an
/// older server, which announces no id, still has. A server that announces one is keyed by it
/// (<see cref="ServerIdentity.Key(Guid?, Uri)"/>), its address keys kept as aliases.
/// </summary>
public static string ServerKey(Uri address) => address.GetLeftPart(UriPartial.Path).TrimEnd('/').ToLowerInvariant();
/// <summary>
/// Moves the links of <paramref name="from"/> (an address key the server was reached under) to <paramref name="to"/> (its
/// id key, owner review 5, #66) in one transaction. A link both keys hold for one server sequence, or for one local copy,
/// keeps the row compared last (<see cref="SyncLink.SyncedAt"/>); the other row goes, which loses nothing: the next
/// comparison makes links again. Nothing happens when the keys are the same.
/// </summary>
/// <returns>The links moved, and those dropped for a newer one.</returns>
public async Task<(int Moved, int Dropped)> RekeyAsync(string from, string to, CancellationToken cancellationToken)
{
var result = await _links.RekeyAsync(from, to, cancellationToken).ConfigureAwait(false);
if (result.Moved + result.Dropped > 0) Changed?.Invoke(to);
return result;
}
/// <summary>What an upload or download job moves; null for any other job.</summary>
public static SyncTransferKind? TransferKind(Job job) => SyncJobParameters.Read(job)?.Kind(job.Kind);