summaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorJon Marius Venstad <jvenstad@yahoo-inc.com>2018-07-03 15:34:44 +0200
committerJon Marius Venstad <jvenstad@yahoo-inc.com>2018-07-03 15:34:44 +0200
commit98feb2edfde11e8964af1d7902a4d14f436fdb34 (patch)
tree0d2a2f86dcc54046e4628938f8a34fe63d1be6e6 /controller-api
parent45180ef9556ceea8df516dc239033f064128f46c (diff)
Store one object per deployment job step
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/LogStore.java24
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockLogStore.java41
2 files changed, 19 insertions, 46 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/LogStore.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/LogStore.java
index 918047edca1..ef2d9077892 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/LogStore.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/LogStore.java
@@ -3,30 +3,20 @@ package com.yahoo.vespa.hosted.controller.api.integration;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.PrepareResponse;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId;
+import java.util.Optional;
+
/**
* @author freva
*/
public interface LogStore {
- /** @return the test log of the given deployment job. */
- String getTestLog(RunId id);
-
- /** Stores the given test log for the given deployment job. */
- void setTestLog(RunId id, String testLog);
-
- /** @return the convergence log of the given deployment job. */
- String getConvergenceLog(RunId id);
-
- /** Stores the given convergence log for the given deployment job. */
- void setConvergenceLog(RunId id, String convergenceLog);
-
- /** @return the result of prepare of the test application for the given deployment job. */
- String getDeploymentLog(RunId id);
+ /** @return the log of the given step of the given deployment job, or an empty byte array if non-existent. */
+ byte[] getLog(RunId id, String step);
- /** Stores the given result of prepare of the test application for the given deployment job. */
- void setDeploymentLog(RunId id, String deploymentLog);
+ /** Stores the given log for the given step of the given deployment job. */
+ void setLog(RunId id, String step, byte[] log);
- /** Deletes all data associated with test of a given deployment job */
+ /** Deletes all data associated with the given deployment job */
void deleteTestData(RunId id);
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockLogStore.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockLogStore.java
index bc9f6247055..61e6ac1004b 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockLogStore.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockLogStore.java
@@ -1,52 +1,35 @@
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.stubs;
-import com.yahoo.vespa.hosted.controller.api.application.v4.model.configserverbindings.ConfigChangeActions;
-import com.yahoo.vespa.hosted.controller.api.identifiers.TenantId;
import com.yahoo.vespa.hosted.controller.api.integration.LogStore;
-import com.yahoo.vespa.hosted.controller.api.integration.configserver.PrepareResponse;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId;
-import java.util.Collections;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
/**
- * @author freva
+ * @author jonmv
*/
public class MockLogStore implements LogStore {
- @Override
- public String getTestLog(RunId id) {
- return "SUCCESS";
- }
-
- @Override
- public void setTestLog(RunId id, String testLog) {
-
- }
+ private final Map<RunId, Map<String, byte[]>> storage = new ConcurrentHashMap<>();
@Override
- public String getConvergenceLog(RunId id) {
- return "SUCCESS";
+ public byte[] getLog(RunId id, String step) {
+ return storage.containsKey(id) && storage.get(id).containsKey(step)
+ ? storage.get(id).get(step)
+ : new byte[0];
}
@Override
- public void setConvergenceLog(RunId id, String convergenceLog) {
-
- }
-
- @Override
- public String getDeploymentLog(RunId id) {
- return "SUCCESS";
- }
-
- @Override
- public void setDeploymentLog(RunId id, String deploymentLog) {
-
+ public void setLog(RunId id, String step, byte[] log) {
+ storage.putIfAbsent(id, new ConcurrentHashMap<>());
+ storage.get(id).put(step, log);
}
@Override
public void deleteTestData(RunId id) {
-
+ storage.remove(id);
}
}