aboutsummaryrefslogtreecommitdiffstats
path: root/hosted-zone-api
diff options
context:
space:
mode:
authorgjoranv <gv@verizonmedia.com>2021-09-13 09:41:33 +0200
committergjoranv <gv@verizonmedia.com>2021-09-13 09:57:42 +0200
commit04858f4548a4c5030dd9a4761090cc155dda5e83 (patch)
treecaa8647c66dc09747ef18d617be42c05866fdc37 /hosted-zone-api
parent3fd952611ed59b1a841a07cc9747b0a54bc6ec85 (diff)
Add Cluster to SystemInfo
Diffstat (limited to 'hosted-zone-api')
-rw-r--r--hosted-zone-api/src/main/java/ai/vespa/cloud/Cluster.java12
-rw-r--r--hosted-zone-api/src/main/java/ai/vespa/cloud/SystemInfo.java6
-rw-r--r--hosted-zone-api/src/test/java/ai/vespa/cloud/SystemInfoTest.java12
3 files changed, 28 insertions, 2 deletions
diff --git a/hosted-zone-api/src/main/java/ai/vespa/cloud/Cluster.java b/hosted-zone-api/src/main/java/ai/vespa/cloud/Cluster.java
index 9c2dd10f146..6e064b09d7a 100644
--- a/hosted-zone-api/src/main/java/ai/vespa/cloud/Cluster.java
+++ b/hosted-zone-api/src/main/java/ai/vespa/cloud/Cluster.java
@@ -1,7 +1,19 @@
package ai.vespa.cloud;
/**
+ * The properties of a cluster of nodes.
+ *
* @author gjoranv
*/
public class Cluster {
+
+ private final int size;
+
+ public Cluster(int size) {
+ this.size = size;
+ }
+
+ /** Returns the number of nodes in this cluster. */
+ public int size() { return size; }
+
}
diff --git a/hosted-zone-api/src/main/java/ai/vespa/cloud/SystemInfo.java b/hosted-zone-api/src/main/java/ai/vespa/cloud/SystemInfo.java
index c00a199e5bb..706959438eb 100644
--- a/hosted-zone-api/src/main/java/ai/vespa/cloud/SystemInfo.java
+++ b/hosted-zone-api/src/main/java/ai/vespa/cloud/SystemInfo.java
@@ -10,16 +10,20 @@ package ai.vespa.cloud;
public class SystemInfo {
private final Zone zone;
+ private final Cluster cluster;
private final Node node;
- public SystemInfo(Zone zone, Node node) {
+ public SystemInfo(Zone zone, Cluster cluster, Node node) {
this.zone = zone;
+ this.cluster = cluster;
this.node = node;
}
/** Returns the zone this is running in */
public Zone zone() { return zone; }
+ /** Returns the cluster this is part of */
+ public Cluster cluster() { return cluster; }
/** Returns the node this is running on */
public Node node() { return node; }
diff --git a/hosted-zone-api/src/test/java/ai/vespa/cloud/SystemInfoTest.java b/hosted-zone-api/src/test/java/ai/vespa/cloud/SystemInfoTest.java
index 9f66d4949bc..6bdb38eb735 100644
--- a/hosted-zone-api/src/test/java/ai/vespa/cloud/SystemInfoTest.java
+++ b/hosted-zone-api/src/test/java/ai/vespa/cloud/SystemInfoTest.java
@@ -14,9 +14,12 @@ public class SystemInfoTest {
@Test
public void testSystemInfo() {
Zone zone = new Zone(Environment.dev, "us-west-1");
+ Cluster cluster = new Cluster(1);
Node node = new Node(0);
- SystemInfo info = new SystemInfo(zone, node);
+
+ SystemInfo info = new SystemInfo(zone, cluster, node);
assertEquals(zone, info.zone());
+ assertEquals(cluster, info.cluster());
assertEquals(node, info.node());
}
@@ -49,6 +52,13 @@ public class SystemInfoTest {
}
@Test
+ public void testCluster() {
+ int size = 1;
+ Cluster cluster = new Cluster(size);
+ assertEquals(size, cluster.size());
+ }
+
+ @Test
public void testNode() {
int index = 0;
Node node = new Node(index);