Skip to content

Commit 8b11234

Browse files
authored
Prefer const over readonly (#8533)
Add accessibility modifiers when absent
1 parent b67a2b6 commit 8b11234

File tree

8 files changed

+28
-28
lines changed

8 files changed

+28
-28
lines changed

src/Orleans.Core/GrainDirectory/IDhtGrainDirectory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Orleans.GrainDirectory
99
/// <summary>
1010
/// Recursive distributed operations on grain directories.
1111
/// Each operation may forward the request to a remote owner, increasing the hopCount.
12-
///
12+
///
1313
/// The methods here can be called remotely (where extended by IRemoteGrainDirectory) or
1414
/// locally (where extended by ILocalGrainDirectory)
1515
/// </summary>
@@ -88,7 +88,7 @@ internal readonly struct AddressAndTag
8888
/// </summary>
8989
[Id(0)]
9090
public readonly GrainAddress? Address;
91-
91+
9292
/// <summary>
9393
/// The version of this entry.
9494
/// </summary>

src/Orleans.EventSourcing/LogStorage/LogViewAdaptor.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ namespace Orleans.EventSourcing.LogStorage
1313
/// A log view adaptor that wraps around a traditional storage adaptor, and uses batching and e-tags
1414
/// to append entries.
1515
///<para>
16-
/// The log itself is transient, i.e. not actually saved to storage - only the latest view and some
17-
/// metadata (the log position, and write flags) are stored.
16+
/// The log itself is transient, i.e. not actually saved to storage - only the latest view and some
17+
/// metadata (the log position, and write flags) are stored.
1818
/// </para>
1919
/// </summary>
2020
/// <typeparam name="TLogView">Type of log view</typeparam>
@@ -249,7 +249,7 @@ public override string ToString()
249249
/// </summary>
250250
[Serializable]
251251
[GenerateSerializer]
252-
protected internal sealed class UpdateNotificationMessage : INotificationMessage
252+
protected internal sealed class UpdateNotificationMessage : INotificationMessage
253253
{
254254
/// <inheritdoc/>
255255
[Id(0)]
@@ -326,10 +326,10 @@ protected override void ProcessNotifications()
326326
var updateNotification = notifications.ElementAt(0).Value;
327327
notifications.RemoveAt(0);
328328

329-
// append all operations in pending
329+
// append all operations in pending
330330
foreach (var u in updateNotification.Updates)
331331
GlobalLog.StateAndMetaData.Log.Add(u);
332-
332+
333333
GlobalLog.StateAndMetaData.FlipBit(updateNotification.Origin);
334334

335335
GlobalLog.ETag = updateNotification.ETag;
@@ -342,7 +342,7 @@ protected override void ProcessNotifications()
342342
Services.Log(LogLevel.Trace, "unprocessed notifications in queue: {0}", notifications.Count);
343343

344344
base.ProcessNotifications();
345-
345+
346346
}
347347

348348

src/Orleans.EventSourcing/StateStorage/LogViewAdaptor.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ namespace Orleans.EventSourcing.StateStorage
1313
/// A log view adaptor that wraps around a traditional storage adaptor, and uses batching and e-tags
1414
/// to append entries.
1515
///<para>
16-
/// The log itself is transient, i.e. not actually saved to storage - only the latest view and some
17-
/// metadata (the log position, and write flags) are stored.
16+
/// The log itself is transient, i.e. not actually saved to storage - only the latest view and some
17+
/// metadata (the log position, and write flags) are stored.
1818
/// </para>
1919
/// </summary>
2020
/// <typeparam name="TLogView">Type of log view</typeparam>
@@ -219,7 +219,7 @@ public override string ToString()
219219
/// </summary>
220220
[Serializable]
221221
[GenerateSerializer]
222-
protected internal sealed class UpdateNotificationMessage : INotificationMessage
222+
protected internal sealed class UpdateNotificationMessage : INotificationMessage
223223
{
224224
/// <inheritdoc/>
225225
[Id(0)]
@@ -296,7 +296,7 @@ protected override void ProcessNotifications()
296296
var updateNotification = notifications.ElementAt(0).Value;
297297
notifications.RemoveAt(0);
298298

299-
// Apply all operations in pending
299+
// Apply all operations in pending
300300
foreach (var u in updateNotification.Updates)
301301
try
302302
{
@@ -311,15 +311,15 @@ protected override void ProcessNotifications()
311311

312312
GlobalStateCache.StateAndMetaData.FlipBit(updateNotification.Origin);
313313

314-
GlobalStateCache.ETag = updateNotification.ETag;
314+
GlobalStateCache.ETag = updateNotification.ETag;
315315

316316
Services.Log(LogLevel.Debug, "notification success ({0} updates) {1}", updateNotification.Updates.Count, GlobalStateCache);
317317
}
318318

319319
Services.Log(LogLevel.Trace, "unprocessed notifications in queue: {0}", notifications.Count);
320320

321321
base.ProcessNotifications();
322-
322+
323323
}
324324

325325

test/DefaultCluster.Tests/EchoTaskGrainTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public async Task EchoGrain_Echo()
5252
public async Task EchoGrain_EchoError()
5353
{
5454
var grain = this.GrainFactory.GetGrain<IEchoTaskGrain>(Guid.NewGuid());
55-
55+
5656
Task<string> promise = grain.EchoErrorAsync(expectedEchoError);
5757
await promise.ContinueWith(t =>
5858
{
@@ -69,7 +69,7 @@ await promise.ContinueWith(t =>
6969
public async Task EchoGrain_Timeout_ContinueWith()
7070
{
7171
var grain = this.GrainFactory.GetGrain<IEchoTaskGrain>(Guid.NewGuid());
72-
72+
7373
TimeSpan delay5 = TimeSpan.FromSeconds(30); // grain call timeout (set in config)
7474
TimeSpan delay45 = TimeSpan.FromSeconds(45);
7575
TimeSpan delay60 = TimeSpan.FromSeconds(60);
@@ -94,7 +94,7 @@ await promise.ContinueWith(
9494
public async Task EchoGrain_Timeout_Await()
9595
{
9696
var grain = this.GrainFactory.GetGrain<IEchoTaskGrain>(Guid.NewGuid());
97-
97+
9898
TimeSpan delay5 = TimeSpan.FromSeconds(5);
9999
TimeSpan delay25 = TimeSpan.FromSeconds(25);
100100
Stopwatch sw = new Stopwatch();
@@ -118,7 +118,7 @@ public async Task EchoGrain_Timeout_Await()
118118
public async Task EchoGrain_Timeout_Result()
119119
{
120120
var grain = this.GrainFactory.GetGrain<IEchoTaskGrain>(Guid.NewGuid());
121-
121+
122122
TimeSpan delay5 = TimeSpan.FromSeconds(5);
123123
TimeSpan delay25 = TimeSpan.FromSeconds(25);
124124
Stopwatch sw = new Stopwatch();
@@ -197,7 +197,7 @@ public async Task EchoGrain_Ping()
197197

198198
what = "EchoGrain.Ping";
199199
clock.Restart();
200-
200+
201201
await grain.PingAsync().WaitAsync(timeout);
202202
this.Logger.LogInformation("{What} took {Elapsed}", what, clock.Elapsed);
203203
}

test/DefaultCluster.Tests/GenericGrainTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public async Task GenericGrainTests_ConcreteGrainWithGenericInterfaceGetGrain()
5252
Assert.Equal("789", stringResult);
5353
}
5454

55-
/// Multiple GetGrain requests with the same id return the same concrete grain
55+
/// Multiple GetGrain requests with the same id return the same concrete grain
5656
[Fact]
5757
public async Task GenericGrainTests_ConcreteGrainWithGenericInterfaceMultiplicity()
5858
{
@@ -149,7 +149,7 @@ public async Task GenericGrainTests_SimpleGenericGrainMultiplicity()
149149
Assert.Equal(1.2f, floatResult);
150150
}
151151

152-
/// If both a concrete implementation and a generic implementation of a
152+
/// If both a concrete implementation and a generic implementation of a
153153
/// generic interface exist, prefer the concrete implementation.
154154
[Fact]
155155
public async Task GenericGrainTests_PreferConcreteGrainImplementationOfGenericInterface()
@@ -240,7 +240,7 @@ public async Task GenericGrainTests_ConcreteGrainWithMultipleGenericInterfacesMu
240240
await grainRef1.Set(1);
241241
await grainRef1.Transform(); // ConcreteGrainWith2GenericInterfaces multiplies the set value by 10:
242242

243-
// A second reference to a different interface implemented by ConcreteGrainWith2GenericInterfaces
243+
// A second reference to a different interface implemented by ConcreteGrainWith2GenericInterfaces
244244
// will reference the same grain:
245245
var grainRef2 = GetGrain<IGenericGrain<int, string>>(grainId);
246246
// ConcreteGrainWith2GenericInterfaces returns a string representation of the current value multiplied by 10:

test/DefaultCluster.Tests/MultifacetGrainTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public async Task RWReferences()
2323
{
2424
writer = this.GrainFactory.GetGrain<IMultifacetWriter>(GetRandomGrainId());
2525
reader = writer.AsReference<IMultifacetReader>();
26-
26+
2727
int x = 1234;
2828
await writer.SetValue(x).WaitAsync(timeout);
2929
int y = await reader.GetValue();
@@ -50,7 +50,7 @@ public async Task MultifacetFactory()
5050
await writer.SetValue(5);
5151
int v = await reader.GetValue();
5252
Assert.Equal(5, v);
53-
53+
5454
}
5555

5656
[Fact, TestCategory("BVT"), TestCategory("Cast")]

test/Grains/TestGrains/ProducerEventCountingGrain.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public async Task SendEvent()
5454
{
5555
throw new ApplicationException("Not yet a producer on a stream. Must call BecomeProducer first.");
5656
}
57-
57+
5858
await _producer.OnNextAsync(_numProducedItems + 1);
5959

6060
// update after send in case of error

test/Tester/EventSourcingTests/CountersGrainPerfTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using TestGrainInterfaces;
1+
using TestGrainInterfaces;
22
using Xunit;
33
using Xunit.Abstractions;
44
using Xunit.Sdk;
@@ -22,9 +22,9 @@ public partial class CountersGrainTests
2222
// what you should see is:
2323
// - the conservative approach (confirm each update, disallow reentrancy) is slow.
2424
// - confirming at end only, instead of after each update, is fast.
25-
// - allowing reentrancy, while still confirming after each update, is also fast.
25+
// - allowing reentrancy, while still confirming after each update, is also fast.
2626

27-
private readonly int iterations = 800;
27+
private const int iterations = 800;
2828

2929
[Fact, RunThisFirst, TestCategory("EventSourcing")]
3030
public Task Perf_Warmup()

0 commit comments

Comments
 (0)