diff options
Diffstat (limited to 'hosted-zone-api/src/main/java/ai/vespa/cloud/Node.java')
-rw-r--r-- | hosted-zone-api/src/main/java/ai/vespa/cloud/Node.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/hosted-zone-api/src/main/java/ai/vespa/cloud/Node.java b/hosted-zone-api/src/main/java/ai/vespa/cloud/Node.java new file mode 100644 index 00000000000..19ef2757b6c --- /dev/null +++ b/hosted-zone-api/src/main/java/ai/vespa/cloud/Node.java @@ -0,0 +1,34 @@ +package ai.vespa.cloud; + +import java.util.Objects; + +/** + * A node that is part of a cluster of e.g. Jdisc containers. + * + * @author gjoranv + */ +public class Node { + + private final int index; + + public Node(int index) { + this.index = index; + } + + /** Returns the unique index for this node in the cluster. + * Indices are non-negative, but not necessarily contiguous or starting from zero. */ + public int index() { return index; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Node node = (Node) o; + return index == node.index; + } + + @Override + public int hashCode() { + return Objects.hash(index); + } +} |