summaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorJon Marius Venstad <jonmv@users.noreply.github.com>2018-11-09 14:45:31 +0100
committerGitHub <noreply@github.com>2018-11-09 14:45:31 +0100
commit2a5a8847ed7ea1ce838c24e4228608519fa73534 (patch)
tree1d6d3b1145a64589991481e6a1676f93274109e1 /controller-api
parente79984e1a0196b69adde63f08233cdaee0043b73 (diff)
parent1b04645ba03649cccc7b98da8e30ad8e4e6490eb (diff)
Merge pull request #7610 from vespa-engine/jvenstad/application-package-gc-2
Jvenstad/application package gc 2
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationStore.java30
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/RunId.java3
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterId.java32
3 files changed, 55 insertions, 10 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationStore.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationStore.java
index 4bc80e104bb..11886f7dd18 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationStore.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationStore.java
@@ -2,29 +2,39 @@
package com.yahoo.vespa.hosted.controller.api.integration.deployment;
import com.yahoo.config.provision.ApplicationId;
+
/**
- * Store for the application package and application tester package.
+ * Store for the application and tester packages.
+ *
+ * This will replace ArtifactRepository for tenant applications.
*
- * This interface will take over most of the responsibility from the ArtifactRepository with time.
+ * @author smorgrav
+ * @author jonmv
*/
public interface ApplicationStore {
/** Returns the tenant application package of the given version. */
- byte[] getApplicationPackage(ApplicationId application, ApplicationVersion applicationVersion);
+ byte[] get(ApplicationId application, ApplicationVersion applicationVersion);
/** Stores the given tenant application package of the given version. */
- void putApplicationPackage(ApplicationId application, ApplicationVersion applicationVersion, byte[] applicationPackage);
+ void put(ApplicationId application, ApplicationVersion applicationVersion, byte[] applicationPackage);
- /** Stores the given tester application package of the given version. Does NOT contain the services.xml. */
- void putTesterPackage(ApplicationId tester, ApplicationVersion applicationVersion, byte[] testerPackage);
+ /** Removes applications older than the given version, for the given application, and returns whether something was removed. */
+ boolean prune(ApplicationId application, ApplicationVersion olderThanVersion);
+
+ /** Removes all application packages for the given application. */
+ void removeAll(ApplicationId application);
/** Returns the tester application package of the given version. Does NOT contain the services.xml. */
- byte[] getTesterPackage(ApplicationId tester, ApplicationVersion applicationVersion);
+ byte[] get(TesterId tester, ApplicationVersion applicationVersion);
- /** Removes applications older than the given version, for the given application, and returns whether something was removed. */
- boolean pruneApplicationPackages(ApplicationId application, ApplicationVersion olderThanVersion);
+ /** Stores the given tester application package of the given version. Does NOT contain the services.xml. */
+ void put(TesterId tester, ApplicationVersion applicationVersion, byte[] testerPackage);
/** Removes tester packages older than the given version, for the given tester, and returns whether something was removed. */
- boolean pruneTesterPackages(ApplicationId tester, ApplicationVersion olderThanVersion);
+ boolean prune(TesterId tester, ApplicationVersion olderThanVersion);
+
+ /** Removes all tester packages for the given tester. */
+ void removeAll(TesterId tester);
}
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
index 85113d79d04..086bb8f2fb4 100644
--- 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
@@ -13,17 +13,20 @@ import java.util.Objects;
public class RunId {
private final ApplicationId application;
+ private final TesterId tester;
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.tester = TesterId.of(application);
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 TesterId tester() { return tester; }
public JobType type() { return type; }
public long number() { return number; }
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterId.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterId.java
new file mode 100644
index 00000000000..b586b9f3019
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterId.java
@@ -0,0 +1,32 @@
+package com.yahoo.vespa.hosted.controller.api.integration.deployment;
+
+import com.yahoo.config.provision.ApplicationId;
+
+/**
+ * Holds an application ID for a tester application.
+ *
+ * @author jonmv
+ */
+public class TesterId {
+
+ public static final String suffix = "-t";
+
+ private final ApplicationId id;
+
+ private TesterId(ApplicationId id) {
+ this.id = id;
+ }
+
+ /** Creates a new TesterId for a tester of the given application. */
+ public static TesterId of(ApplicationId id) {
+ return new TesterId(ApplicationId.from(id.tenant().value(),
+ id.application().value(),
+ id.instance().value() + suffix));
+ }
+
+ /** Returns the id of this tester application. */
+ public ApplicationId id() {
+ return id;
+ }
+
+}