aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Musum <musum@vespa.ai>2023-11-05 16:51:30 +0100
committerGitHub <noreply@github.com>2023-11-05 16:51:30 +0100
commit76258a000f1efc16c84db65e14b2cb475255d06e (patch)
tree2c7ce28d4fddd43607b261c87290b91d58b19435
parent852937d00ee9b4f0f092632e198b6a52aa50417a (diff)
parent879640f15099679dbd48cc6befaa7a150a7d34bc (diff)
Merge pull request #29236 from vespa-engine/hakonhall/define-a-few-tostring
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeHistory.java26
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeMembership.java30
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeOwner.java7
3 files changed, 60 insertions, 3 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeHistory.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeHistory.java
index 0ca4acdcf49..31b0b3e5f37 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeHistory.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeHistory.java
@@ -5,6 +5,9 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
+import java.time.Instant;
+import java.util.Objects;
+
/**
* Wire class for node-repository representation of the history of a node
*
@@ -33,4 +36,27 @@ public class NodeHistory {
return event;
}
+ @Override
+ public String toString() {
+ return "NodeHistory{" +
+ "at=" + (at == null ? "null" : Instant.ofEpochSecond(at)) +
+ ", agent='" + agent + '\'' +
+ ", event='" + event + '\'' +
+ '}';
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ NodeHistory that = (NodeHistory) o;
+ return Objects.equals(at, that.at) &&
+ Objects.equals(agent, that.agent) &&
+ Objects.equals(event, that.event);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(at, agent, event);
+ }
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeMembership.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeMembership.java
index 3d3bbddd349..4a17532d069 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeMembership.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeMembership.java
@@ -4,6 +4,8 @@ package com.yahoo.vespa.hosted.controller.api.integration.noderepository;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.Objects;
+
/**
* @author mpolden
*/
@@ -40,4 +42,32 @@ public class NodeMembership {
public Boolean getRetired() {
return retired;
}
+
+ @Override
+ public String toString() {
+ return "NodeMembership{" +
+ "clustertype='" + clustertype + '\'' +
+ ", clusterid='" + clusterid + '\'' +
+ ", group='" + group + '\'' +
+ ", index=" + index +
+ ", retired=" + retired +
+ '}';
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ NodeMembership that = (NodeMembership) o;
+ return Objects.equals(clustertype, that.clustertype) &&
+ Objects.equals(clusterid, that.clusterid) &&
+ Objects.equals(group, that.group) &&
+ Objects.equals(index, that.index) &&
+ Objects.equals(retired, that.retired);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(clustertype, clusterid, group, index, retired);
+ }
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeOwner.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeOwner.java
index 076d81aa5aa..ac5e2c9d52a 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeOwner.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeOwner.java
@@ -34,6 +34,9 @@ public class NodeOwner {
}
@Override
+ public String toString() { return tenant + '.' + application + '.' + instance; }
+
+ @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
@@ -44,7 +47,5 @@ public class NodeOwner {
}
@Override
- public int hashCode() {
- return Objects.hash(tenant, application, instance);
- }
+ public int hashCode() { return Objects.hash(tenant, application, instance); }
}