summaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorJon Marius Venstad <jvenstad@yahoo-inc.com>2018-06-25 10:39:04 +0200
committerJon Marius Venstad <jvenstad@yahoo-inc.com>2018-07-02 13:42:47 +0200
commitb3a8d1bafbafa156468f374b459a18d546bd4aae (patch)
tree6feca35afe1a0c113473d99ececde01d084d40fc /controller-api
parent61e0edbca9756906f1cae34c66365ce62269bca5 (diff)
Move timeout definitions to CuratorDb
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/RunId.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/RunId.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/RunId.java
new file mode 100644
index 00000000000..d78dbd6e636
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/RunId.java
@@ -0,0 +1,55 @@
+package com.yahoo.vespa.hosted.controller.deployment;
+
+import com.yahoo.config.provision.ApplicationId;
+import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
+
+import java.util.Objects;
+
+/**
+ * Immutable ID of a job run by an {@link InternalBuildService}.
+ *
+ * @author jonmv
+ */
+public class RunId {
+
+ private final ApplicationId application;
+ private final JobType type;
+ private final long number;
+
+ public RunId(ApplicationId application, JobType type, long number) {
+ this.application = Objects.requireNonNull(application, "ApplicationId cannot be null!");
+ this.type = Objects.requireNonNull(type, "JobType cannot be null!");
+ if (number <= 0) throw new IllegalArgumentException("Build number must be a positive integer!");
+ this.number = number;
+ }
+
+ public ApplicationId application() { return application; }
+ public JobType type() { return type; }
+ public long number() { return number; }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if ( ! (o instanceof RunId)) return false;
+
+ RunId id = (RunId) o;
+
+ if (number != id.number) return false;
+ if ( ! application.equals(id.application)) return false;
+ return type == id.type;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = application.hashCode();
+ result = 31 * result + type.hashCode();
+ result = 31 * result + (int) (number ^ (number >>> 32));
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "Run " + number + " of " + type + " for " + application;
+ }
+
+}