use of org.apache.jackrabbit.oak.plugins.segment.file.FileStore.Builder in project jackrabbit-oak by apache.
the class SegmentFactory method hasExternalBlobReferences.
@Override
public boolean hasExternalBlobReferences() throws IOException {
Builder builder = FileStore.builder(new File(dir, "segmentstore"));
builder.withMaxFileSize(256);
builder.withMemoryMapping(false);
FileStore fs;
try {
fs = builder.buildReadOnly();
} catch (InvalidFileStoreVersionException e) {
throw new IOException(e);
}
try {
fs.getTracker().collectBlobReferences(new ReferenceCollector() {
@Override
public void addReference(String reference, @Nullable String nodeId) {
// see java.nio.file.FileVisitor
throw new ExternalBlobFound();
}
});
return false;
} catch (ExternalBlobFound e) {
return true;
} finally {
fs.close();
}
}
use of org.apache.jackrabbit.oak.plugins.segment.file.FileStore.Builder in project jackrabbit-oak by apache.
the class SegmentFactory method create.
@Override
public NodeStore create(BlobStore blobStore, Closer closer) throws IOException {
Builder builder = FileStore.builder(new File(dir, "segmentstore"));
if (blobStore != null) {
builder.withBlobStore(blobStore);
}
builder.withMaxFileSize(256);
if (disableMmap) {
builder.withMemoryMapping(false);
} else {
builder.withDefaultMemoryMapping();
}
final FileStore fs;
try {
if (readOnly) {
fs = builder.buildReadOnly();
} else {
fs = builder.build();
}
} catch (InvalidFileStoreVersionException e) {
throw new IllegalStateException(e);
}
closer.register(asCloseable(fs));
return new TarNodeStore(SegmentNodeStore.builder(fs).build(), new TarNodeStore.SuperRootProvider() {
@Override
public NodeState getSuperRoot() {
return fs.getHead();
}
});
}
Aggregations