Skip to content

Commit

Permalink
WIP nullability
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaronontheweb committed Jul 24, 2024
1 parent 4fbf6a9 commit 74e7e68
Showing 1 changed file with 12 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Copyright (C) 2013-2023 .NET Foundation <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------

#nullable enable
using System;
using System.Collections.Immutable;
using System.Linq;
Expand All @@ -17,7 +17,6 @@
using Akka.Event;
using Akka.Remote;
using Akka.Util.Internal;
using DotNetty.Handlers.Logging;
using static Akka.Cluster.ClusterEvent;

namespace Akka.Cluster.Tools.Singleton
Expand Down Expand Up @@ -73,7 +72,6 @@ private HandOverDone() { }
}

/// <summary>
/// TBD
/// Sent from from previous oldest to new oldest to
/// initiate the normal hand-over process.
/// Especially useful when new node joins and becomes
Expand All @@ -83,59 +81,36 @@ private HandOverDone() { }
[Serializable]
internal sealed class TakeOverFromMe : IClusterSingletonMessage, IDeadLetterSuppression
{
/// <summary>
/// TBD
/// </summary>
public static TakeOverFromMe Instance { get; } = new();
private TakeOverFromMe() { }
}

/// <summary>
/// TBD
/// Scheduled task to cleanup overdue members that have been removed
/// </summary>
[Serializable]
internal sealed class Cleanup
{
/// <summary>
/// TBD
/// </summary>
public static Cleanup Instance { get; } = new();
private Cleanup() { }
}

/// <summary>
/// TBD
/// Initialize the oldest changed buffer actor.
/// </summary>
[Serializable]
internal sealed class StartOldestChangedBuffer
{
/// <summary>
/// TBD
/// </summary>
public static StartOldestChangedBuffer Instance { get; } = new();
private StartOldestChangedBuffer() { }
}

/// <summary>
/// TBD
/// Retry a failed cluster singleton handover.
/// </summary>
/// <param name="Count">The number of retries</param>
[Serializable]
internal sealed class HandOverRetry
{
/// <summary>
/// TBD
/// </summary>
public int Count { get; }

/// <summary>
/// TBD
/// </summary>
/// <param name="count">TBD</param>
public HandOverRetry(int count)
{
Count = count;
}
}
internal sealed record HandOverRetry(int Count);

/// <summary>
/// TBD
Expand Down Expand Up @@ -211,20 +186,16 @@ public YoungerData(ImmutableList<UniqueAddress> oldest)
}

/// <summary>
/// TBD
/// State when we're transitioning to becoming the oldest singleton manager.
/// </summary>
[Serializable]
internal sealed class BecomingOldestData : IClusterSingletonData
{
/// <summary>
/// TBD
/// The previous oldest nodes - can be empty
/// </summary>
public ImmutableList<UniqueAddress> PreviousOldest { get; }

/// <summary>
/// TBD
/// </summary>
/// <param name="previousOldest">TBD</param>

public BecomingOldestData(ImmutableList<UniqueAddress> previousOldest)
{
PreviousOldest = previousOldest;
Expand Down Expand Up @@ -253,7 +224,7 @@ public OldestData(IActorRef singleton)
}

/// <summary>
/// TBD
/// State we're transitioning into once we know we've started the hand-over process.
/// </summary>
[Serializable]
internal sealed class WasOldestData : IClusterSingletonData
Expand Down Expand Up @@ -830,7 +801,7 @@ private State<ClusterSingletonState, IClusterSingletonData> HandleOldestChanged(
}
}

private State<ClusterSingletonState, IClusterSingletonData> HandleHandOverDone(IActorRef handOverTo)
private State<ClusterSingletonState, IClusterSingletonData> HandleHandOverDone(IActorRef? handOverTo)
{
var newOldest = handOverTo?.Path.Address;
Log.Info("Singleton terminated, hand-over done [{0} -> {1}]", _cluster.SelfAddress, newOldest);
Expand All @@ -851,7 +822,7 @@ private State<ClusterSingletonState, IClusterSingletonData> HandleHandOverDone(I
}
}

private State<ClusterSingletonState, IClusterSingletonData> GoToHandingOver(IActorRef singleton, IActorRef handOverTo)
private State<ClusterSingletonState, IClusterSingletonData> GoToHandingOver(IActorRef? singleton, IActorRef? handOverTo)
{
if (singleton == null)
{
Expand Down

0 comments on commit 74e7e68

Please sign in to comment.