Search in sources :

Example 1 with StreamStore

use of org.h2.mvstore.StreamStore in project jackrabbit-oak by apache.

the class BlobCache method addGeneration.

@Override
public void addGeneration(int generation, boolean readOnly) {
    CacheMap<Long, byte[]> d = cache.openMap(generation, "data", new MVMap.Builder<Long, byte[]>());
    data.addReadMap(generation, d);
    CacheMap<String, byte[]> m = cache.openMap(generation, "meta", new MVMap.Builder<String, byte[]>());
    meta.addReadMap(generation, m);
    if (!readOnly) {
        // the order is important:
        // if we switch the data first,
        // we could end up with the data in store 1
        // but the metadata in store 2 - which could
        // result in a data block not found if store 1
        // is removed later on
        meta.setWriteMap(m);
        data.setWriteMap(d);
    }
    if (streamStore == null) {
        streamStore = new StreamStore(data);
    }
}
Also used : StreamStore(org.h2.mvstore.StreamStore) MVMap(org.h2.mvstore.MVMap)

Aggregations

MVMap (org.h2.mvstore.MVMap)1 StreamStore (org.h2.mvstore.StreamStore)1