summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2018-01-25 16:11:28 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2018-01-25 16:11:28 +0100
commit77abc544f5a6e7e9a7fdaa18ba352cbe3b8eae56 (patch)
tree10e9adec0c1c33d65d87c8bd4b048a4ec49edd5f /configserver
parentdc66b812de9ed62f47fd857abe6f25c48dfce66e (diff)
Do not pregenerate uri yet.
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDBRegistry.java18
1 files changed, 2 insertions, 16 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDBRegistry.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDBRegistry.java
index 653b2566096..98403d109f3 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDBRegistry.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDBRegistry.java
@@ -4,10 +4,7 @@ package com.yahoo.vespa.config.server.filedistribution;
import com.yahoo.config.FileReference;
import com.yahoo.config.application.api.FileRegistry;
import com.yahoo.net.HostName;
-import com.yahoo.text.Utf8;
-import net.jpountz.xxhash.XXHashFactory;
-import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -38,7 +35,7 @@ public class FileDBRegistry implements FileRegistry {
}
public synchronized FileReference addUri(String uri, FileReference reference) {
- String relativePath = uriToRelativeFile(uri);
+ String relativePath = FileRegistry.uriToRelativeFile(uri);
Optional<FileReference> cachedReference = Optional.ofNullable(fileReferenceCache.get(uri));
return cachedReference.orElseGet(() -> {
FileReference newRef = manager.addUri(uri, relativePath, reference);
@@ -61,7 +58,7 @@ public class FileDBRegistry implements FileRegistry {
@Override
public synchronized FileReference addUri(String uri) {
- String relativePath = uriToRelativeFile(uri);
+ String relativePath = FileRegistry.uriToRelativeFile(uri);
Optional<FileReference> cachedReference = Optional.ofNullable(fileReferenceCache.get(uri));
return cachedReference.orElseGet(() -> {
FileReference newRef = manager.addUri(uri, relativePath);
@@ -81,15 +78,4 @@ public class FileDBRegistry implements FileRegistry {
return entries;
}
- private static String uriToRelativeFile(String uri) {
- String relative = "uri/" + String.valueOf(XXHashFactory.nativeInstance().hash64().hash(ByteBuffer.wrap(Utf8.toBytes(uri)), 0));
- if (uri.endsWith(".json")) {
- relative += ".json";
- } else if (uri.endsWith(".json.lz4")) {
- relative += ".json.lz4";
- } else if (uri.endsWith(".lz4")) {
- relative += ".lz4";
- }
- return relative;
- }
}