refactor: share duplicated snapshot, history and fetch helpers

- CuttingPlanSnapshot: one private Copy carries every value and init
  property for WithSearchLimits, WithTabLeadOuts, WithPreservedOrder and
  WithTabbedPartsAvoided, keeping the defensive CrossableTabbedParts copy.
- NestPhaseExtensions: DisplayName and ShortName share one attribute
  lookup and keep their own caches.
- NestDatabase: History, DrawingHistory and DrawingSetHistory share
  ReadRevisionPage (count, page query, read rows) under the same lock.
- NestServerClient.GetOrNullAsync: the GET, 404 check-then-null, ensure
  success and read flow used by the Remote* clients.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ajandClaude Opus 5.5 committed 2026-11-28 18:39:56 -05:00
1 parent 409d30d29e
commit 1f7fd248fe
11 files changed
+126 -184

No files matched your search

+3 -6
View File
@@ -45,14 +45,11 @@ public sealed partial class RemoteDrawingGeometry : NestServerClient
}
/// <summary>The package stored under <paramref name="sha256"/>, or null when there is none.</summary>
public async Task<byte[]?> GetPackageAsync(string sha256, CancellationToken cancellationToken = default)
public Task<byte[]?> GetPackageAsync(string sha256, CancellationToken cancellationToken = default)
{
ValidateSha(sha256);
using var response = await _httpClient.GetAsync(Url($"api/drawing-packages/{sha256}"), cancellationToken);
if (response.StatusCode == HttpStatusCode.NotFound)
return null;
await NestServerHttp.EnsureSuccessAsync(response, $"download library package {sha256}", cancellationToken);
return await response.Content.ReadAsByteArrayAsync(cancellationToken);
return GetOrNullAsync($"api/drawing-packages/{sha256}", $"download library package {sha256}", ReadBytesAsync,
null, cancellationToken);
}
/// <summary>Stores a package's summary; false when the server no longer has the package.</summary>