remove the wrapper class PdbDB
It did not serve any purpose and could be replaced by DataStore.
This commit is contained in:
@@ -1,60 +0,0 @@
|
||||
package org.lucares.pdb.datastore;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import org.lucares.pdb.api.Tags;
|
||||
import org.lucares.pdb.datastore.internal.DataStore;
|
||||
import org.lucares.pdb.datastore.internal.Proposer;
|
||||
import org.lucares.pdb.diskstorage.DiskStorage;
|
||||
|
||||
public class PdbDB implements AutoCloseable {
|
||||
|
||||
private final DataStore dataStore;
|
||||
private final Proposer proposer;
|
||||
|
||||
public PdbDB(final Path dataDirectory) throws IOException {
|
||||
dataStore = new DataStore(dataDirectory);
|
||||
proposer = new Proposer(dataStore);
|
||||
}
|
||||
|
||||
public List<Doc> search(final String query) {
|
||||
return dataStore.search(query);
|
||||
}
|
||||
|
||||
public long createNewFile(final Tags tags) throws IOException {
|
||||
return dataStore.createNewFile(tags);
|
||||
}
|
||||
|
||||
public List<String> getAvailableFields() {
|
||||
return dataStore.getAvailableFields();
|
||||
}
|
||||
|
||||
public SortedSet<String> getAvailableValuesForKey(final String query, final String fieldName) {
|
||||
return dataStore.getAvailableValuesForKey(query, fieldName);
|
||||
}
|
||||
|
||||
public List<Proposal> propose(final String query, final int caretIndex) {
|
||||
return proposer.propose(query, caretIndex);
|
||||
}
|
||||
|
||||
public List<Doc> getByTags(final Tags tags) {
|
||||
|
||||
return dataStore.getByTags(tags);
|
||||
}
|
||||
|
||||
public Path getStorageBasePath() {
|
||||
return dataStore.getStorageBasePath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
dataStore.close();
|
||||
}
|
||||
|
||||
public DiskStorage getDiskStorage() {
|
||||
return dataStore.getDiskStorage();
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import org.lucares.collections.IntList;
|
||||
import org.lucares.pdb.api.StringCompressor;
|
||||
import org.lucares.pdb.api.Tags;
|
||||
import org.lucares.pdb.datastore.Doc;
|
||||
import org.lucares.pdb.datastore.Proposal;
|
||||
import org.lucares.pdb.datastore.lang.Expression;
|
||||
import org.lucares.pdb.datastore.lang.ExpressionToDocIdVisitor;
|
||||
import org.lucares.pdb.datastore.lang.ExpressionToDocIdVisitor.AllDocIds;
|
||||
@@ -265,15 +266,15 @@ public class DataStore implements AutoCloseable {
|
||||
return result;
|
||||
}
|
||||
|
||||
public Path getStorageBasePath() {
|
||||
return storageBasePath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
diskStorage.close();
|
||||
}
|
||||
|
||||
public List<Proposal> propose(final String query, final int caretIndex) {
|
||||
return new Proposer(this).propose(query, caretIndex);
|
||||
}
|
||||
|
||||
private void initListingFileIfNotExists() throws IOException {
|
||||
if (!Files.exists(listingFilePath)) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user