Search in sources :

Example 16 with BlobStore

use of org.apache.jackrabbit.oak.spi.blob.BlobStore in project jackrabbit-oak by apache.

the class OakCachingFDSTest method registerCachingFDS.

private void registerCachingFDS() {
    Map<String, Object> props = newHashMap();
    props.put("cachePath", path);
    props.put("path", fsBackendPath);
    props.put("cacheSize", "10");
    props.put("repository.home", new File(fsBackendPath).getParentFile().getAbsolutePath());
    context.registerInjectActivateService(new FileDataStoreService(), props);
    assertNotNull(context.getService(BlobStore.class));
    BlobStore blobStore = context.getService(BlobStore.class);
    assert blobStore instanceof DataStoreBlobStore;
    DataStore ds = ((DataStoreBlobStore) blobStore).getDataStore();
    assert ds instanceof OakCachingFDS;
    dataStore = (OakCachingFDS) ds;
}
Also used : DataStore(org.apache.jackrabbit.core.data.DataStore) File(java.io.File) BlobStore(org.apache.jackrabbit.oak.spi.blob.BlobStore)

Example 17 with BlobStore

use of org.apache.jackrabbit.oak.spi.blob.BlobStore 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;
}
Also used : FileStoreBuilder(org.apache.jackrabbit.oak.segment.file.FileStoreBuilder) Oak(org.apache.jackrabbit.oak.Oak) File(java.io.File) BlobStore(org.apache.jackrabbit.oak.spi.blob.BlobStore)

Example 18 with BlobStore

use of org.apache.jackrabbit.oak.spi.blob.BlobStore in project jackrabbit-oak by apache.

the class AbstractBlobTrackerRegistrationTest method registerBlobTrackingStore.

@Test
public void registerBlobTrackingStore() throws Exception {
    registerNodeStoreService();
    assertServiceNotActivated();
    registerTrackingBlobStore();
    assertServiceActivated();
    BlobStore blobStore = context.getService(BlobStore.class);
    assertTrue(blobStore instanceof BlobTrackingStore);
    BlobTrackingStore trackingStore = (BlobTrackingStore) blobStore;
    assertNotNull(trackingStore.getTracker());
}
Also used : BlobStore(org.apache.jackrabbit.oak.spi.blob.BlobStore) DataStoreBlobStore(org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore) Test(org.junit.Test)

Example 19 with BlobStore

use of org.apache.jackrabbit.oak.spi.blob.BlobStore in project jackrabbit-oak by apache.

the class AbstractMigratorTest method setup.

@Before
public void setup() throws CommitFailedException, IllegalArgumentException, IOException {
    Path target = FileSystems.getDefault().getPath("target");
    repository = java.nio.file.Files.createTempDirectory(target, "migrate-").toFile();
    BlobStore oldBlobStore = createOldBlobStore(repository);
    NodeStore originalNodeStore = createNodeStore(oldBlobStore, repository);
    createContent(originalNodeStore);
    closeNodeStore();
    newBlobStore = createNewBlobStore(repository);
    DefaultSplitBlobStore splitBlobStore = new DefaultSplitBlobStore(repository.getPath(), oldBlobStore, newBlobStore);
    nodeStore = createNodeStore(splitBlobStore, repository);
    migrator = new BlobMigrator(splitBlobStore, nodeStore);
}
Also used : Path(java.nio.file.Path) NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) DefaultSplitBlobStore(org.apache.jackrabbit.oak.spi.blob.split.DefaultSplitBlobStore) DefaultSplitBlobStore(org.apache.jackrabbit.oak.spi.blob.split.DefaultSplitBlobStore) BlobStore(org.apache.jackrabbit.oak.spi.blob.BlobStore) Before(org.junit.Before)

Example 20 with BlobStore

use of org.apache.jackrabbit.oak.spi.blob.BlobStore in project jackrabbit-oak by apache.

the class FileBlobStoreService method activate.

@Activate
protected void activate(ComponentContext context, Map<String, Object> config) {
    String homeDir = lookup(context, PROP_HOME);
    if (homeDir != null) {
        log.info("Initializing the FileBlobStore with homeDir [{}]", homeDir);
    }
    BlobStore blobStore = new FileBlobStore(FilenameUtils.concat(homeDir, "datastore"));
    PropertiesUtil.populate(blobStore, config, false);
    Dictionary<String, Object> props = new Hashtable<String, Object>();
    if (context.getProperties().get(PROP_SPLIT_BLOBSTORE) != null) {
        props.put(PROP_SPLIT_BLOBSTORE, context.getProperties().get(PROP_SPLIT_BLOBSTORE));
    }
    reg = context.getBundleContext().registerService(new String[] { BlobStore.class.getName(), GarbageCollectableBlobStore.class.getName() }, blobStore, props);
}
Also used : Hashtable(java.util.Hashtable) FileBlobStore(org.apache.jackrabbit.oak.spi.blob.FileBlobStore) GarbageCollectableBlobStore(org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore) BlobStore(org.apache.jackrabbit.oak.spi.blob.BlobStore) FileBlobStore(org.apache.jackrabbit.oak.spi.blob.FileBlobStore) Activate(org.apache.felix.scr.annotations.Activate)

Aggregations

BlobStore (org.apache.jackrabbit.oak.spi.blob.BlobStore)31 Test (org.junit.Test)14 DataStoreBlobStore (org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore)9 GarbageCollectableBlobStore (org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore)9 File (java.io.File)8 NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)8 ByteArrayInputStream (java.io.ByteArrayInputStream)6 DataStoreUtils.getBlobStore (org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreUtils.getBlobStore)6 IOException (java.io.IOException)5 MemoryBlobStore (org.apache.jackrabbit.oak.spi.blob.MemoryBlobStore)4 DataStore (org.apache.jackrabbit.core.data.DataStore)3 FileDataStore (org.apache.jackrabbit.core.data.FileDataStore)3 Closer (com.google.common.io.Closer)2 Hashtable (java.util.Hashtable)2 Oak (org.apache.jackrabbit.oak.Oak)2 BlobTrackingStore (org.apache.jackrabbit.oak.plugins.blob.BlobTrackingStore)2 MemoryNodeStore (org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore)2 FileBlobStore (org.apache.jackrabbit.oak.spi.blob.FileBlobStore)2 DefaultSplitBlobStore (org.apache.jackrabbit.oak.spi.blob.split.DefaultSplitBlobStore)2 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)2