Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More system actors and more consistent system actor naming #1649

Merged
merged 5 commits into from
Jun 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Proto.Cluster.Kubernetes/KubernetesProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private void StartClusterMonitor()
.FromProducer(() => new KubernetesClusterMonitor(_cluster, _config))
.WithGuardianSupervisorStrategy(Supervision.AlwaysRestartStrategy);

_clusterMonitor = _cluster.System.Root.SpawnNamed(props, "kubernetes-cluster-monitor");
_clusterMonitor = _cluster.System.Root.SpawnNamedSystem(props, "$kubernetes-cluster-monitor");
_podName = KubernetesExtensions.GetPodName();

_cluster.System.Root.Send(
Expand Down
2 changes: 1 addition & 1 deletion src/Proto.Cluster/Gossip/Gossiper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public record GetGossipStateSnapshot;
[PublicAPI]
public class Gossiper
{
public const string GossipActorName = "gossip";
public const string GossipActorName = "$gossip";

private static readonly ILogger Logger = Log.CreateLogger<Gossiper>();
private readonly Cluster _cluster;
Expand Down
5 changes: 3 additions & 2 deletions src/Proto.Cluster/Identity/IdentityStorageLookup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ namespace Proto.Cluster.Identity;

public class IdentityStorageLookup : IIdentityLookup
{
private const string PlacementActorName = "placement-activator";
private const string WorkerActorName = "$identity-storage-worker";
private const string PlacementActorName = "$placement-activator";
private bool _isClient;
private string _memberId = string.Empty;
private PID _placementActor = null!;
Expand Down Expand Up @@ -36,7 +37,7 @@ public async Task SetupAsync(Cluster cluster, string[] kinds, bool isClient)
await Storage.Init();

var workerProps = Props.FromProducer(() => new IdentityStorageWorker(this));
_worker = _system.Root.Spawn(workerProps);
_worker = _system.Root.SpawnNamedSystem(workerProps, WorkerActorName);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about whether this should be a system actor. As far as I understand this worker lives alongside the IdentityStorageLookup and stops when that is stopped hence in that case it makes sense for me that this is spawn as a system actor.


//hook up events
cluster.System.EventStream.Subscribe<ClusterTopology>(e => {
Expand Down
4 changes: 2 additions & 2 deletions src/Proto.Cluster/Partition/PartitionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace Proto.Cluster.Partition;
//helper to interact with partition actors on this and other members
class PartitionManager
{
private const string PartitionIdentityActorName = "partition-identity";
private const string PartitionPlacementActorName = "partition-activator";
private const string PartitionIdentityActorName = "$partition-identity";
private const string PartitionPlacementActorName = "$partition-activator";
private readonly Cluster _cluster;
private readonly RootContext _context;
private readonly bool _isClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Proto.Cluster.PartitionActivator;
//helper to interact with partition actors on this and other members
public class PartitionActivatorManager
{
private const string PartitionActivatorActorName = "partition-activator";
private const string PartitionActivatorActorName = "$partition-activator";
private readonly Cluster _cluster;


Expand Down
2 changes: 1 addition & 1 deletion src/Proto.Cluster/Seed/SeedClientNodeActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Proto.Cluster.Seed;

public class SeedClientNodeActor : IActor
{
public const string Name = "client_seed";
public const string Name = "$client_seed";
public static Props Props(SeedNodeClusterProviderOptions options) => Proto.Props.FromProducer(() => new SeedClientNodeActor(options));
private static readonly ILogger Logger = Log.CreateLogger<SeedClientNodeActor>();
private ImmutableDictionary<string, Member> _members = ImmutableDictionary<string, Member>.Empty;
Expand Down
2 changes: 1 addition & 1 deletion src/Proto.Cluster/Seed/SeedNodeActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Proto.Cluster.Seed;

public class SeedNodeActor : IActor
{
public const string Name = "server_seed";
public const string Name = "$server_seed";
private static readonly ILogger Logger = Log.CreateLogger<SeedNodeActor>();
private ImmutableDictionary<string, Member> _members = ImmutableDictionary<string, Member>.Empty;
private ImmutableList<PID> _clients = ImmutableList<PID>.Empty;
Expand Down
4 changes: 3 additions & 1 deletion src/Proto.Remote/Endpoints/EndpointManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ namespace Proto.Remote;

public class EndpointManager
{
public const string ActivatorActorName = "$activator";

private static readonly ILogger Logger = Log.CreateLogger<EndpointManager>();
private readonly CancellationTokenSource _cancellationTokenSource = new();
private readonly IChannelProvider _channelProvider;
Expand Down Expand Up @@ -196,7 +198,7 @@ internal IEndpoint GetClientEndpoint(string systemId)
private void SpawnActivator()
{
var props = Props.FromProducer(() => new Activator(_remoteConfig, _system));
ActivatorPid = _system.Root.SpawnNamedSystem(props, "activator");
ActivatorPid = _system.Root.SpawnNamedSystem(props, ActivatorActorName);
}
private void StopActivator() => _system.Root.Stop(ActivatorPid);
}
2 changes: 1 addition & 1 deletion src/Proto.Remote/IRemoteExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ public static async Task<ActorPidResponse> SpawnNamedAsync(this IRemote remote,

return res;

static PID ActivatorForAddress(string address) => PID.FromAddress(address, "activator");
static PID ActivatorForAddress(string address) => PID.FromAddress(address, EndpointManager.ActivatorActorName);
}
}