use of org.apache.jackrabbit.oak.spi.blob.BlobStore in project jackrabbit-oak by apache.
the class MigrationFactory method createUpgrade.
public RepositoryUpgrade createUpgrade() throws IOException, RepositoryException, CliArgumentException {
RepositoryContext src = stores.getSrcStore().create(closer);
BlobStore srcBlobStore = new DataStoreBlobStore(src.getDataStore());
NodeStore dstStore = createTarget(closer, srcBlobStore);
return createUpgrade(src, dstStore);
}
use of org.apache.jackrabbit.oak.spi.blob.BlobStore in project jackrabbit-oak by apache.
the class MigrationFactory method createTarget.
protected NodeStore createTarget(Closer closer, BlobStore srcBlobStore) throws IOException {
BlobStore dstBlobStore = datastores.getDstBlobStore(srcBlobStore).create(closer);
NodeStore dstStore = stores.getDstStore().create(dstBlobStore, closer);
return dstStore;
}
use of org.apache.jackrabbit.oak.spi.blob.BlobStore in project jackrabbit-oak by apache.
the class StandbyDiff method readBlob.
private void readBlob(String blobId, String pName) throws InterruptedException {
byte[] data = client.getBlob(blobId);
if (data == null) {
throw new IllegalStateException("Unable to load remote blob " + blobId + " at " + path + "#" + pName);
}
try {
BlobStore blobStore = store.getBlobStore();
assert blobStore != null : "Blob store must not be null";
blobStore.writeBlob(new ByteArrayInputStream(data));
} catch (IOException f) {
throw new IllegalStateException("Unable to persist blob " + blobId + " at " + path + "#" + pName, f);
}
}
use of org.apache.jackrabbit.oak.spi.blob.BlobStore in project jackrabbit-oak by apache.
the class BlobStoreFixtureProviderTest method readOnlyFileDataStore.
@Test
public void readOnlyFileDataStore() throws Exception {
String[] args = { "--fds-path", temporaryFolder.getRoot().getAbsolutePath() };
try (BlobStoreFixture fixture = BlobStoreFixtureProvider.create(createFDSOptions(args))) {
try {
BlobStore blobStore = fixture.getBlobStore();
assertThat(blobStore, instanceOf(GarbageCollectableBlobStore.class));
assertThat(blobStore, instanceOf(TypedDataStore.class));
assertThat(blobStore, instanceOf(BlobTrackingStore.class));
fixture.getBlobStore().writeBlob(new ByteArrayInputStream("foo".getBytes()));
fail();
} catch (Exception ignore) {
}
}
}
use of org.apache.jackrabbit.oak.spi.blob.BlobStore in project jackrabbit-oak by apache.
the class NodeStoreFixtureProvider method create.
public static NodeStoreFixture create(Options options, boolean readOnly) throws Exception {
CommonOptions commonOpts = options.getOptionBean(CommonOptions.class);
Whiteboard wb = options.getWhiteboard();
Closer closer = Closer.create();
BlobStoreFixture blobFixture = BlobStoreFixtureProvider.create(options);
BlobStore blobStore = null;
if (blobFixture != null) {
blobStore = blobFixture.getBlobStore();
closer.register(blobFixture);
}
StatisticsProvider statisticsProvider = createStatsProvider(options, wb, closer);
wb.register(StatisticsProvider.class, statisticsProvider, Collections.emptyMap());
NodeStore store;
if (commonOpts.isMongo() || commonOpts.isRDB()) {
store = configureDocumentMk(options, blobStore, statisticsProvider, closer, wb, readOnly);
} else {
store = configureSegment(options, blobStore, statisticsProvider, closer, readOnly);
}
return new SimpleNodeStoreFixture(store, blobStore, wb, closer);
}
Aggregations