aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/rotation/Rotation.java
diff options
context:
space:
mode:
Diffstat (limited to 'controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/rotation/Rotation.java')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/rotation/Rotation.java50
1 files changed, 50 insertions, 0 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/rotation/Rotation.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/rotation/Rotation.java
new file mode 100644
index 00000000000..0cf7101cac0
--- /dev/null
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/rotation/Rotation.java
@@ -0,0 +1,50 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.controller.routing.rotation;
+
+import com.yahoo.text.Text;
+import java.util.Objects;
+
+/**
+ * Represents a global routing rotation.
+ *
+ * @author mpolden
+ */
+public class Rotation {
+
+ private final RotationId id;
+ private final String name;
+
+ public Rotation(RotationId id, String name) {
+ this.id = Objects.requireNonNull(id);
+ this.name = Objects.requireNonNull(name);
+ }
+
+ /** The ID of the allocated rotation. This value is generated by global routing system */
+ public RotationId id() {
+ return id;
+ }
+
+ /** The global rotation FQDN */
+ public String name() {
+ return name;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Rotation)) return false;
+ final Rotation rotation = (Rotation) o;
+ return id().equals(rotation.id()) && name().equals(rotation.name());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id(), name());
+ }
+
+ @Override
+ public String toString() {
+ return Text.format("rotation %s -> %s", id().asString(), name());
+ }
+
+}