use of org.apache.jackrabbit.oak.segment.file.FileStoreBuilder in project jackrabbit-oak by apache.
the class SegmentTarFactory method hasExternalBlobReferences.
@Override
public boolean hasExternalBlobReferences() throws IOException {
final FileStoreBuilder builder = fileStoreBuilder(new File(dir, "segmentstore"));
builder.withMaxFileSize(256);
builder.withMemoryMapping(false);
ReadOnlyFileStore fs;
try {
fs = builder.buildReadOnly();
} catch (InvalidFileStoreVersionException e) {
throw new IOException(e);
}
try {
for (SegmentId id : fs.getSegmentIds()) {
if (!id.isDataSegmentId()) {
continue;
}
id.getSegment().forEachRecord(new Segment.RecordConsumer() {
@Override
public void consume(int number, RecordType type, int offset) {
// see java.nio.file.FileVisitor
if (type == RecordType.BLOB_ID) {
throw new ExternalBlobFound();
}
}
});
}
return false;
} catch (ExternalBlobFound e) {
return true;
} finally {
fs.close();
}
}
use of org.apache.jackrabbit.oak.segment.file.FileStoreBuilder in project jackrabbit-oak by apache.
the class CompositeStoreFixture method getNodeStore.
private NodeStore getNodeStore() throws IOException, InvalidFileStoreVersionException {
if (inMemory) {
return new MemoryNodeStore();
}
FileStoreBuilder fsBuilder = fileStoreBuilder(new File(base, unique)).withMaxFileSize(maxFileSizeMB).withSegmentCacheSize(cacheSizeMB).withMemoryMapping(memoryMapping);
fileStore = fsBuilder.build();
return SegmentNodeStoreBuilders.builder(fileStore).build();
}
use of org.apache.jackrabbit.oak.segment.file.FileStoreBuilder in project jackrabbit-oak by apache.
the class SegmentTarFixture method setUpCluster.
@Override
public Oak[] setUpCluster(int n, StatisticsProvider statsProvider) throws Exception {
Oak[] cluster = new Oak[n];
stores = new FileStore[cluster.length];
if (useBlobStore) {
blobStoreFixtures = new BlobStoreFixture[cluster.length];
}
for (int i = 0; i < cluster.length; i++) {
BlobStore blobStore = null;
if (useBlobStore) {
blobStoreFixtures[i] = BlobStoreFixture.create(base, true, dsCacheSizeInMB, statsProvider);
blobStore = blobStoreFixtures[i].setUp();
}
FileStoreBuilder builder = fileStoreBuilder(new File(base, unique));
if (blobStore != null) {
builder.withBlobStore(blobStore);
}
stores[i] = builder.withMaxFileSize(maxFileSizeMB).withStatisticsProvider(statsProvider).withSegmentCacheSize(cacheSizeMB).withMemoryMapping(memoryMapping).build();
cluster[i] = newOak(SegmentNodeStoreBuilders.builder(stores[i]).build());
}
return cluster;
}
use of org.apache.jackrabbit.oak.segment.file.FileStoreBuilder in project jackrabbit-oak by apache.
the class LuceneBlobCacheTest method setUp.
@Before
public void setUp() throws Exception {
fileDataStore = new ReadAccessCountingDataStore();
fileDataStore.init(tempFolder.newFolder().getAbsolutePath());
FileStoreBuilder fileStoreBuilder = FileStoreBuilder.fileStoreBuilder(tempFolder.newFolder()).withBlobStore(new DataStoreBlobStore(fileDataStore)).withMaxFileSize(256).withSegmentCacheSize(64).withMemoryMapping(false);
store = fileStoreBuilder.build();
NodeStore nodeStore = SegmentNodeStoreBuilders.builder(store).build();
root = nodeStore.getRoot();
builder = root.builder();
}
use of org.apache.jackrabbit.oak.segment.file.FileStoreBuilder in project jackrabbit-oak by apache.
the class SegmentTarFactory method create.
@Override
public NodeStore create(BlobStore blobStore, Closer closer) throws IOException {
final FileStoreBuilder builder = fileStoreBuilder(new File(dir, "segmentstore"));
if (blobStore != null) {
builder.withBlobStore(blobStore);
}
builder.withMaxFileSize(256);
if (disableMmap) {
builder.withMemoryMapping(false);
} else {
builder.withDefaultMemoryMapping();
}
try {
if (readOnly) {
final ReadOnlyFileStore fs;
fs = builder.buildReadOnly();
closer.register(asCloseable(fs));
return new TarNodeStore(SegmentNodeStoreBuilders.builder(fs).build(), new SegmentTarSuperRootProvider(fs));
} else {
final FileStore fs;
fs = builder.build();
closer.register(asCloseable(fs));
return new TarNodeStore(SegmentNodeStoreBuilders.builder(fs).build(), new SegmentTarSuperRootProvider(fs));
}
} catch (InvalidFileStoreVersionException e) {
throw new IllegalStateException(e);
}
}
Aggregations