style(data): apply dotnet format whitespace rules
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
5 files changed
+97
-52
No files matched your search
@@ -427,21 +427,21 @@ internal sealed class PgConnector : IAsyncDisposable
|
|||||||
WritePassword(PgMd5.Response(_settings.Username, RequirePassword(), payload.Slice(4, 4)));
|
WritePassword(PgMd5.Response(_settings.Username, RequirePassword(), payload.Slice(4, 4)));
|
||||||
return scram;
|
return scram;
|
||||||
case 10:
|
case 10:
|
||||||
{
|
{
|
||||||
var mechanisms = new List<string>();
|
var mechanisms = new List<string>();
|
||||||
var pos = 4;
|
var pos = 4;
|
||||||
while (pos < payload.Length && payload[pos] != 0) mechanisms.Add(ReadCString(payload, ref pos));
|
while (pos < payload.Length && payload[pos] != 0) mechanisms.Add(ReadCString(payload, ref pos));
|
||||||
if (!mechanisms.Contains(ScramSha256.Mechanism))
|
if (!mechanisms.Contains(ScramSha256.Mechanism))
|
||||||
throw new NotSupportedException($"The server offers SASL mechanisms {string.Join(", ", mechanisms)}; only {ScramSha256.Mechanism} is supported.");
|
throw new NotSupportedException($"The server offers SASL mechanisms {string.Join(", ", mechanisms)}; only {ScramSha256.Mechanism} is supported.");
|
||||||
scram = new ScramSha256(RequirePassword());
|
scram = new ScramSha256(RequirePassword());
|
||||||
var first = scram.ClientFirstMessage();
|
var first = scram.ClientFirstMessage();
|
||||||
_write.StartMessage('p');
|
_write.StartMessage('p');
|
||||||
_write.WriteCString(ScramSha256.Mechanism);
|
_write.WriteCString(ScramSha256.Mechanism);
|
||||||
_write.WriteInt32(first.Length);
|
_write.WriteInt32(first.Length);
|
||||||
_write.Write(first);
|
_write.Write(first);
|
||||||
_write.EndMessage();
|
_write.EndMessage();
|
||||||
return scram;
|
return scram;
|
||||||
}
|
}
|
||||||
case 11:
|
case 11:
|
||||||
var final = (scram ?? throw ProtocolViolation((byte)'R')).ClientFinalMessage(payload[4..]);
|
var final = (scram ?? throw ProtocolViolation((byte)'R')).ClientFinalMessage(payload[4..]);
|
||||||
_write.StartMessage('p');
|
_write.StartMessage('p');
|
||||||
@@ -846,20 +846,20 @@ internal sealed class PgConnector : IAsyncDisposable
|
|||||||
LogNotice();
|
LogNotice();
|
||||||
continue;
|
continue;
|
||||||
case (byte)'S':
|
case (byte)'S':
|
||||||
{
|
{
|
||||||
var pos = 0;
|
var pos = 0;
|
||||||
var name = ReadCString(Payload, ref pos);
|
var name = ReadCString(Payload, ref pos);
|
||||||
_serverParameters[name] = ReadCString(Payload, ref pos);
|
_serverParameters[name] = ReadCString(Payload, ref pos);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case (byte)'A':
|
case (byte)'A':
|
||||||
{
|
{
|
||||||
var pos = 4;
|
var pos = 4;
|
||||||
var channel = ReadCString(Payload, ref pos);
|
var channel = ReadCString(Payload, ref pos);
|
||||||
var payload = ReadCString(Payload, ref pos);
|
var payload = ReadCString(Payload, ref pos);
|
||||||
NotificationReceived?.Invoke(new PgNotification(BinaryPrimitives.ReadInt32BigEndian(Payload), channel, payload));
|
NotificationReceived?.Invoke(new PgNotification(BinaryPrimitives.ReadInt32BigEndian(Payload), channel, payload));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,17 +105,17 @@ internal static class PgTypes
|
|||||||
WriteCopyEscaped(s, writer);
|
WriteCopyEscaped(s, writer);
|
||||||
return;
|
return;
|
||||||
case byte[] bytes:
|
case byte[] bytes:
|
||||||
{
|
|
||||||
var span = writer.GetSpan(3 + bytes.Length * 2);
|
|
||||||
"\\\\x"u8.CopyTo(span);
|
|
||||||
for (var i = 0; i < bytes.Length; i++)
|
|
||||||
{
|
{
|
||||||
span[3 + 2 * i] = HexDigits[bytes[i] >> 4];
|
var span = writer.GetSpan(3 + bytes.Length * 2);
|
||||||
span[4 + 2 * i] = HexDigits[bytes[i] & 0xF];
|
"\\\\x"u8.CopyTo(span);
|
||||||
|
for (var i = 0; i < bytes.Length; i++)
|
||||||
|
{
|
||||||
|
span[3 + 2 * i] = HexDigits[bytes[i] >> 4];
|
||||||
|
span[4 + 2 * i] = HexDigits[bytes[i] & 0xF];
|
||||||
|
}
|
||||||
|
writer.Advance(3 + bytes.Length * 2);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
writer.Advance(3 + bytes.Length * 2);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
case int or long or double or bool or Guid or DateTimeOffset:
|
case int or long or double or bool or Guid or DateTimeOffset:
|
||||||
case DateTime { Kind: DateTimeKind.Unspecified }:
|
case DateTime { Kind: DateTimeKind.Unspecified }:
|
||||||
writer.Advance(FormatText(value, writer.GetSpan(64)));
|
writer.Advance(FormatText(value, writer.GetSpan(64)));
|
||||||
|
|||||||
@@ -32,11 +32,26 @@ public abstract class CatalogRepositoryTests(TestContext context) : RepositoryTe
|
|||||||
await db.Archives.UpsertAsync(archive, Ct);
|
await db.Archives.UpsertAsync(archive, Ct);
|
||||||
var sequence = TestData.Sequence(archive.Id, new DateTime(2026, 9, 28, 18, 30, 15, 250), "Harbour sunset") with
|
var sequence = TestData.Sequence(archive.Id, new DateTime(2026, 9, 28, 18, 30, 15, 250), "Harbour sunset") with
|
||||||
{
|
{
|
||||||
CameraSerial = "0123", Lens = "RF 24-70", FrameCount = 1200, MedianInterval = 5.0, TotalBytes = 30_000_000_000,
|
CameraSerial = "0123",
|
||||||
Status = SequenceStatus.AnalyzedLight | SequenceStatus.ThumbsBuilt, RenderedCount = 0, VerifiedAt = TestData.Now,
|
Lens = "RF 24-70",
|
||||||
HeroFrameId = Guid.CreateVersion7(), Rating = 4, Notes = "windy", SettingsJson = "{\"fps\": 25, \"deflicker\": true}",
|
FrameCount = 1200,
|
||||||
AnalysisJson = "{\"ev\": [12.5, 13]}", Origin = SequenceOrigin.Server, SyncState = SyncState.LocalAhead,
|
MedianInterval = 5.0,
|
||||||
SettingsVersion = 3, FramesVersion = 7, OwnerUserId = Guid.CreateVersion7(), WarningCount = 2, Tags = ["Sunset", "harbour", "SUNSET"],
|
TotalBytes = 30_000_000_000,
|
||||||
|
Status = SequenceStatus.AnalyzedLight | SequenceStatus.ThumbsBuilt,
|
||||||
|
RenderedCount = 0,
|
||||||
|
VerifiedAt = TestData.Now,
|
||||||
|
HeroFrameId = Guid.CreateVersion7(),
|
||||||
|
Rating = 4,
|
||||||
|
Notes = "windy",
|
||||||
|
SettingsJson = "{\"fps\": 25, \"deflicker\": true}",
|
||||||
|
AnalysisJson = "{\"ev\": [12.5, 13]}",
|
||||||
|
Origin = SequenceOrigin.Server,
|
||||||
|
SyncState = SyncState.LocalAhead,
|
||||||
|
SettingsVersion = 3,
|
||||||
|
FramesVersion = 7,
|
||||||
|
OwnerUserId = Guid.CreateVersion7(),
|
||||||
|
WarningCount = 2,
|
||||||
|
Tags = ["Sunset", "harbour", "SUNSET"],
|
||||||
};
|
};
|
||||||
await db.Sequences.UpsertAsync(sequence, Ct);
|
await db.Sequences.UpsertAsync(sequence, Ct);
|
||||||
|
|
||||||
@@ -120,7 +135,8 @@ public abstract class CatalogRepositoryTests(TestContext context) : RepositoryTe
|
|||||||
await db.Archives.UpsertAsync(archive, Ct);
|
await db.Archives.UpsertAsync(archive, Ct);
|
||||||
var all = Enumerable.Range(0, 23).Select(i => TestData.Sequence(archive.Id,
|
var all = Enumerable.Range(0, 23).Select(i => TestData.Sequence(archive.Id,
|
||||||
i % 5 == 4 ? null : new DateTime(2024 + i % 3, 1, 1, 12, 0, 0),
|
i % 5 == 4 ? null : new DateTime(2024 + i % 3, 1, 1, 12, 0, 0),
|
||||||
i % 4 == 0 ? null : "T" + (i % 6)) with { FrameCount = i % 3, TotalBytes = i % 4 * 1000L })
|
i % 4 == 0 ? null : "T" + (i % 6)) with
|
||||||
|
{ FrameCount = i % 3, TotalBytes = i % 4 * 1000L })
|
||||||
.ToList();
|
.ToList();
|
||||||
foreach (var s in all) await db.Sequences.UpsertAsync(s, Ct);
|
foreach (var s in all) await db.Sequences.UpsertAsync(s, Ct);
|
||||||
|
|
||||||
@@ -208,9 +224,19 @@ public abstract class CatalogRepositoryTests(TestContext context) : RepositoryTe
|
|||||||
var frames = Enumerable.Range(0, 250).Select(i => TestData.Frame(sequence.Id, i)).ToList();
|
var frames = Enumerable.Range(0, 250).Select(i => TestData.Frame(sequence.Id, i)).ToList();
|
||||||
frames[7] = frames[7] with
|
frames[7] = frames[7] with
|
||||||
{
|
{
|
||||||
OriginalFileName = "DSC_7.NEF", CapturedAt = new DateTime(2026, 9, 28, 18, 0, 35, 123), UtcOffsetMinutes = 120, ExposureBias = -0.3,
|
OriginalFileName = "DSC_7.NEF",
|
||||||
WhiteBalance = 5600, Orientation = 6, PreviewOffset = 1024, PreviewLength = 65536, MeanLogLuminance = -2.5, ClipLow = 0.01,
|
CapturedAt = new DateTime(2026, 9, 28, 18, 0, 35, 123),
|
||||||
ClipHigh = 0.02, Flags = FrameFlags.Excluded, Sha256 = "AB" + new string('c', 62),
|
UtcOffsetMinutes = 120,
|
||||||
|
ExposureBias = -0.3,
|
||||||
|
WhiteBalance = 5600,
|
||||||
|
Orientation = 6,
|
||||||
|
PreviewOffset = 1024,
|
||||||
|
PreviewLength = 65536,
|
||||||
|
MeanLogLuminance = -2.5,
|
||||||
|
ClipLow = 0.01,
|
||||||
|
ClipHigh = 0.02,
|
||||||
|
Flags = FrameFlags.Excluded,
|
||||||
|
Sha256 = "AB" + new string('c', 62),
|
||||||
};
|
};
|
||||||
Assert.Equal(250L, await db.Frames.BulkInsertAsync(frames, Ct));
|
Assert.Equal(250L, await db.Frames.BulkInsertAsync(frames, Ct));
|
||||||
var copy = TestData.Frame(sequence.Id, 1000) with { Sha256 = frames[7].Sha256 };
|
var copy = TestData.Frame(sequence.Id, 1000) with { Sha256 = frames[7].Sha256 };
|
||||||
|
|||||||
@@ -13,10 +13,22 @@ public abstract class JobRepositoryTests(TestContext context) : RepositoryTest(c
|
|||||||
var db = await OpenTitanoAsync();
|
var db = await OpenTitanoAsync();
|
||||||
var job = TestData.Job(JobKind.Render, JobPriority.User) with
|
var job = TestData.Job(JobKind.Render, JobPriority.User) with
|
||||||
{
|
{
|
||||||
TargetIds = [Guid.CreateVersion7(), Guid.CreateVersion7()], TargetLabel = "Harbour sunset", ParametersJson = "{\"preset\": \"4K\"}",
|
TargetIds = [Guid.CreateVersion7(), Guid.CreateVersion7()],
|
||||||
ProgressDone = 5, ProgressTotal = 10, ItemsPerSecond = 2.5, Eta = TimeSpan.FromSeconds(2), Checkpoint = "frame:5",
|
TargetLabel = "Harbour sunset",
|
||||||
LogTail = "line 1\nline 2", CreatedBy = Guid.CreateVersion7(), NodeId = "node-a", Attempts = 1, Error = "boom",
|
ParametersJson = "{\"preset\": \"4K\"}",
|
||||||
State = JobState.Failed, Started = TestData.Now.AddMinutes(1), Finished = TestData.Now.AddMinutes(2),
|
ProgressDone = 5,
|
||||||
|
ProgressTotal = 10,
|
||||||
|
ItemsPerSecond = 2.5,
|
||||||
|
Eta = TimeSpan.FromSeconds(2),
|
||||||
|
Checkpoint = "frame:5",
|
||||||
|
LogTail = "line 1\nline 2",
|
||||||
|
CreatedBy = Guid.CreateVersion7(),
|
||||||
|
NodeId = "node-a",
|
||||||
|
Attempts = 1,
|
||||||
|
Error = "boom",
|
||||||
|
State = JobState.Failed,
|
||||||
|
Started = TestData.Now.AddMinutes(1),
|
||||||
|
Finished = TestData.Now.AddMinutes(2),
|
||||||
};
|
};
|
||||||
await db.Jobs.EnqueueAsync(job, Ct);
|
await db.Jobs.EnqueueAsync(job, Ct);
|
||||||
var read = Assert.NotNull(await db.Jobs.GetAsync(job.Id, Ct));
|
var read = Assert.NotNull(await db.Jobs.GetAsync(job.Id, Ct));
|
||||||
|
|||||||
@@ -131,8 +131,15 @@ public abstract class ServerRepositoryTests(TestContext context) : RepositoryTes
|
|||||||
var user = Guid.CreateVersion7();
|
var user = Guid.CreateVersion7();
|
||||||
var entries = Enumerable.Range(0, 9).Select(i => new AuditEntry
|
var entries = Enumerable.Range(0, 9).Select(i => new AuditEntry
|
||||||
{
|
{
|
||||||
Id = Guid.CreateVersion7(), At = TestData.Now.AddSeconds(i / 2), Action = "sequence.delete", UserId = i % 3 == 0 ? user : null,
|
Id = Guid.CreateVersion7(),
|
||||||
Username = "alice", TargetKind = "sequence", TargetId = Guid.CreateVersion7().ToString(), Details = "{\"frames\": 10}", RemoteAddress = "10.0.0.1",
|
At = TestData.Now.AddSeconds(i / 2),
|
||||||
|
Action = "sequence.delete",
|
||||||
|
UserId = i % 3 == 0 ? user : null,
|
||||||
|
Username = "alice",
|
||||||
|
TargetKind = "sequence",
|
||||||
|
TargetId = Guid.CreateVersion7().ToString(),
|
||||||
|
Details = "{\"frames\": 10}",
|
||||||
|
RemoteAddress = "10.0.0.1",
|
||||||
}).ToList();
|
}).ToList();
|
||||||
foreach (var e in entries) await db.Audit.AppendAsync(e, Ct);
|
foreach (var e in entries) await db.Audit.AppendAsync(e, Ct);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user