aboutsummaryrefslogtreecommitdiffstats
path: root/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@yahooinc.com>2024-01-05 10:25:14 +0100
committerHåkon Hallingstad <hakon@yahooinc.com>2024-01-05 10:25:14 +0100
commit86fa1eb5342633d971413f5be79095e1653f27f9 (patch)
treeb71d3e135a614a06471764cd862bd7de40fdd51b /node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java
parent71b2c35d7904a9cec4357f43ce1d06af3ee6127d (diff)
Reset downtime at resume
Diffstat (limited to 'node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java18
1 files changed, 6 insertions, 12 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java
index 567a5c03f43..48c85aed640 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/Node.java
@@ -431,20 +431,14 @@ public final class Node implements Nodelike {
return with(history.with(new History.Event(History.Event.Type.up, agent, instant)));
}
- /** Returns true if we have positive evidence that this node is down. */
- public boolean isDown() {
- Optional<Instant> downAt = history().event(History.Event.Type.down).map(History.Event::at);
- if (downAt.isEmpty()) return false;
-
- return !history().hasEventAfter(History.Event.Type.up, downAt.get());
+ /** Returns a copy of this with a history event saying it has been suspended at instant. */
+ public Node suspendedAt(Instant instant, Agent agent) {
+ return with(history.with(new History.Event(History.Event.Type.suspended, agent, instant)));
}
- /** Returns true if we have positive evidence that this node is up. */
- public boolean isUp() {
- Optional<Instant> upAt = history().event(History.Event.Type.up).map(History.Event::at);
- if (upAt.isEmpty()) return false;
-
- return !history().hasEventAfter(History.Event.Type.down, upAt.get());
+ /** Returns a copy of this with a history event saying it has been resumed at instant. */
+ public Node resumedAt(Instant instant, Agent agent) {
+ return with(history.with(new History.Event(History.Event.Type.resumed, agent, instant)));
}
/** Returns a copy of this with allocation set as specified. <code>node.state</code> is *not* changed. */