move filename for keys.csv to UniqueStringIntegerPairs

This commit is contained in:
2021-10-16 15:33:04 +02:00
parent ea1cf6785d
commit 3d72231415
3 changed files with 9 additions and 9 deletions

View File

@@ -123,7 +123,7 @@ public class DataStore implements AutoCloseable {
public DataStore(final Path dataDirectory) throws IOException { public DataStore(final Path dataDirectory) throws IOException {
storageBasePath = storageDirectory(dataDirectory); storageBasePath = storageDirectory(dataDirectory);
stringCompressor = StringCompressor.create(keyCompressionFile(storageBasePath)); stringCompressor = StringCompressor.create(storageBasePath);
Tags.STRING_COMPRESSOR = stringCompressor; Tags.STRING_COMPRESSOR = stringCompressor;
diskStorage = new PartitionDiskStore(storageBasePath, "data.bs"); diskStorage = new PartitionDiskStore(storageBasePath, "data.bs");
@@ -143,10 +143,6 @@ public class DataStore implements AutoCloseable {
writerCache.addListener((key, value) -> value.close()); writerCache.addListener((key, value) -> value.close());
} }
private Path keyCompressionFile(final Path dataDirectory) throws IOException {
return dataDirectory.resolve("keys.csv");
}
public static Path storageDirectory(final Path dataDirectory) throws IOException { public static Path storageDirectory(final Path dataDirectory) throws IOException {
return dataDirectory.resolve(SUBDIR_STORAGE); return dataDirectory.resolve(SUBDIR_STORAGE);
} }

View File

@@ -21,8 +21,8 @@ public class StringCompressor {
this.usip = usip; this.usip = usip;
} }
public static StringCompressor create(final Path path) { public static StringCompressor create(final Path storageBasePath) {
final UniqueStringIntegerPairs mapsi = new UniqueStringIntegerPairs(path); final UniqueStringIntegerPairs mapsi = new UniqueStringIntegerPairs(storageBasePath);
final StringCompressor result = new StringCompressor(mapsi); final StringCompressor result = new StringCompressor(mapsi);
result.put(ALL_DOCS_KEY); result.put(ALL_DOCS_KEY);

View File

@@ -103,13 +103,17 @@ public class UniqueStringIntegerPairs {
this(null); this(null);
} }
public UniqueStringIntegerPairs(final Path file) { public UniqueStringIntegerPairs(final Path storageBasePath) {
this.file = file; this.file = keyCompressionFile(storageBasePath);
if (file != null) { if (file != null) {
init(file); init(file);
} }
} }
private Path keyCompressionFile(final Path dataDirectory) {
return dataDirectory.resolve("keys.csv");
}
private void init(final Path file) throws RuntimeIOException { private void init(final Path file) throws RuntimeIOException {
try { try {