diff options
author | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2018-08-21 11:30:58 +0200 |
---|---|---|
committer | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2018-08-23 11:06:36 +0200 |
commit | 7122eb01b8b56e03152f697d5caac49c24d9419f (patch) | |
tree | 21f9fcb39505d3f07da585b74b17299bcd6eb987 /controller-api/src | |
parent | dd34698bcd051c1eff8d94506a7ac7a1545ee1d2 (diff) |
Change to a simpler LogStore
Diffstat (limited to 'controller-api/src')
2 files changed, 10 insertions, 18 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 23da48b4aad..da520e480f6 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 @@ -1,20 +1,17 @@ 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 + * @author jonmv */ public interface LogStore { - /** @return the log of the given step of the given deployment job, or an empty byte array if non-existent. */ - byte[] get(RunId id, String step); + /** Returns the log of the given deployment job, or an empty byte array if non-existent. */ + byte[] get(RunId id); - /** Stores the given log for the given step of the given deployment job. */ - void append(RunId id, String step, byte[] log); + /** Stores the given log for the given deployment job. */ + void put(RunId id, byte[] log); /** Deletes all data associated with the given deployment job */ void delete(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 330b967c1b5..4c854092d7f 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 @@ -13,21 +13,16 @@ import java.util.concurrent.ConcurrentHashMap; */ public class MockLogStore implements LogStore { - private final Map<RunId, Map<String, byte[]>> logs = new ConcurrentHashMap<>(); + private final Map<RunId, byte[]> logs = new ConcurrentHashMap<>(); @Override - public byte[] get(RunId id, String step) { - return logs.getOrDefault(id, Collections.emptyMap()).getOrDefault(step, new byte[0]); + public byte[] get(RunId id) { + return logs.getOrDefault(id, new byte[0]); } @Override - public void append(RunId id, String step, byte[] log) { - logs.putIfAbsent(id, new ConcurrentHashMap<>()); - byte[] old = get(id, step); - byte[] union = new byte[old.length + log.length]; - System.arraycopy(old, 0, union, 0, old.length); - System.arraycopy(log, 0, union, old.length, log.length); - logs.get(id).put(step, union); + public void put(RunId id, byte[] log) { + logs.put(id, log); } @Override |