public static KeyIterator getKeys(KeyColumnValueStore store, SliceQuery slice, StoreFeatures features, int keyLength, StoreTransaction txh) throws BackendException { if (features.hasUnorderedScan()) { return store.getKeys(slice, txh); } else if (features.hasOrderedScan()) { return store.getKeys(new KeyRangeQuery(BufferUtil.zeroBuffer(1), BufferUtil.oneBuffer(keyLength), slice), txh); } else throw new UnsupportedOperationException("Provided stores does not support scan operations: " + store); }
public RecordIterator<Long> getVertexIDs(final BackendTransaction tx) { Preconditions.checkArgument(backend.getStoreFeatures().hasOrderedScan() || backend.getStoreFeatures().hasUnorderedScan(), "The configured storage backend does not support global graph operations - use Faunus instead"); final KeyIterator keyIterator; if (backend.getStoreFeatures().hasUnorderedScan()) { keyIterator = tx.edgeStoreKeys(vertexExistenceQuery); } else { keyIterator = tx.edgeStoreKeys(new KeyRangeQuery(IDHandler.MIN_KEY, IDHandler.MAX_KEY, vertexExistenceQuery)); } return new RecordIterator<Long>() { @Override public boolean hasNext() { return keyIterator.hasNext(); } @Override public Long next() { return idManager.getKeyID(keyIterator.next()); } @Override public void close() throws IOException { keyIterator.close(); } @Override public void remove() { throw new UnsupportedOperationException("Removal not supported"); } }; }
if (manager.getFeatures().hasUnorderedScan()) {
@Test @Category({UnorderedKeyStoreTests.class}) public void testGetKeysWithSliceQuery() throws Exception { if (!manager.getFeatures().hasUnorderedScan()) { log.warn("Can't test key-unordered features on incompatible store. " + "This warning could indicate reduced test coverage and " + "a broken JUnit configuration. Skipping test {}.", name.getMethodName()); return; } populateDBWith100Keys(); tx.commit(); tx = startTx(); KeyIterator keyIterator = store.getKeys( new SliceQuery(new ReadArrayBuffer("b".getBytes()), new ReadArrayBuffer("c".getBytes())), tx); examineGetKeysResults(keyIterator, 0, 100); }
/** * Construct a Builder whose default values exactly match the values on * the supplied {@code template}. */ public Builder(StoreFeatures template) { unorderedScan(template.hasUnorderedScan()); orderedScan(template.hasOrderedScan()); multiQuery(template.hasMultiQuery()); locking(template.hasLocking()); batchMutation(template.hasBatchMutation()); localKeyPartition(template.hasLocalKeyPartition()); keyOrdered(template.isKeyOrdered()); distributed(template.isDistributed()); transactional(template.hasTxIsolation()); timestamps(template.hasTimestamps()); preferredTimestamps(template.getPreferredTimestamps()); cellTTL(template.hasCellTTL()); storeTTL(template.hasStoreTTL()); visibility(template.hasVisibility()); persists(template.supportsPersistence()); if (template.isKeyConsistent()) { keyConsistent(template.getKeyConsistentTxConfig(), template.getLocalKeyConsistentTxConfig()); } scanTxConfig(template.getScanTxConfig()); supportsInterruption(template.supportsInterruption()); optimisticLocking(template.hasOptimisticLocking()); }