mirror of https://github.com/apache/kafka.git
MINOR: Move TopicIdPartition class to server-common (#14418)
This patch moves the TopicIdPartition from the metadata module to the server-common module so it can be used by the group-coordinator module as well. Reviewers: Sagar Rao <sagarmeansocean@gmail.com>, David Jacot <djacot@confluent.io>
This commit is contained in:
parent
7b0352f1bd
commit
bcfc9543d1
|
@ -18,6 +18,7 @@
|
|||
package org.apache.kafka.controller;
|
||||
|
||||
import org.apache.kafka.common.Uuid;
|
||||
import org.apache.kafka.server.common.TopicIdPartition;
|
||||
import org.apache.kafka.metadata.Replicas;
|
||||
import org.apache.kafka.timeline.SnapshotRegistry;
|
||||
import org.apache.kafka.timeline.TimelineHashMap;
|
||||
|
|
|
@ -91,6 +91,7 @@ import org.apache.kafka.metadata.placement.PlacementSpec;
|
|||
import org.apache.kafka.metadata.placement.TopicAssignment;
|
||||
import org.apache.kafka.metadata.placement.UsableBroker;
|
||||
import org.apache.kafka.server.common.ApiMessageAndVersion;
|
||||
import org.apache.kafka.server.common.TopicIdPartition;
|
||||
import org.apache.kafka.server.mutable.BoundedList;
|
||||
import org.apache.kafka.server.policy.CreateTopicPolicy;
|
||||
import org.apache.kafka.timeline.SnapshotRegistry;
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.kafka.controller;
|
|||
|
||||
import org.apache.kafka.common.Uuid;
|
||||
import org.apache.kafka.common.utils.LogContext;
|
||||
import org.apache.kafka.server.common.TopicIdPartition;
|
||||
import org.apache.kafka.controller.BrokersToIsrs.PartitionsOnReplicaIterator;
|
||||
import org.apache.kafka.timeline.SnapshotRegistry;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
|
|
@ -128,6 +128,7 @@ import org.apache.kafka.raft.Batch;
|
|||
import org.apache.kafka.raft.OffsetAndEpoch;
|
||||
import org.apache.kafka.server.common.ApiMessageAndVersion;
|
||||
import org.apache.kafka.server.common.MetadataVersion;
|
||||
import org.apache.kafka.server.common.TopicIdPartition;
|
||||
import org.apache.kafka.server.fault.FaultHandlerException;
|
||||
import org.apache.kafka.snapshot.FileRawSnapshotReader;
|
||||
import org.apache.kafka.snapshot.Snapshots;
|
||||
|
|
|
@ -85,6 +85,7 @@ import org.apache.kafka.metadata.placement.StripedReplicaPlacer;
|
|||
import org.apache.kafka.metadata.placement.UsableBroker;
|
||||
import org.apache.kafka.server.common.ApiMessageAndVersion;
|
||||
import org.apache.kafka.server.common.MetadataVersion;
|
||||
import org.apache.kafka.server.common.TopicIdPartition;
|
||||
import org.apache.kafka.server.policy.CreateTopicPolicy;
|
||||
import org.apache.kafka.server.util.MockRandom;
|
||||
import org.apache.kafka.timeline.SnapshotRegistry;
|
||||
|
|
|
@ -14,25 +14,34 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.kafka.server.common;
|
||||
|
||||
package org.apache.kafka.controller;
|
||||
|
||||
import java.util.Objects;
|
||||
import org.apache.kafka.common.Uuid;
|
||||
|
||||
final class TopicIdPartition {
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Represents a partition using its unique topic Id and partition number.
|
||||
*/
|
||||
public final class TopicIdPartition {
|
||||
private final Uuid topicId;
|
||||
private final int partitionId;
|
||||
|
||||
TopicIdPartition(Uuid topicId, int partitionId) {
|
||||
public TopicIdPartition(Uuid topicId, int partitionId) {
|
||||
this.topicId = topicId;
|
||||
this.partitionId = partitionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Universally unique Id representing this topic partition.
|
||||
*/
|
||||
public Uuid topicId() {
|
||||
return topicId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The partition Id.
|
||||
*/
|
||||
public int partitionId() {
|
||||
return partitionId;
|
||||
}
|
Loading…
Reference in New Issue