this(new TemporaryStore(), properties, db);
this(new TemporaryStore(), properties, db);
final TemporaryStore tempStore = new TemporaryStore();
final TemporaryStore tempStore = new TemporaryStore();
/** * Return a {@link TemporaryStore}. If there is no existing * {@link TemporaryStore} then a new instance is returned. If there is an * existing {@link TemporaryStore} and its extent is greater then the * configured maximum extent then a new {@link TemporaryStore} will be * created and returned. Otherwise the existing instance is returned. */ synchronized public TemporaryStore getTempStore() { TemporaryStore t = ref == null ? null : ref.get(); if (t == null || t.getBufferStrategy().getExtent() > maxExtent) { // create an empty backing file in the specified directory. final File file = TemporaryRawStore.getTempFile(tmpDir); // Create a temporary store using that backing file. t = new TemporaryStore(offsetBits, file); // put into the weak value cache. stores.put(t.getUUID(), t); // return weak reference. ref = new WeakReference<TemporaryStore>(t); } return t; }
/** * Return a {@link TemporaryStore}. If there is no existing * {@link TemporaryStore} then a new instance is returned. If there is an * existing {@link TemporaryStore} and its extent is greater then the * configured maximum extent then a new {@link TemporaryStore} will be * created and returned. Otherwise the existing instance is returned. */ synchronized public TemporaryStore getTempStore() { TemporaryStore t = ref == null ? null : ref.get(); if (t == null || t.getBufferStrategy().getExtent() > maxExtent) { // create an empty backing file in the specified directory. final File file = TemporaryRawStore.getTempFile(tmpDir); // Create a temporary store using that backing file. t = new TemporaryStore(offsetBits, file); // put into the weak value cache. stores.put(t.getUUID(), t); // return weak reference. ref = new WeakReference<TemporaryStore>(t); } return t; }
/** * Unit test where all elements are visited in the first chunk. This case is * optimized to avoid the creation of the {@link BTree}. */ public void test_distinctOneChunk() { final IIndexManager indexManager = new TemporaryStore(); final IKeyBuilder keyBuilder = new KeyBuilder(Bytes.SIZEOF_LONG); final DistinctFilter<Long> filter = new DistinctFilter<Long>( indexManager) { @Override protected byte[] getSortKey(Long e) { return keyBuilder.reset().append(e.longValue()).getKey(); } }; final Long[] a = { 12L, 1L, 3L, 1L }; final IChunkedOrderedIterator<Long> src = new ChunkedArrayIterator<Long>( a.length, a, null/* keyOrder */); final IChunkedOrderedIterator<Long> dst = new ChunkedConvertingIterator<Long, Long>( src, filter); assertSameIterator(new Long[] { 1L, 3L, 12L }, dst); }
/** * Unit test where the source iterator is empty. */ public void test_distinctOneChunkEmptyIterator() { final IIndexManager indexManager = new TemporaryStore(); final IKeyBuilder keyBuilder = new KeyBuilder(Bytes.SIZEOF_LONG); final DistinctFilter<Long> filter = new DistinctFilter<Long>( indexManager) { @Override protected byte[] getSortKey(Long e) { return keyBuilder.reset().append(e.longValue()).getKey(); } }; final Long[] a = { }; final IChunkedOrderedIterator<Long> src = new ChunkedArrayIterator<Long>( a.length, a, null/* keyOrder */); final IChunkedOrderedIterator<Long> dst = new ChunkedConvertingIterator<Long, Long>( src, filter); assertSameIterator(new Long[] { }, dst); }
/** * Unit test where the source iterator is empty. */ public void test_distinctOneChunkEmptyIterator() { final IIndexManager indexManager = new TemporaryStore(); final IKeyBuilder keyBuilder = new KeyBuilder(Bytes.SIZEOF_LONG); final DistinctFilter<Long> filter = new DistinctFilter<Long>( indexManager) { @Override protected byte[] getSortKey(Long e) { return keyBuilder.reset().append(e.longValue()).getKey(); } }; final Long[] a = { }; final IChunkedOrderedIterator<Long> src = new ChunkedArrayIterator<Long>( a.length, a, null/* keyOrder */); final IChunkedOrderedIterator<Long> dst = new ChunkedConvertingIterator<Long, Long>( src, filter); assertSameIterator(new Long[] { }, dst); }
/** * Unit test where all elements are visited in the first chunk. This case is * optimized to avoid the creation of the {@link BTree}. */ public void test_distinctOneChunk() { final IIndexManager indexManager = new TemporaryStore(); final IKeyBuilder keyBuilder = new KeyBuilder(Bytes.SIZEOF_LONG); final DistinctFilter<Long> filter = new DistinctFilter<Long>( indexManager) { @Override protected byte[] getSortKey(Long e) { return keyBuilder.reset().append(e.longValue()).getKey(); } }; final Long[] a = { 12L, 1L, 3L, 1L }; final IChunkedOrderedIterator<Long> src = new ChunkedArrayIterator<Long>( a.length, a, null/* keyOrder */); final IChunkedOrderedIterator<Long> dst = new ChunkedConvertingIterator<Long, Long>( src, filter); assertSameIterator(new Long[] { 1L, 3L, 12L }, dst); }
public static void main(String[] args) { final TemporaryStore store = new TemporaryStore();
final IIndexManager indexManager = new TemporaryStore();
final IIndexManager indexManager = new TemporaryStore();
final TemporaryStore journal = new TemporaryStore();
final TemporaryStore journal = new TemporaryStore();
TemporaryStore journal = new TemporaryStore();
TemporaryStore journal = new TemporaryStore();