Skip to content

Commit 6de9c62

Browse files
minor stuff
1 parent 1420822 commit 6de9c62

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

DurableStateMachines.Tests/DurableOrderedSetLookupTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ public async Task Restore()
241241
{
242242
var value = $"val{i}_{j}";
243243
await grain.Add(key, value);
244+
244245
values.Add(value);
245246
}
246247

@@ -250,6 +251,7 @@ public async Task Restore()
250251
await DeactivateGrain(grain); // To trigger a restore from the snapshot
251252

252253
var actualAfterRestore = await grain.GetAll();
254+
253255
Assert.Equal(NumKeys, await grain.GetCount());
254256
Assert.Equivalent(expected.Keys, actualAfterRestore.Keys);
255257

DurableStateMachines/DurableOrderedSet.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Microsoft.Extensions.DependencyInjection;
2+
using Newtonsoft.Json.Linq;
23
using System.Buffers;
34
using System.Collections;
45
using System.Diagnostics;
@@ -170,10 +171,11 @@ void IDurableStateMachine.Apply(ReadOnlySequence<byte> logEntry)
170171

171172
if (version != VersionByte)
172173
{
173-
throw new NotSupportedException($"Unsupported log version: {version}.");
174+
throw new NotSupportedException($"This instance of {nameof(DurableOrderedSet<T>)} supports version {(uint)VersionByte} and not version {(uint)version}.");
174175
}
175176

176177
var command = (CommandType)reader.ReadVarUInt32();
178+
177179
switch (command)
178180
{
179181
case CommandType.Add: ApplyAdd(ReadValue(ref reader)); break;

DurableStateMachines/DurableOrderedSetLookup.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ void IDurableStateMachine.Apply(ReadOnlySequence<byte> logEntry)
150150
}
151151

152152
var command = (CommandType)reader.ReadVarUInt32();
153+
153154
switch (command)
154155
{
155156
case CommandType.Add: _ = ApplyAdd(ReadKey(ref reader), ReadValue(ref reader)); break;
@@ -180,10 +181,12 @@ void ApplySnapshot(ref Reader<ReadOnlySequenceInput> reader)
180181
ApplyClear();
181182

182183
_items.EnsureCapacity(keyCount);
184+
183185
for (var i = 0; i < keyCount; i++)
184186
{
185187
var key = ReadKey(ref reader);
186188
var valueCount = (int)reader.ReadVarUInt32();
189+
187190
for (var j = 0; j < valueCount; j++)
188191
{
189192
_ = ApplyAdd(key, ReadValue(ref reader));

0 commit comments

Comments
 (0)