diff options
author | Martin Polden <mpolden@mpolden.no> | 2019-03-26 16:12:14 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2019-03-26 16:25:40 +0200 |
commit | c50a47c516bc6aab8ff745bc58632541bb7af5c7 (patch) | |
tree | 892d901fd4a4dbfad2f4ef72c5b3c08ec269b8d1 /defaults | |
parent | 38ebffaf698512b7cd5bf57efe6bac48f7afdce2 (diff) |
Define path for temporary application storage
Diffstat (limited to 'defaults')
-rw-r--r-- | defaults/abi-spec.json | 1 | ||||
-rw-r--r-- | defaults/src/main/java/com/yahoo/vespa/defaults/Defaults.java | 17 | ||||
-rw-r--r-- | defaults/src/test/java/com/yahoo/vespa/defaults/DefaultsTestCase.java | 18 |
3 files changed, 26 insertions, 10 deletions
diff --git a/defaults/abi-spec.json b/defaults/abi-spec.json index 95dc2e40353..ee76627a61c 100644 --- a/defaults/abi-spec.json +++ b/defaults/abi-spec.json @@ -8,6 +8,7 @@ "methods": [ "public java.lang.String vespaUser()", "public java.lang.String vespaHostname()", + "public java.lang.String temporaryApplicationStorage()", "public java.lang.String vespaHome()", "public java.lang.String underVespaHome(java.lang.String)", "public int vespaWebServicePort()", diff --git a/defaults/src/main/java/com/yahoo/vespa/defaults/Defaults.java b/defaults/src/main/java/com/yahoo/vespa/defaults/Defaults.java index 0fce5d654fb..f1b7e38986f 100644 --- a/defaults/src/main/java/com/yahoo/vespa/defaults/Defaults.java +++ b/defaults/src/main/java/com/yahoo/vespa/defaults/Defaults.java @@ -1,12 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.defaults; -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.InetAddress; -import java.nio.charset.StandardCharsets; -import java.util.logging.Logger; import java.util.Optional; +import java.util.logging.Logger; @@ -25,6 +21,7 @@ public class Defaults { private final String vespaHome; private final String vespaUser; private final String vespaHost; + private final String temporaryApplicationStorage; private final int vespaWebServicePort; private final int vespaPortBase; private final int vespaPortConfigServerRpc; @@ -35,6 +32,7 @@ public class Defaults { vespaHome = findVespaHome("/opt/vespa"); vespaUser = findVespaUser("vespa"); vespaHost = findVespaHostname("localhost"); + temporaryApplicationStorage = underVespaHome("var/vespa/application"); vespaWebServicePort = findWebServicePort(8080); vespaPortBase = findVespaPortBase(19000); vespaPortConfigServerRpc = findConfigServerPort(vespaPortBase + 70); @@ -116,6 +114,15 @@ public class Defaults { public String vespaHostname() { return vespaHost; } /** + * Returns the path where a Vespa application can store arbitrary files. This should only be used for temporary + * files as there are no availability guarantees for files stored here. The application must be able to recreate + * required files on its own (e.g. by downloading them from a remote source) if missing. + * + * @return the temporary storage path + */ + public String temporaryApplicationStorage() { return temporaryApplicationStorage; } + + /** * Returns the path to the root under which Vespa should read and write files. * Will not end with a "/". * @return the vespa home directory diff --git a/defaults/src/test/java/com/yahoo/vespa/defaults/DefaultsTestCase.java b/defaults/src/test/java/com/yahoo/vespa/defaults/DefaultsTestCase.java index 07d3c39fc9c..88f4ad6f2fd 100644 --- a/defaults/src/test/java/com/yahoo/vespa/defaults/DefaultsTestCase.java +++ b/defaults/src/test/java/com/yahoo/vespa/defaults/DefaultsTestCase.java @@ -1,8 +1,10 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.defaults; +import org.junit.Ignore; import org.junit.Test; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; /** * @author arnej27959 @@ -25,14 +27,20 @@ public class DefaultsTestCase { @Test public void testPortsArePositive() { Defaults d = Defaults.getDefaults(); - assertEquals(true, d.vespaPortBase() > 0); - assertEquals(true, d.vespaWebServicePort() > 0); - assertEquals(true, d.vespaConfigServerRpcPort() > 0); - assertEquals(true, d.vespaConfigServerHttpPort() > 0); - assertEquals(true, d.vespaConfigProxyRpcPort() > 0); + assertTrue(d.vespaPortBase() > 0); + assertTrue(d.vespaWebServicePort() > 0); + assertTrue(d.vespaConfigServerRpcPort() > 0); + assertTrue(d.vespaConfigServerHttpPort() > 0); + assertTrue(d.vespaConfigProxyRpcPort() > 0); } @Test + public void testTemporaryApplicationStorage() { + assertEquals("/opt/vespa/var/vespa/application", Defaults.getDefaults().temporaryApplicationStorage()); + } + + @Test + @Ignore // This is run manually for human inspection. Contains no assertions public void dumpAllVars() { Defaults d = Defaults.getDefaults(); System.out.println("vespa user = '" + d.vespaUser() + "'"); |