He-Pin commented on code in PR #3270:
URL: https://github.com/apache/pekko/pull/3270#discussion_r3530749342


##########
cluster-sharding/src/main/mima-filters/2.0.x.backwards.excludes/consistent-hashing-allocation.excludes:
##########
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Internal classes affected by refactor related to Collocating shards with 
consistent hashing
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.cluster.sharding.internal.AbstractLeastShardAllocationStrategy$")
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.cluster.sharding.internal.AbstractLeastShardAllocationStrategy$RegionEntry")
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.cluster.sharding.internal.AbstractLeastShardAllocationStrategy$RegionEntry$")

Review Comment:
   Nit: "Collocating" → "Colocating" — matches the spelling used in the docs 
added by this PR ("Colocate Shards", "Colocate processes").



##########
cluster-sharding-typed/src/test/java/jdocs/org/apache/pekko/cluster/sharding/typed/ConsistentHashingShardAllocationCompileOnlyTest.java:
##########
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * license agreements; and to You under the Apache License, version 2.0:
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * This file is part of the Apache Pekko project, which was derived from Akka.
+ */
+
+/*
+ * Copyright (C) 2023 Lightbend Inc. <https://www.lightbend.com>
+ */
+
+package jdocs.org.apache.pekko.cluster.sharding.typed;
+
+import org.apache.pekko.actor.typed.ActorSystem;
+import org.apache.pekko.actor.typed.Behavior;
+import org.apache.pekko.actor.typed.javadsl.AbstractBehavior;
+import org.apache.pekko.actor.typed.javadsl.ActorContext;
+import org.apache.pekko.actor.typed.javadsl.Behaviors;
+import org.apache.pekko.actor.typed.javadsl.Receive;
+import 
org.apache.pekko.cluster.sharding.ConsistentHashingShardAllocationStrategy;
+import org.apache.pekko.cluster.sharding.typed.ShardingEnvelope;
+import org.apache.pekko.cluster.sharding.typed.ShardingMessageExtractor;
+import org.apache.pekko.cluster.sharding.typed.javadsl.ClusterSharding;
+import org.apache.pekko.cluster.sharding.typed.javadsl.Entity;
+import org.apache.pekko.cluster.sharding.typed.javadsl.EntityTypeKey;
+
+public class ConsistentHashingShardAllocationCompileOnlyTest {
+
+  // #building
+  public static class Building extends AbstractBehavior<Building.Command> {
+
+    static int NUMBER_OF_SHARDS = 100;
+
+    static final class MessageExtractor
+        extends ShardingMessageExtractor<ShardingEnvelope<Building.Command>, 
Building.Command> {
+      @Override
+      public String entityId(ShardingEnvelope<Command> envelope) {
+        return envelope.entityId();
+      }
+
+      @Override
+      public String shardId(String entityId) {
+        return String.valueOf(Math.abs(entityId.hashCode() % 
NUMBER_OF_SHARDS));
+      }
+
+      @Override
+      public Command unwrapMessage(ShardingEnvelope<Command> envelope) {
+        return envelope.message();
+      }
+    }
+
+    static EntityTypeKey<Building.Command> typeKey =
+        EntityTypeKey.create(Building.Command.class, "Building");
+
+    public interface Command {}

Review Comment:
   Nit: `static EntityTypeKey<...> typeKey` could be `static final` for 
immutability. Same for `Device.typeKey` below. (Matches Akka source verbatim so 
non-blocking.)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to