reduce memory footprint by lazily intializing the path in Doc

The path in Doc is not optional. This reduces memory consumption,
because we only have to store a long (the offset in the listing file).
This assumes, that only a small percentage of Docs is requested.
This commit is contained in:
2018-05-06 12:58:10 +02:00
parent e3102c01d4
commit 82b8a8a932
11 changed files with 324 additions and 39 deletions

View File

@@ -15,6 +15,7 @@ import java.util.function.Consumer;
import org.lucares.pdb.api.Tags;
import org.lucares.pdb.datastore.Doc;
import org.lucares.pdb.datastore.FolderStoragePathResolver;
import org.lucares.pdb.datastore.PdbDB;
import org.lucares.utils.CollectionUtils;
import org.slf4j.Logger;
@@ -70,7 +71,8 @@ public class TagsToFile implements AutoCloseable {
final List<PdbFile> result = new ArrayList<>();
for (final Doc document : searchResult) {
final Path path = document.getPath();
final FolderStoragePathResolver resolver = db.getFolderStoragePathResolver();
final Path path = document.getPath(resolver);
final Tags tags = document.getTags();
final PdbFile pdbFile = new PdbFile(path, tags);