aboutsummaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2018-02-05 22:54:13 +0100
committerJon Bratseth <bratseth@oath.com>2018-02-05 22:54:13 +0100
commit30a2d3e88529bc5a86ad6c53c8de35e4a71fbac3 (patch)
tree4fc17d3e36f507efea78adc856228eec5f144019 /configserver
parent62de95451cf663f3f43532d2c4746eaa1b678d95 (diff)
Handle small constants
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationFile.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationFile.java b/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationFile.java
index 717fb88e5dc..affc2e03e2b 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationFile.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationFile.java
@@ -95,7 +95,6 @@ class ZKApplicationFile extends ApplicationFile {
@Override
public ApplicationFile writeFile(Reader input) {
- // foo/bar/baz.txt
String zkPath = getZKPath(path);
try {
String data = IOUtils.readAll(input);
@@ -112,6 +111,21 @@ class ZKApplicationFile extends ApplicationFile {
}
@Override
+ public ApplicationFile appendFile(String value) {
+ String zkPath = getZKPath(path);
+ String status = ContentStatusNew;
+ if (zkApp.exists(zkPath)) {
+ status = ContentStatusChanged;
+ }
+ String existingData = zkApp.getData(zkPath);
+ if (existingData == null)
+ existingData = "";
+ zkApp.putData(zkPath, existingData + value);
+ writeMetaFile(value, status);
+ return this;
+ }
+
+ @Override
public List<ApplicationFile> listFiles(PathFilter filter) {
String userPath = getZKPath(path);
List<ApplicationFile> ret = new ArrayList<>();