use of org.apache.jackrabbit.oak.plugins.segment.file.InvalidFileStoreVersionException 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.InvalidFileStoreVersionException 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();
}
});
}
use of org.apache.jackrabbit.oak.plugins.segment.file.InvalidFileStoreVersionException in project jackrabbit-oak by apache.
the class SegmentNodeStoreContainer method open.
@Override
public NodeStore open() throws IOException {
directory.mkdirs();
FileStore.Builder builder = FileStore.builder(new File(directory, "segmentstore"));
if (blob != null) {
builder.withBlobStore(blob.open());
}
try {
fs = builder.build();
} catch (InvalidFileStoreVersionException e) {
throw new IllegalStateException(e);
}
return SegmentNodeStore.builder(fs).build();
}
Aggregations