From ecd50b9bbe8e9a3980ec64afdfb2320e3070390c Mon Sep 17 00:00:00 2001 From: Aaron Stannard Date: Fri, 12 Jul 2019 09:34:56 -0500 Subject: [PATCH] ShardStats and ClusterShardingStats serialization fix (#3832) * close #3830 - added serialization support for ClusterShardingStats --- .../ClusterShardingMessageSerializerSpec.cs | 11 + .../ClusterShardingMessageSerializer.cs | 118 +++- .../Proto/ClusterShardingMessages.g.cs | 560 +++++++++++++++++- .../Akka.Cluster.Sharding/ShardingMessages.cs | 76 ++- .../Proto/ClusterClientMessages.g.cs | 7 - .../Proto/DistributedPubSubMessages.g.cs | 7 - .../Serialization/Proto/ClusterMessages.g.cs | 7 - .../Serialization/Proto/Persistence.g.cs | 7 - .../Proto/TestConductorProtocol.g.cs | 7 - .../Serialization/Proto/ContainerFormats.g.cs | 7 - .../Proto/SystemMessageFormats.g.cs | 7 - .../Serialization/Proto/WireFormats.g.cs | 7 - src/protobuf/ClusterShardingMessages.proto | 20 + 13 files changed, 732 insertions(+), 109 deletions(-) diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ClusterShardingMessageSerializerSpec.cs b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ClusterShardingMessageSerializerSpec.cs index 0c113dc46bb..65dd5999224 100644 --- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ClusterShardingMessageSerializerSpec.cs +++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/ClusterShardingMessageSerializerSpec.cs @@ -5,6 +5,7 @@ // //----------------------------------------------------------------------- +using System; using System.Collections.Immutable; using Akka.Actor; using Akka.Cluster.Sharding.Serialization; @@ -122,12 +123,14 @@ public void ClusterShardingMessageSerializer_must_be_able_to_serializable_Persis public void ClusterShardingMessageSerializer_must_be_able_to_serializable_GetShardStats() { CheckSerialization(Shard.GetShardStats.Instance); + CheckSerialization(GetShardRegionStats.Instance); } [Fact] public void ClusterShardingMessageSerializer_must_be_able_to_serializable_ShardStats() { CheckSerialization(new Shard.ShardStats("a", 23)); + CheckSerialization(new ShardRegionStats(ImmutableDictionary.Empty.Add("f", 12))); } [Fact] @@ -136,5 +139,13 @@ public void ClusterShardingMessageSerializer_must_be_able_to_serialize_StartEnti CheckSerialization(new ShardRegion.StartEntity("42")); CheckSerialization(new ShardRegion.StartEntityAck("13", "37")); } + + [Fact] + public void ClusterShardingMessageSerializer_must_serialize_ClusterShardingStats() + { + CheckSerialization(new GetClusterShardingStats(TimeSpan.FromMilliseconds(500))); + CheckSerialization(new ClusterShardingStats(ImmutableDictionary.Empty.Add(new Address("akka.tcp", "foo", "localhost", 9110), + new ShardRegionStats(ImmutableDictionary.Empty.Add("f", 12))))); + } } } diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/Serialization/ClusterShardingMessageSerializer.cs b/src/contrib/cluster/Akka.Cluster.Sharding/Serialization/ClusterShardingMessageSerializer.cs index f0cdb80420a..0e7b5c85f9f 100644 --- a/src/contrib/cluster/Akka.Cluster.Sharding/Serialization/ClusterShardingMessageSerializer.cs +++ b/src/contrib/cluster/Akka.Cluster.Sharding/Serialization/ClusterShardingMessageSerializer.cs @@ -13,17 +13,22 @@ using System.Linq; using System.Runtime.Serialization; using Akka.Actor; +using Akka.Cluster.Sharding.Serialization.Proto.Msg; +using Akka.Remote.Serialization.Proto.Msg; using Akka.Serialization; using Google.Protobuf; +using Google.Protobuf.WellKnownTypes; using ActorRefMessage = Akka.Remote.Serialization.Proto.Msg.ActorRefData; namespace Akka.Cluster.Sharding.Serialization { /// - /// TBD + /// INTERNAL API: Protobuf serializer of Cluster.Sharding messages. /// public class ClusterShardingMessageSerializer : SerializerWithStringManifest { + private static readonly byte[] Empty = new byte[0]; + #region manifests private const string CoordinatorStateManifest = "AA"; @@ -56,6 +61,11 @@ public class ClusterShardingMessageSerializer : SerializerWithStringManifest private const string GetShardStatsManifest = "DA"; private const string ShardStatsManifest = "DB"; + private const string GetShardRegionStatsManifest = "DC"; + private const string ShardRegionStatsManifest = "DD"; + + private const string GetClusterShardingStatsManifest = "GS"; + private const string ClusterShardingStatsManifest = "CS"; #endregion @@ -69,9 +79,9 @@ public ClusterShardingMessageSerializer(ExtendedActorSystem system) : base(syste { _fromBinaryMap = new Dictionary> { - {EntityStateManifest, EntityStateFromBinary}, - {EntityStartedManifest, EntityStartedFromBinary}, - {EntityStoppedManifest, EntityStoppedFromBinary}, + {EntityStateManifest, bytes => EntityStateFromBinary(bytes) }, + {EntityStartedManifest, bytes => EntityStartedFromBinary(bytes) }, + {EntityStoppedManifest, bytes => EntityStoppedFromBinary(bytes) }, {CoordinatorStateManifest, CoordinatorStateFromBinary}, {ShardRegionRegisteredManifest, bytes => new PersistentShardCoordinator.ShardRegionRegistered(ActorRefMessageFromBinary(bytes)) }, @@ -85,7 +95,7 @@ public ClusterShardingMessageSerializer(ExtendedActorSystem system) : base(syste {RegisterProxyManifest, bytes => new PersistentShardCoordinator.RegisterProxy(ActorRefMessageFromBinary(bytes)) }, {RegisterAckManifest, bytes => new PersistentShardCoordinator.RegisterAck(ActorRefMessageFromBinary(bytes)) }, {GetShardHomeManifest, bytes => new PersistentShardCoordinator.GetShardHome(ShardIdMessageFromBinary(bytes)) }, - {ShardHomeManifest, ShardHomeFromBinary}, + {ShardHomeManifest, bytes => ShardHomeFromBinary(bytes) }, {HostShardManifest, bytes => new PersistentShardCoordinator.HostShard(ShardIdMessageFromBinary(bytes)) }, {ShardStartedManifest, bytes => new PersistentShardCoordinator.ShardStarted(ShardIdMessageFromBinary(bytes)) }, {BeginHandOffManifest, bytes => new PersistentShardCoordinator.BeginHandOff(ShardIdMessageFromBinary(bytes)) }, @@ -95,10 +105,14 @@ public ClusterShardingMessageSerializer(ExtendedActorSystem system) : base(syste {GracefulShutdownReqManifest, bytes => new PersistentShardCoordinator.GracefulShutdownRequest(ActorRefMessageFromBinary(bytes)) }, {GetShardStatsManifest, bytes => Shard.GetShardStats.Instance }, - {ShardStatsManifest, ShardStatsFromBinary}, - - {StartEntityManifest, StartEntityFromBinary }, - {StartEntityAckManifest, StartEntityAckFromBinary} + {ShardStatsManifest, bytes => ShardStatsFromBinary(bytes) }, + { GetShardRegionStatsManifest, bytes => GetShardRegionStats.Instance }, + { ShardRegionStatsManifest, bytes => ShardRegionStatsFromBinary(bytes) }, + { GetClusterShardingStatsManifest, bytes => GetClusterShardingStatsFromBinary(bytes) }, + { ClusterShardingStatsManifest, bytes => ClusterShardingStatsFromBinary(bytes) }, + + {StartEntityManifest, bytes => StartEntityFromBinary(bytes) }, + {StartEntityAckManifest, bytes => StartEntityAckFromBinary(bytes) } }; } @@ -138,8 +152,12 @@ public override byte[] ToBinary(object obj) case Shard.EntityStopped o: return EntityStoppedToProto(o).ToByteArray(); case ShardRegion.StartEntity o: return StartEntityToProto(o).ToByteArray(); case ShardRegion.StartEntityAck o: return StartEntityAckToProto(o).ToByteArray(); - case Shard.GetShardStats o: return new byte[0]; + case Shard.GetShardStats o: return Empty; case Shard.ShardStats o: return ShardStatsToProto(o).ToByteArray(); + case GetShardRegionStats o: return Empty; + case ShardRegionStats o: return ShardRegionStatsToProto(o).ToByteArray(); + case GetClusterShardingStats o: return GetClusterShardingStatsToProto(o).ToByteArray(); + case ClusterShardingStats o: return ClusterShardingStatsToProto(o).ToByteArray(); } throw new ArgumentException($"Can't serialize object of type [{obj.GetType()}] in [{this.GetType()}]"); } @@ -202,6 +220,10 @@ public override string Manifest(object o) case ShardRegion.StartEntityAck _: return StartEntityAckManifest; case Shard.GetShardStats _: return GetShardStatsManifest; case Shard.ShardStats _: return ShardStatsManifest; + case GetShardRegionStats _: return GetShardRegionStatsManifest; + case ShardRegionStats _: return ShardRegionStatsManifest; + case GetClusterShardingStats _: return GetClusterShardingStatsManifest; + case ClusterShardingStats _: return ClusterShardingStatsManifest; } throw new ArgumentException($"Can't serialize object of type [{o.GetType()}] in [{this.GetType()}]"); } @@ -378,14 +400,14 @@ private IActorRef ActorRefMessageFromBinary(byte[] binary) // Shard.ShardState // - private Proto.Msg.EntityState EntityStateToProto(Shard.ShardState entityState) + private static Proto.Msg.EntityState EntityStateToProto(Shard.ShardState entityState) { var message = new Proto.Msg.EntityState(); message.Entities.AddRange(entityState.Entries); return message; } - private Shard.ShardState EntityStateFromBinary(byte[] bytes) + private static Shard.ShardState EntityStateFromBinary(byte[] bytes) { var msg = Proto.Msg.EntityState.Parser.ParseFrom(bytes); return new Shard.ShardState(msg.Entities.ToImmutableHashSet()); @@ -401,7 +423,77 @@ private Proto.Msg.ShardIdMessage ShardIdMessageToProto(string shard) return message; } - private string ShardIdMessageFromBinary(byte[] bytes) + // ShardRegionStats + private static Proto.Msg.ShardRegionStats ShardRegionStatsToProto(ShardRegionStats s) + { + var message = new Proto.Msg.ShardRegionStats(); + message.Stats.Add((IDictionary)s.Stats); + return message; + } + + private static ShardRegionStats ShardRegionStatsFromBinary(byte[] b) + { + var p = Proto.Msg.ShardRegionStats.Parser.ParseFrom(b); + return new ShardRegionStats(p.Stats.ToImmutableDictionary()); + } + + // GetClusterShardingStats + private static Proto.Msg.GetClusterShardingStats GetClusterShardingStatsToProto(GetClusterShardingStats stats) + { + var p = new Proto.Msg.GetClusterShardingStats(); + p.Timeout = Duration.FromTimeSpan(stats.Timeout); + return p; + } + + private static GetClusterShardingStats GetClusterShardingStatsFromBinary(byte[] b) + { + var p = Proto.Msg.GetClusterShardingStats.Parser.ParseFrom(b); + return new GetClusterShardingStats(p.Timeout.ToTimeSpan()); + } + + // ClusterShardingStats + private static Proto.Msg.ClusterShardingStats ClusterShardingStatsToProto(ClusterShardingStats stats) + { + var p = new Proto.Msg.ClusterShardingStats(); + foreach (var s in stats.Regions) + { + p.Regions.Add(new ShardRegionWithAddress() { NodeAddress = AddressToProto(s.Key), Stats = ShardRegionStatsToProto(s.Value)}); + } + + return p; + } + + private static ClusterShardingStats ClusterShardingStatsFromBinary(byte[] b) + { + var p = Proto.Msg.ClusterShardingStats.Parser.ParseFrom(b); + var dict = new Dictionary(); + foreach (var s in p.Regions) + { + dict[AddressFrom(s.NodeAddress)] = new ShardRegionStats(s.Stats.Stats.ToImmutableDictionary()); + } + return new ClusterShardingStats(dict.ToImmutableDictionary()); + } + + private static AddressData AddressToProto(Address address) + { + var message = new AddressData(); + message.System = address.System; + message.Hostname = address.Host; + message.Port = (uint)(address.Port ?? 0); + message.Protocol = address.Protocol; + return message; + } + + private static Address AddressFrom(AddressData addressProto) + { + return new Address( + addressProto.Protocol, + addressProto.System, + addressProto.Hostname, + addressProto.Port == 0 ? null : (int?)addressProto.Port); + } + + private static string ShardIdMessageFromBinary(byte[] bytes) { return Proto.Msg.ShardIdMessage.Parser.ParseFrom(bytes).Shard; } diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/Serialization/Proto/ClusterShardingMessages.g.cs b/src/contrib/cluster/Akka.Cluster.Sharding/Serialization/Proto/ClusterShardingMessages.g.cs index 5e7d1b677bd..b8a7a8d24d7 100644 --- a/src/contrib/cluster/Akka.Cluster.Sharding/Serialization/Proto/ClusterShardingMessages.g.cs +++ b/src/contrib/cluster/Akka.Cluster.Sharding/Serialization/Proto/ClusterShardingMessages.g.cs @@ -1,10 +1,3 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2018 Lightbend Inc. -// Copyright (C) 2013-2018 .NET Foundation -// -//----------------------------------------------------------------------- - // Generated by the protocol buffer compiler. DO NOT EDIT! // source: ClusterShardingMessages.proto #pragma warning disable 1591, 0612, 3021 @@ -30,23 +23,36 @@ static ClusterShardingMessagesReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "Ch1DbHVzdGVyU2hhcmRpbmdNZXNzYWdlcy5wcm90bxItQWtrYS5DbHVzdGVy", - "LlNoYXJkaW5nLlNlcmlhbGl6YXRpb24uUHJvdG8uTXNnIuMBChBDb29yZGlu", - "YXRvclN0YXRlEloKBnNoYXJkcxgBIAMoCzJKLkFra2EuQ2x1c3Rlci5TaGFy", - "ZGluZy5TZXJpYWxpemF0aW9uLlByb3RvLk1zZy5Db29yZGluYXRvclN0YXRl", - "LlNoYXJkRW50cnkSDwoHcmVnaW9ucxgCIAMoCRIVCg1yZWdpb25Qcm94aWVz", - "GAMgAygJEhkKEXVuYWxsb2NhdGVkU2hhcmRzGAQgAygJGjAKClNoYXJkRW50", - "cnkSDwoHc2hhcmRJZBgBIAEoCRIRCglyZWdpb25SZWYYAiABKAkiHgoPQWN0", - "b3JSZWZNZXNzYWdlEgsKA3JlZhgBIAEoCSIfCg5TaGFyZElkTWVzc2FnZRIN", - "CgVzaGFyZBgBIAEoCSIzChJTaGFyZEhvbWVBbGxvY2F0ZWQSDQoFc2hhcmQY", - "ASABKAkSDgoGcmVnaW9uGAIgASgJIioKCVNoYXJkSG9tZRINCgVzaGFyZBgB", - "IAEoCRIOCgZyZWdpb24YAiABKAkiHwoLRW50aXR5U3RhdGUSEAoIZW50aXRp", - "ZXMYASADKAkiIQoNRW50aXR5U3RhcnRlZBIQCghlbnRpdHlJZBgBIAEoCSIh", - "Cg1FbnRpdHlTdG9wcGVkEhAKCGVudGl0eUlkGAEgASgJIjAKClNoYXJkU3Rh", - "dHMSDQoFc2hhcmQYASABKAkSEwoLZW50aXR5Q291bnQYAiABKAUiHwoLU3Rh", - "cnRFbnRpdHkSEAoIZW50aXR5SWQYASABKAkiMwoOU3RhcnRFbnRpdHlBY2sS", - "EAoIZW50aXR5SWQYASABKAkSDwoHc2hhcmRJZBgCIAEoCWIGcHJvdG8z")); + "LlNoYXJkaW5nLlNlcmlhbGl6YXRpb24uUHJvdG8uTXNnGg5kdXJhdGlvbi5w", + "cm90bxoWQ29udGFpbmVyRm9ybWF0cy5wcm90byLjAQoQQ29vcmRpbmF0b3JT", + "dGF0ZRJaCgZzaGFyZHMYASADKAsySi5Ba2thLkNsdXN0ZXIuU2hhcmRpbmcu", + "U2VyaWFsaXphdGlvbi5Qcm90by5Nc2cuQ29vcmRpbmF0b3JTdGF0ZS5TaGFy", + "ZEVudHJ5Eg8KB3JlZ2lvbnMYAiADKAkSFQoNcmVnaW9uUHJveGllcxgDIAMo", + "CRIZChF1bmFsbG9jYXRlZFNoYXJkcxgEIAMoCRowCgpTaGFyZEVudHJ5Eg8K", + "B3NoYXJkSWQYASABKAkSEQoJcmVnaW9uUmVmGAIgASgJIh4KD0FjdG9yUmVm", + "TWVzc2FnZRILCgNyZWYYASABKAkiHwoOU2hhcmRJZE1lc3NhZ2USDQoFc2hh", + "cmQYASABKAkiMwoSU2hhcmRIb21lQWxsb2NhdGVkEg0KBXNoYXJkGAEgASgJ", + "Eg4KBnJlZ2lvbhgCIAEoCSIqCglTaGFyZEhvbWUSDQoFc2hhcmQYASABKAkS", + "DgoGcmVnaW9uGAIgASgJIh8KC0VudGl0eVN0YXRlEhAKCGVudGl0aWVzGAEg", + "AygJIiEKDUVudGl0eVN0YXJ0ZWQSEAoIZW50aXR5SWQYASABKAkiIQoNRW50", + "aXR5U3RvcHBlZBIQCghlbnRpdHlJZBgBIAEoCSIwCgpTaGFyZFN0YXRzEg0K", + "BXNoYXJkGAEgASgJEhMKC2VudGl0eUNvdW50GAIgASgFIpsBChBTaGFyZFJl", + "Z2lvblN0YXRzElkKBXN0YXRzGAEgAygLMkouQWtrYS5DbHVzdGVyLlNoYXJk", + "aW5nLlNlcmlhbGl6YXRpb24uUHJvdG8uTXNnLlNoYXJkUmVnaW9uU3RhdHMu", + "U3RhdHNFbnRyeRosCgpTdGF0c0VudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1", + "ZRgCIAEoBToCOAEiHwoLU3RhcnRFbnRpdHkSEAoIZW50aXR5SWQYASABKAki", + "MwoOU3RhcnRFbnRpdHlBY2sSEAoIZW50aXR5SWQYASABKAkSDwoHc2hhcmRJ", + "ZBgCIAEoCSJFChdHZXRDbHVzdGVyU2hhcmRpbmdTdGF0cxIqCgd0aW1lb3V0", + "GAEgASgLMhkuZ29vZ2xlLnByb3RvYnVmLkR1cmF0aW9uIm4KFENsdXN0ZXJT", + "aGFyZGluZ1N0YXRzElYKB3JlZ2lvbnMYASADKAsyRS5Ba2thLkNsdXN0ZXIu", + "U2hhcmRpbmcuU2VyaWFsaXphdGlvbi5Qcm90by5Nc2cuU2hhcmRSZWdpb25X", + "aXRoQWRkcmVzcyKvAQoWU2hhcmRSZWdpb25XaXRoQWRkcmVzcxJFCgtub2Rl", + "QWRkcmVzcxgBIAEoCzIwLkFra2EuUmVtb3RlLlNlcmlhbGl6YXRpb24uUHJv", + "dG8uTXNnLkFkZHJlc3NEYXRhEk4KBXN0YXRzGAIgASgLMj8uQWtrYS5DbHVz", + "dGVyLlNoYXJkaW5nLlNlcmlhbGl6YXRpb24uUHJvdG8uTXNnLlNoYXJkUmVn", + "aW9uU3RhdHNiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, + new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor, global::Akka.Remote.Serialization.Proto.Msg.ContainerFormatsReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Akka.Cluster.Sharding.Serialization.Proto.Msg.CoordinatorState), global::Akka.Cluster.Sharding.Serialization.Proto.Msg.CoordinatorState.Parser, new[]{ "Shards", "Regions", "RegionProxies", "UnallocatedShards" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Akka.Cluster.Sharding.Serialization.Proto.Msg.CoordinatorState.Types.ShardEntry), global::Akka.Cluster.Sharding.Serialization.Proto.Msg.CoordinatorState.Types.ShardEntry.Parser, new[]{ "ShardId", "RegionRef" }, null, null, null)}), new pbr::GeneratedClrTypeInfo(typeof(global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ActorRefMessage), global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ActorRefMessage.Parser, new[]{ "Ref" }, null, null, null), @@ -57,8 +63,12 @@ static ClusterShardingMessagesReflection() { new pbr::GeneratedClrTypeInfo(typeof(global::Akka.Cluster.Sharding.Serialization.Proto.Msg.EntityStarted), global::Akka.Cluster.Sharding.Serialization.Proto.Msg.EntityStarted.Parser, new[]{ "EntityId" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Akka.Cluster.Sharding.Serialization.Proto.Msg.EntityStopped), global::Akka.Cluster.Sharding.Serialization.Proto.Msg.EntityStopped.Parser, new[]{ "EntityId" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ShardStats), global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ShardStats.Parser, new[]{ "Shard", "EntityCount" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ShardRegionStats), global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ShardRegionStats.Parser, new[]{ "Stats" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), new pbr::GeneratedClrTypeInfo(typeof(global::Akka.Cluster.Sharding.Serialization.Proto.Msg.StartEntity), global::Akka.Cluster.Sharding.Serialization.Proto.Msg.StartEntity.Parser, new[]{ "EntityId" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Akka.Cluster.Sharding.Serialization.Proto.Msg.StartEntityAck), global::Akka.Cluster.Sharding.Serialization.Proto.Msg.StartEntityAck.Parser, new[]{ "EntityId", "ShardId" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Akka.Cluster.Sharding.Serialization.Proto.Msg.StartEntityAck), global::Akka.Cluster.Sharding.Serialization.Proto.Msg.StartEntityAck.Parser, new[]{ "EntityId", "ShardId" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Akka.Cluster.Sharding.Serialization.Proto.Msg.GetClusterShardingStats), global::Akka.Cluster.Sharding.Serialization.Proto.Msg.GetClusterShardingStats.Parser, new[]{ "Timeout" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ClusterShardingStats), global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ClusterShardingStats.Parser, new[]{ "Regions" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ShardRegionWithAddress), global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ShardRegionWithAddress.Parser, new[]{ "NodeAddress", "Stats" }, null, null, null) })); } #endregion @@ -1398,6 +1408,115 @@ public void MergeFrom(pb::CodedInputStream input) { } + internal sealed partial class ShardRegionStats : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ShardRegionStats()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ClusterShardingMessagesReflection.Descriptor.MessageTypes[9]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ShardRegionStats() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ShardRegionStats(ShardRegionStats other) : this() { + stats_ = other.stats_.Clone(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ShardRegionStats Clone() { + return new ShardRegionStats(this); + } + + /// Field number for the "stats" field. + public const int StatsFieldNumber = 1; + private static readonly pbc::MapField.Codec _map_stats_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForInt32(16), 10); + private readonly pbc::MapField stats_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Stats { + get { return stats_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ShardRegionStats); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ShardRegionStats other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!Stats.Equals(other.Stats)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= Stats.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + stats_.WriteTo(output, _map_stats_codec); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += stats_.CalculateSize(_map_stats_codec); + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ShardRegionStats other) { + if (other == null) { + return; + } + stats_.Add(other.stats_); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + stats_.AddEntriesFrom(input, _map_stats_codec); + break; + } + } + } + } + + } + internal sealed partial class StartEntity : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StartEntity()); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1405,7 +1524,7 @@ internal sealed partial class StartEntity : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ClusterShardingMessagesReflection.Descriptor.MessageTypes[9]; } + get { return global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ClusterShardingMessagesReflection.Descriptor.MessageTypes[10]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1522,7 +1641,7 @@ internal sealed partial class StartEntityAck : pb::IMessage { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ClusterShardingMessagesReflection.Descriptor.MessageTypes[10]; } + get { return global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ClusterShardingMessagesReflection.Descriptor.MessageTypes[11]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1660,6 +1779,395 @@ public void MergeFrom(pb::CodedInputStream input) { } + internal sealed partial class GetClusterShardingStats : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetClusterShardingStats()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ClusterShardingMessagesReflection.Descriptor.MessageTypes[12]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetClusterShardingStats() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetClusterShardingStats(GetClusterShardingStats other) : this() { + Timeout = other.timeout_ != null ? other.Timeout.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetClusterShardingStats Clone() { + return new GetClusterShardingStats(this); + } + + /// Field number for the "timeout" field. + public const int TimeoutFieldNumber = 1; + private global::Google.Protobuf.WellKnownTypes.Duration timeout_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Duration Timeout { + get { return timeout_; } + set { + timeout_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as GetClusterShardingStats); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(GetClusterShardingStats other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Timeout, other.Timeout)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (timeout_ != null) hash ^= Timeout.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (timeout_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Timeout); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (timeout_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Timeout); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(GetClusterShardingStats other) { + if (other == null) { + return; + } + if (other.timeout_ != null) { + if (timeout_ == null) { + timeout_ = new global::Google.Protobuf.WellKnownTypes.Duration(); + } + Timeout.MergeFrom(other.Timeout); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + if (timeout_ == null) { + timeout_ = new global::Google.Protobuf.WellKnownTypes.Duration(); + } + input.ReadMessage(timeout_); + break; + } + } + } + } + + } + + internal sealed partial class ClusterShardingStats : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ClusterShardingStats()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ClusterShardingMessagesReflection.Descriptor.MessageTypes[13]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ClusterShardingStats() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ClusterShardingStats(ClusterShardingStats other) : this() { + regions_ = other.regions_.Clone(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ClusterShardingStats Clone() { + return new ClusterShardingStats(this); + } + + /// Field number for the "regions" field. + public const int RegionsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_regions_codec + = pb::FieldCodec.ForMessage(10, global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ShardRegionWithAddress.Parser); + private readonly pbc::RepeatedField regions_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Regions { + get { return regions_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ClusterShardingStats); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ClusterShardingStats other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!regions_.Equals(other.regions_)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= regions_.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + regions_.WriteTo(output, _repeated_regions_codec); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += regions_.CalculateSize(_repeated_regions_codec); + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ClusterShardingStats other) { + if (other == null) { + return; + } + regions_.Add(other.regions_); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + regions_.AddEntriesFrom(input, _repeated_regions_codec); + break; + } + } + } + } + + } + + internal sealed partial class ShardRegionWithAddress : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ShardRegionWithAddress()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ClusterShardingMessagesReflection.Descriptor.MessageTypes[14]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ShardRegionWithAddress() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ShardRegionWithAddress(ShardRegionWithAddress other) : this() { + NodeAddress = other.nodeAddress_ != null ? other.NodeAddress.Clone() : null; + Stats = other.stats_ != null ? other.Stats.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ShardRegionWithAddress Clone() { + return new ShardRegionWithAddress(this); + } + + /// Field number for the "nodeAddress" field. + public const int NodeAddressFieldNumber = 1; + private global::Akka.Remote.Serialization.Proto.Msg.AddressData nodeAddress_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Akka.Remote.Serialization.Proto.Msg.AddressData NodeAddress { + get { return nodeAddress_; } + set { + nodeAddress_ = value; + } + } + + /// Field number for the "stats" field. + public const int StatsFieldNumber = 2; + private global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ShardRegionStats stats_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ShardRegionStats Stats { + get { return stats_; } + set { + stats_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ShardRegionWithAddress); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ShardRegionWithAddress other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(NodeAddress, other.NodeAddress)) return false; + if (!object.Equals(Stats, other.Stats)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (nodeAddress_ != null) hash ^= NodeAddress.GetHashCode(); + if (stats_ != null) hash ^= Stats.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (nodeAddress_ != null) { + output.WriteRawTag(10); + output.WriteMessage(NodeAddress); + } + if (stats_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Stats); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (nodeAddress_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(NodeAddress); + } + if (stats_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Stats); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ShardRegionWithAddress other) { + if (other == null) { + return; + } + if (other.nodeAddress_ != null) { + if (nodeAddress_ == null) { + nodeAddress_ = new global::Akka.Remote.Serialization.Proto.Msg.AddressData(); + } + NodeAddress.MergeFrom(other.NodeAddress); + } + if (other.stats_ != null) { + if (stats_ == null) { + stats_ = new global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ShardRegionStats(); + } + Stats.MergeFrom(other.Stats); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + if (nodeAddress_ == null) { + nodeAddress_ = new global::Akka.Remote.Serialization.Proto.Msg.AddressData(); + } + input.ReadMessage(nodeAddress_); + break; + } + case 18: { + if (stats_ == null) { + stats_ = new global::Akka.Cluster.Sharding.Serialization.Proto.Msg.ShardRegionStats(); + } + input.ReadMessage(stats_); + break; + } + } + } + } + + } + #endregion } diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/ShardingMessages.cs b/src/contrib/cluster/Akka.Cluster.Sharding/ShardingMessages.cs index dc9d4bb02ce..6edb4db4edb 100644 --- a/src/contrib/cluster/Akka.Cluster.Sharding/ShardingMessages.cs +++ b/src/contrib/cluster/Akka.Cluster.Sharding/ShardingMessages.cs @@ -9,6 +9,7 @@ using System.Collections.Generic; using Akka.Actor; using System.Collections.Immutable; +using System.Linq; namespace Akka.Cluster.Sharding { @@ -141,42 +142,73 @@ public CurrentRegions(IImmutableSet
regions) /// the state of the shard regions. /// [Serializable] - public sealed class GetClusterShardingStats : IShardRegionQuery + public sealed class GetClusterShardingStats : IShardRegionQuery, IClusterShardingSerializable, IEquatable { /// - /// TBD + /// The timeout for this operation. /// public readonly TimeSpan Timeout; /// - /// TBD + /// Creates a new GetClusterShardingStats message instance. /// - /// TBD + /// The amount of time to allow this operation to run. public GetClusterShardingStats(TimeSpan timeout) { Timeout = timeout; } + + public bool Equals(GetClusterShardingStats other) + { + return other != null && Timeout.Equals(other.Timeout); + } + + public override bool Equals(object obj) + { + return ReferenceEquals(this, obj) || obj is GetClusterShardingStats other && Equals(other); + } + + public override int GetHashCode() + { + return Timeout.GetHashCode(); + } } /// /// Reply to , contains statistics about all the sharding regions in the cluster. /// [Serializable] - public sealed class ClusterShardingStats + public sealed class ClusterShardingStats : IClusterShardingSerializable, IEquatable { /// - /// TBD + /// All of the statistics for a specific shard region organized per-node. /// public readonly IImmutableDictionary Regions; /// - /// TBD + /// Creates a new ClusterShardingStats message. /// - /// TBD + /// The set of sharding statistics per-node. public ClusterShardingStats(IImmutableDictionary regions) { Regions = regions; } + + public bool Equals(ClusterShardingStats other) + { + return other != null && (Regions.Keys.SequenceEqual(other.Regions.Keys) && + Regions.Values.SequenceEqual(other.Regions.Values)); + } + + public override bool Equals(object obj) + { + return ReferenceEquals(this, obj) || obj is ClusterShardingStats other && Equals(other); + } + + public override int GetHashCode() + { + return Regions.GetHashCode(); + } } /// @@ -189,7 +221,7 @@ public ClusterShardingStats(IImmutableDictionary regi /// For the statistics for the entire cluster, see . /// [Serializable] - public sealed class GetShardRegionStats : IShardRegionQuery + public sealed class GetShardRegionStats : IShardRegionQuery, IClusterShardingSerializable { /// /// TBD @@ -242,24 +274,40 @@ public CurrentShardRegionState(IImmutableSet shards) } /// - /// TBD + /// Entity allocation statistics for a specific shard region. /// [Serializable] - public sealed class ShardRegionStats + public sealed class ShardRegionStats : IClusterShardingSerializable, IEquatable { /// - /// TBD + /// The set of shardId / entity count pairs /// public readonly IImmutableDictionary Stats; /// - /// TBD + /// Creates a new ShardRegionStats instance. /// - /// TBD + /// The set of shardId / entity count pairs public ShardRegionStats(IImmutableDictionary stats) { Stats = stats; } + + public bool Equals(ShardRegionStats other) + { + return other != null && (Stats.Keys.SequenceEqual(other.Stats.Keys) + && Stats.Values.SequenceEqual(other.Stats.Values)); + } + + public override bool Equals(object obj) + { + return ReferenceEquals(this, obj) || obj is ShardRegionStats other && Equals(other); + } + + public override int GetHashCode() + { + return (Stats != null ? Stats.GetHashCode() : 0); + } } /// diff --git a/src/contrib/cluster/Akka.Cluster.Tools/Client/Serialization/Proto/ClusterClientMessages.g.cs b/src/contrib/cluster/Akka.Cluster.Tools/Client/Serialization/Proto/ClusterClientMessages.g.cs index 748316389cf..890e7fa9009 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools/Client/Serialization/Proto/ClusterClientMessages.g.cs +++ b/src/contrib/cluster/Akka.Cluster.Tools/Client/Serialization/Proto/ClusterClientMessages.g.cs @@ -1,10 +1,3 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2018 Lightbend Inc. -// Copyright (C) 2013-2018 .NET Foundation -// -//----------------------------------------------------------------------- - // Generated by the protocol buffer compiler. DO NOT EDIT! // source: ClusterClientMessages.proto #pragma warning disable 1591, 0612, 3021 diff --git a/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/Serialization/Proto/DistributedPubSubMessages.g.cs b/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/Serialization/Proto/DistributedPubSubMessages.g.cs index 5f8d1748fdb..033c7a1a689 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/Serialization/Proto/DistributedPubSubMessages.g.cs +++ b/src/contrib/cluster/Akka.Cluster.Tools/PublishSubscribe/Serialization/Proto/DistributedPubSubMessages.g.cs @@ -1,10 +1,3 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2018 Lightbend Inc. -// Copyright (C) 2013-2018 .NET Foundation -// -//----------------------------------------------------------------------- - // Generated by the protocol buffer compiler. DO NOT EDIT! // source: DistributedPubSubMessages.proto #pragma warning disable 1591, 0612, 3021 diff --git a/src/core/Akka.Cluster/Serialization/Proto/ClusterMessages.g.cs b/src/core/Akka.Cluster/Serialization/Proto/ClusterMessages.g.cs index 6557a891afc..693fc96e951 100644 --- a/src/core/Akka.Cluster/Serialization/Proto/ClusterMessages.g.cs +++ b/src/core/Akka.Cluster/Serialization/Proto/ClusterMessages.g.cs @@ -1,10 +1,3 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2018 Lightbend Inc. -// Copyright (C) 2013-2018 .NET Foundation -// -//----------------------------------------------------------------------- - // Generated by the protocol buffer compiler. DO NOT EDIT! // source: ClusterMessages.proto #pragma warning disable 1591, 0612, 3021 diff --git a/src/core/Akka.Persistence/Serialization/Proto/Persistence.g.cs b/src/core/Akka.Persistence/Serialization/Proto/Persistence.g.cs index 43781a06388..80d1087168b 100644 --- a/src/core/Akka.Persistence/Serialization/Proto/Persistence.g.cs +++ b/src/core/Akka.Persistence/Serialization/Proto/Persistence.g.cs @@ -1,10 +1,3 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2018 Lightbend Inc. -// Copyright (C) 2013-2018 .NET Foundation -// -//----------------------------------------------------------------------- - // Generated by the protocol buffer compiler. DO NOT EDIT! // source: Persistence.proto #pragma warning disable 1591, 0612, 3021 diff --git a/src/core/Akka.Remote.TestKit/Proto/TestConductorProtocol.g.cs b/src/core/Akka.Remote.TestKit/Proto/TestConductorProtocol.g.cs index baf3e3a16a6..384afe88874 100644 --- a/src/core/Akka.Remote.TestKit/Proto/TestConductorProtocol.g.cs +++ b/src/core/Akka.Remote.TestKit/Proto/TestConductorProtocol.g.cs @@ -1,10 +1,3 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2018 Lightbend Inc. -// Copyright (C) 2013-2018 .NET Foundation -// -//----------------------------------------------------------------------- - // Generated by the protocol buffer compiler. DO NOT EDIT! // source: TestConductorProtocol.proto #pragma warning disable 1591, 0612, 3021 diff --git a/src/core/Akka.Remote/Serialization/Proto/ContainerFormats.g.cs b/src/core/Akka.Remote/Serialization/Proto/ContainerFormats.g.cs index 025a71f1a99..54870fe038a 100644 --- a/src/core/Akka.Remote/Serialization/Proto/ContainerFormats.g.cs +++ b/src/core/Akka.Remote/Serialization/Proto/ContainerFormats.g.cs @@ -1,10 +1,3 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2018 Lightbend Inc. -// Copyright (C) 2013-2018 .NET Foundation -// -//----------------------------------------------------------------------- - // Generated by the protocol buffer compiler. DO NOT EDIT! // source: ContainerFormats.proto #pragma warning disable 1591, 0612, 3021 diff --git a/src/core/Akka.Remote/Serialization/Proto/SystemMessageFormats.g.cs b/src/core/Akka.Remote/Serialization/Proto/SystemMessageFormats.g.cs index 6c048e53340..3296a5c2666 100644 --- a/src/core/Akka.Remote/Serialization/Proto/SystemMessageFormats.g.cs +++ b/src/core/Akka.Remote/Serialization/Proto/SystemMessageFormats.g.cs @@ -1,10 +1,3 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2018 Lightbend Inc. -// Copyright (C) 2013-2018 .NET Foundation -// -//----------------------------------------------------------------------- - // Generated by the protocol buffer compiler. DO NOT EDIT! // source: SystemMessageFormats.proto #pragma warning disable 1591, 0612, 3021 diff --git a/src/core/Akka.Remote/Serialization/Proto/WireFormats.g.cs b/src/core/Akka.Remote/Serialization/Proto/WireFormats.g.cs index 23ee1748fcd..e2dedaae083 100644 --- a/src/core/Akka.Remote/Serialization/Proto/WireFormats.g.cs +++ b/src/core/Akka.Remote/Serialization/Proto/WireFormats.g.cs @@ -1,10 +1,3 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2018 Lightbend Inc. -// Copyright (C) 2013-2018 .NET Foundation -// -//----------------------------------------------------------------------- - // Generated by the protocol buffer compiler. DO NOT EDIT! // source: WireFormats.proto #pragma warning disable 1591, 0612, 3021 diff --git a/src/protobuf/ClusterShardingMessages.proto b/src/protobuf/ClusterShardingMessages.proto index b373f2dade9..83cf72dda40 100644 --- a/src/protobuf/ClusterShardingMessages.proto +++ b/src/protobuf/ClusterShardingMessages.proto @@ -5,6 +5,9 @@ syntax = "proto3"; package Akka.Cluster.Sharding.Serialization.Proto.Msg; +import 'duration.proto'; +import "ContainerFormats.proto"; + message CoordinatorState { message ShardEntry { string shardId = 1; @@ -52,6 +55,10 @@ message ShardStats { int32 entityCount = 2; } +message ShardRegionStats { + map stats = 1; +} + message StartEntity { string entityId = 1; } @@ -60,3 +67,16 @@ message StartEntityAck { string entityId = 1; string shardId = 2; } + +message GetClusterShardingStats{ + google.protobuf.Duration timeout = 1; +} + +message ClusterShardingStats{ + repeated ShardRegionWithAddress regions = 1; +} + +message ShardRegionWithAddress{ + Akka.Remote.Serialization.Proto.Msg.AddressData nodeAddress = 1; + ShardRegionStats stats = 2; +} \ No newline at end of file