1717using System . Collections . Generic ;
1818using System . Linq ;
1919using System . Threading ;
20- using Hangfire . Annotations ;
2120using Hangfire . Common ;
2221using Hangfire . InMemory . Entities ;
2322using Hangfire . InMemory . State ;
@@ -31,7 +30,7 @@ internal sealed class InMemoryConnection<TKey> : JobStorageConnection
3130 {
3231 private readonly List < LockDisposable > _acquiredLocks = new ( ) ;
3332
34- public InMemoryConnection ( [ NotNull ] InMemoryStorageOptions options , [ NotNull ] DispatcherBase < TKey > dispatcher , [ NotNull ] IKeyProvider < TKey > keyProvider )
33+ public InMemoryConnection ( InMemoryStorageOptions options , DispatcherBase < TKey > dispatcher , IKeyProvider < TKey > keyProvider )
3534 {
3635 Options = options ?? throw new ArgumentNullException ( nameof ( options ) ) ;
3736 Dispatcher = dispatcher ?? throw new ArgumentNullException ( nameof ( dispatcher ) ) ;
@@ -57,7 +56,7 @@ public override IWriteOnlyTransaction CreateWriteTransaction()
5756 return new InMemoryTransaction < TKey > ( this ) ;
5857 }
5958
60- public override IDisposable AcquireDistributedLock ( [ NotNull ] string resource , TimeSpan timeout )
59+ public override IDisposable AcquireDistributedLock ( string resource , TimeSpan timeout )
6160 {
6261 if ( resource == null ) throw new ArgumentNullException ( nameof ( resource ) ) ;
6362
@@ -70,8 +69,8 @@ public override IDisposable AcquireDistributedLock([NotNull] string resource, Ti
7069 }
7170
7271 public override string CreateExpiredJob (
73- [ NotNull ] Job job ,
74- [ NotNull ] IDictionary < string , string ? > parameters ,
72+ Job job ,
73+ IDictionary < string , string ? > parameters ,
7574 DateTime createdAt ,
7675 TimeSpan expireIn )
7776 {
@@ -86,7 +85,7 @@ public override string CreateExpiredJob(
8685 return KeyProvider . ToString ( key ) ;
8786 }
8887
89- public override IFetchedJob FetchNextJob ( [ NotNull ] string [ ] queues , CancellationToken cancellationToken )
88+ public override IFetchedJob FetchNextJob ( string [ ] queues , CancellationToken cancellationToken )
9089 {
9190 if ( queues == null ) throw new ArgumentNullException ( nameof ( queues ) ) ;
9291 if ( queues . Length == 0 ) throw new ArgumentException ( "Queue array must be non-empty." , nameof ( queues ) ) ;
@@ -158,7 +157,7 @@ private InMemoryFetchedJob<TKey> FetchNextJobSlow(KeyValuePair<string, QueueEntr
158157 }
159158 }
160159
161- public override void SetJobParameter ( [ NotNull ] string id , [ NotNull ] string name , [ CanBeNull ] string ? value )
160+ public override void SetJobParameter ( string id , string name , string ? value )
162161 {
163162 if ( id == null ) throw new ArgumentNullException ( nameof ( id ) ) ;
164163 if ( name == null ) throw new ArgumentNullException ( nameof ( name ) ) ;
@@ -171,7 +170,7 @@ public override void SetJobParameter([NotNull] string id, [NotNull] string name,
171170 Dispatcher . QueryWriteAndWait ( new Commands < TKey > . JobSetParameter ( key , name , value ) ) ;
172171 }
173172
174- public override string ? GetJobParameter ( [ NotNull ] string id , [ NotNull ] string name )
173+ public override string ? GetJobParameter ( string id , string name )
175174 {
176175 if ( id == null ) throw new ArgumentNullException ( nameof ( id ) ) ;
177176 if ( name == null ) throw new ArgumentNullException ( nameof ( name ) ) ;
@@ -184,7 +183,7 @@ public override void SetJobParameter([NotNull] string id, [NotNull] string name,
184183 return Dispatcher . QueryReadAndWait ( new Queries < TKey > . JobGetParameter ( key , name ) , static ( q , s ) => q . Execute ( s ) ) ;
185184 }
186185
187- public override JobData ? GetJobData ( [ NotNull ] string jobId )
186+ public override JobData ? GetJobData ( string jobId )
188187 {
189188 if ( jobId == null ) throw new ArgumentNullException ( nameof ( jobId ) ) ;
190189
@@ -209,7 +208,7 @@ public override void SetJobParameter([NotNull] string id, [NotNull] string name,
209208 } ;
210209 }
211210
212- public override StateData ? GetStateData ( [ NotNull ] string jobId )
211+ public override StateData ? GetStateData ( string jobId )
213212 {
214213 if ( jobId == null ) throw new ArgumentNullException ( nameof ( jobId ) ) ;
215214
@@ -229,7 +228,7 @@ public override void SetJobParameter([NotNull] string id, [NotNull] string name,
229228 } ;
230229 }
231230
232- public override void AnnounceServer ( [ NotNull ] string serverId , [ NotNull ] ServerContext context )
231+ public override void AnnounceServer ( string serverId , ServerContext context )
233232 {
234233 if ( serverId == null ) throw new ArgumentNullException ( nameof ( serverId ) ) ;
235234 if ( context == null ) throw new ArgumentNullException ( nameof ( context ) ) ;
@@ -238,14 +237,14 @@ public override void AnnounceServer([NotNull] string serverId, [NotNull] ServerC
238237 Dispatcher . QueryWriteAndWait ( new Commands < TKey > . ServerAnnounce ( serverId , context , now ) , static ( c , s ) => c . Execute ( s ) ) ;
239238 }
240239
241- public override void RemoveServer ( [ NotNull ] string serverId )
240+ public override void RemoveServer ( string serverId )
242241 {
243242 if ( serverId == null ) throw new ArgumentNullException ( nameof ( serverId ) ) ;
244243
245244 Dispatcher . QueryWriteAndWait ( new Commands < TKey > . ServerDelete ( serverId ) , static ( c , s ) => c . Execute ( s ) ) ;
246245 }
247246
248- public override void Heartbeat ( [ NotNull ] string serverId )
247+ public override void Heartbeat ( string serverId )
249248 {
250249 if ( serverId == null ) throw new ArgumentNullException ( nameof ( serverId ) ) ;
251250
@@ -276,14 +275,14 @@ public override DateTime GetUtcDateTime()
276275 }
277276#endif
278277
279- public override HashSet < string > GetAllItemsFromSet ( [ NotNull ] string key )
278+ public override HashSet < string > GetAllItemsFromSet ( string key )
280279 {
281280 if ( key == null ) throw new ArgumentNullException ( nameof ( key ) ) ;
282281
283282 return Dispatcher . QueryReadAndWait ( new Queries < TKey > . SortedSetGetAll ( key ) , static ( q , s ) => q . Execute ( s ) ) ;
284283 }
285284
286- public override string ? GetFirstByLowestScoreFromSet ( [ NotNull ] string key , double fromScore , double toScore )
285+ public override string ? GetFirstByLowestScoreFromSet ( string key , double fromScore , double toScore )
287286 {
288287 if ( key == null ) throw new ArgumentNullException ( nameof ( key ) ) ;
289288 if ( toScore < fromScore ) throw new ArgumentException ( "The `toScore` value must be greater or equal to the `fromScore` value." , nameof ( toScore ) ) ;
@@ -293,7 +292,7 @@ public override HashSet<string> GetAllItemsFromSet([NotNull] string key)
293292 static ( q , s ) => q . Execute ( s ) ) ;
294293 }
295294
296- public override List < string > GetFirstByLowestScoreFromSet ( [ NotNull ] string key , double fromScore , double toScore , int count )
295+ public override List < string > GetFirstByLowestScoreFromSet ( string key , double fromScore , double toScore , int count )
297296 {
298297 if ( key == null ) throw new ArgumentNullException ( nameof ( key ) ) ;
299298 if ( toScore < fromScore ) throw new ArgumentException ( "The `toScore` value must be greater or equal to the `fromScore` value." , nameof ( toScore ) ) ;
@@ -305,7 +304,7 @@ public override List<string> GetFirstByLowestScoreFromSet([NotNull] string key,
305304 }
306305
307306#if ! HANGFIRE_170
308- public override bool GetSetContains ( [ NotNull ] string key , [ NotNull ] string value )
307+ public override bool GetSetContains ( string key , string value )
309308 {
310309 if ( key == null ) throw new ArgumentNullException ( nameof ( key ) ) ;
311310 if ( value == null ) throw new ArgumentNullException ( nameof ( value ) ) ;
@@ -314,15 +313,15 @@ public override bool GetSetContains([NotNull] string key, [NotNull] string value
314313 }
315314#endif
316315
317- public override long GetSetCount ( [ NotNull ] string key )
316+ public override long GetSetCount ( string key )
318317 {
319318 if ( key == null ) throw new ArgumentNullException ( nameof ( key ) ) ;
320319
321320 return Dispatcher . QueryReadAndWait ( new Queries < TKey > . SortedSetCount ( key ) , static ( q , s ) => q . Execute ( s ) ) ;
322321 }
323322
324323#if ! HANGFIRE_170
325- public override long GetSetCount ( [ NotNull ] IEnumerable < string > keys , int limit )
324+ public override long GetSetCount ( IEnumerable < string > keys , int limit )
326325 {
327326 if ( keys == null ) throw new ArgumentNullException ( nameof ( keys ) ) ;
328327 if ( limit < 0 ) throw new ArgumentOutOfRangeException ( nameof ( limit ) , "Value must be greater or equal to 0." ) ;
@@ -333,28 +332,28 @@ public override long GetSetCount([NotNull] IEnumerable<string> keys, int limit)
333332 }
334333#endif
335334
336- public override long GetListCount ( [ NotNull ] string key )
335+ public override long GetListCount ( string key )
337336 {
338337 if ( key == null ) throw new ArgumentNullException ( nameof ( key ) ) ;
339338
340339 return Dispatcher . QueryReadAndWait ( new Queries < TKey > . ListCount ( key ) , static ( q , s ) => q . Execute ( s ) ) ;
341340 }
342341
343- public override long GetCounter ( [ NotNull ] string key )
342+ public override long GetCounter ( string key )
344343 {
345344 if ( key == null ) throw new ArgumentNullException ( nameof ( key ) ) ;
346345
347346 return Dispatcher . QueryReadAndWait ( new Queries < TKey > . CounterGet ( key ) , static ( q , s ) => q . Execute ( s ) ) ;
348347 }
349348
350- public override long GetHashCount ( [ NotNull ] string key )
349+ public override long GetHashCount ( string key )
351350 {
352351 if ( key == null ) throw new ArgumentNullException ( nameof ( key ) ) ;
353352
354353 return Dispatcher . QueryReadAndWait ( new Queries < TKey > . HashFieldCount ( key ) , static ( q , s ) => q . Execute ( s ) ) ;
355354 }
356355
357- public override TimeSpan GetHashTtl ( [ NotNull ] string key )
356+ public override TimeSpan GetHashTtl ( string key )
358357 {
359358 if ( key == null ) throw new ArgumentNullException ( nameof ( key ) ) ;
360359
@@ -367,7 +366,7 @@ public override TimeSpan GetHashTtl([NotNull] string key)
367366 return expireIn >= TimeSpan . Zero ? expireIn : TimeSpan . Zero ;
368367 }
369368
370- public override TimeSpan GetListTtl ( [ NotNull ] string key )
369+ public override TimeSpan GetListTtl ( string key )
371370 {
372371 if ( key == null ) throw new ArgumentNullException ( nameof ( key ) ) ;
373372
@@ -380,7 +379,7 @@ public override TimeSpan GetListTtl([NotNull] string key)
380379 return expireIn >= TimeSpan . Zero ? expireIn : TimeSpan . Zero ;
381380 }
382381
383- public override TimeSpan GetSetTtl ( [ NotNull ] string key )
382+ public override TimeSpan GetSetTtl ( string key )
384383 {
385384 if ( key == null ) throw new ArgumentNullException ( nameof ( key ) ) ;
386385
@@ -393,37 +392,37 @@ public override TimeSpan GetSetTtl([NotNull] string key)
393392 return expireIn >= TimeSpan . Zero ? expireIn : TimeSpan . Zero ;
394393 }
395394
396- public override void SetRangeInHash ( [ NotNull ] string key , [ NotNull ] IEnumerable < KeyValuePair < string , string > > keyValuePairs )
395+ public override void SetRangeInHash ( string key , IEnumerable < KeyValuePair < string , string > > keyValuePairs )
397396 {
398397 if ( key == null ) throw new ArgumentNullException ( nameof ( key ) ) ;
399398 if ( keyValuePairs == null ) throw new ArgumentNullException ( nameof ( keyValuePairs ) ) ;
400399
401400 Dispatcher . QueryWriteAndWait ( new Commands < TKey > . HashSetRange ( key , keyValuePairs ) ) ;
402401 }
403402
404- public override Dictionary < string , string > ? GetAllEntriesFromHash ( [ NotNull ] string key )
403+ public override Dictionary < string , string > ? GetAllEntriesFromHash ( string key )
405404 {
406405 if ( key == null ) throw new ArgumentNullException ( nameof ( key ) ) ;
407406
408407 return Dispatcher . QueryReadAndWait ( new Queries < TKey > . HashGetAll ( key ) , static ( q , s ) => q . Execute ( s ) ) ;
409408 }
410409
411- public override string ? GetValueFromHash ( [ NotNull ] string key , [ NotNull ] string name )
410+ public override string ? GetValueFromHash ( string key , string name )
412411 {
413412 if ( key == null ) throw new ArgumentNullException ( nameof ( key ) ) ;
414413 if ( name == null ) throw new ArgumentNullException ( nameof ( name ) ) ;
415414
416415 return Dispatcher . QueryReadAndWait ( new Queries < TKey > . HashGet ( key , name ) , static ( q , s ) => q . Execute ( s ) ) ;
417416 }
418417
419- public override List < string > GetAllItemsFromList ( [ NotNull ] string key )
418+ public override List < string > GetAllItemsFromList ( string key )
420419 {
421420 if ( key == null ) throw new ArgumentNullException ( nameof ( key ) ) ;
422421
423422 return Dispatcher . QueryReadAndWait ( new Queries < TKey > . ListGetAll ( key ) , static ( q , s ) => q . Execute ( s ) ) ;
424423 }
425424
426- public override List < string > GetRangeFromList ( [ NotNull ] string key , int startingFrom , int endingAt )
425+ public override List < string > GetRangeFromList ( string key , int startingFrom , int endingAt )
427426 {
428427 if ( key == null ) throw new ArgumentNullException ( nameof ( key ) ) ;
429428 if ( startingFrom < 0 ) throw new ArgumentException ( "The value must be greater than or equal to zero." , nameof ( startingFrom ) ) ;
@@ -432,7 +431,7 @@ public override List<string> GetRangeFromList([NotNull] string key, int starting
432431 return Dispatcher . QueryReadAndWait ( new Queries < TKey > . ListRange ( key , startingFrom , endingAt ) , static ( q , s ) => q . Execute ( s ) ) ;
433432 }
434433
435- public override List < string > GetRangeFromSet ( [ NotNull ] string key , int startingFrom , int endingAt )
434+ public override List < string > GetRangeFromSet ( string key , int startingFrom , int endingAt )
436435 {
437436 if ( key == null ) throw new ArgumentNullException ( nameof ( key ) ) ;
438437 if ( startingFrom < 0 ) throw new ArgumentException ( "The value must be greater than or equal to zero." , nameof ( startingFrom ) ) ;
0 commit comments