File tree Expand file tree Collapse file tree 3 files changed +8
-1
lines changed
DurableStateMachines.Tests Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 11using Microsoft . Extensions . DependencyInjection ;
2+ using Newtonsoft . Json . Linq ;
23using System . Buffers ;
34using System . Collections ;
45using 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 ;
Original file line number Diff line number Diff 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 ) ) ;
You can’t perform that action at this time.
0 commit comments