/** * 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()); }
public StandardScanner(final KeyColumnValueStoreManager manager) { Preconditions.checkArgument(manager!=null); Preconditions.checkArgument(manager.getFeatures().hasScan(),"Provided data store does not support scans: %s",manager); this.manager = manager; this.openStores = new HashSet<>(4); this.runningJobs = new ConcurrentHashMap<>(); this.jobCounter = new AtomicLong(0); }
/** * Returns true if the parameter supports at least one of the following: * * <ul> * <li>cell-level TTL {@link StoreFeatures#hasCellTTL()}</li> * <li>store-level TTL {@link StoreFeatures#hasStoreTTL()}</li> * </ul> * * @param features an arbitrary {@code StoreFeatures} instance * @return true if and only if at least one TTL mode is supported */ public static boolean supportsAnyTTL(StoreFeatures features) { return features.hasCellTTL() || features.hasStoreTTL(); }
public EntryMetaData[] getMetaDataSchema(String storeName) { List<EntryMetaData> schemaBuilder = Lists.newArrayList(); StoreFeatures features = getFeatures(); if (features.hasTimestamps() && storageConfig.get(STORE_META_TIMESTAMPS,storeName)) schemaBuilder.add(EntryMetaData.TIMESTAMP); if (features.hasCellTTL() && storageConfig.get(STORE_META_TTL,storeName)) schemaBuilder.add(EntryMetaData.TTL); if (features.hasVisibility() && storageConfig.get(STORE_META_VISIBILITY,storeName)) schemaBuilder.add(EntryMetaData.VISIBILITY); if (schemaBuilder.isEmpty()) return StaticArrayEntry.EMPTY_SCHEMA; return schemaBuilder.toArray(new EntryMetaData[schemaBuilder.size()]); }
@Test(expected = IllegalArgumentException.class) public void testGetTTLFromUnsupportedType() { if (!features.hasCellTTL()) { throw new IllegalArgumentException(); } JanusGraphSchemaType type = ImplicitKey.ID; mgmt.getTTL(type); }
if (manager.getFeatures().hasScan()) { final int offset = 10; //should be greater than or equal to 1 final int size = 10; //should be greater than or equal to 4 if (manager.getFeatures().hasUnorderedScan()) { } else if (manager.getFeatures().hasOrderedScan()) {
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 KeyIterator edgeStoreKeys(final KeyRangeQuery range) { Preconditions.checkArgument(storeFeatures.hasOrderedScan(), "The configured storage backend does not support ordered scans"); return executeRead(new Callable<KeyIterator>() { @Override public KeyIterator call() throws Exception { return edgeStore.getKeys(range, storeTx); } @Override public String toString() { return "EdgeStoreKeys"; } }); }
indexStoreTTL = ConversionHelper.getTTLSeconds(config.get(LOG_STORE_TTL)); StoreFeatures storeFeatures = storeManager.getFeatures(); if (storeFeatures.hasCellTTL() && !storeFeatures.hasStoreTTL()) { } else if (!storeFeatures.hasStoreTTL()){ log.warn("Log is configured with TTL but underlying storage backend does not support TTL, hence this" + "configuration option is ignored and entries must be manually removed from the backend."); if (storeManager.getFeatures().hasLocalKeyPartition()) {
public ConsistentKeyIDAuthority(KeyColumnValueStore idStore, StoreManager manager, Configuration config) throws BackendException { super(config); Preconditions.checkArgument(manager.getFeatures().isKeyConsistent()); this.manager = manager; this.idStore = idStore; Preconditions.checkNotNull(times); supportsInterruption = manager.getFeatures().supportsInterruption(); randomUniqueIDLimit,uniqueIDUpperBound); uniqueId = -1; storeTxConfigBuilder.customOptions(manager.getFeatures().getKeyConsistentTxConfig()); } else { randomizeUniqueId = false; if (conflictAvoidanceMode.equals(ConflictAvoidanceMode.LOCAL_MANUAL)) { Preconditions.checkArgument(config.has(IDAUTHORITY_CAV_TAG),"Need to configure a unique id in order to use local consistency"); storeTxConfigBuilder.customOptions(manager.getFeatures().getLocalKeyConsistentTxConfig()); } else { storeTxConfigBuilder.customOptions(manager.getFeatures().getKeyConsistentTxConfig());
public StoreTransaction newTransaction(KeyColumnValueStoreManager manager) throws BackendException { StoreTransaction transaction = manager.beginTransaction(getTxConfig()); if (!manager.getFeatures().hasLocking() && manager.getFeatures().isKeyConsistent()) { transaction = new ExpectedValueCheckingTransaction(transaction, manager.beginTransaction(getConsistentTxConfig(manager)), GraphDatabaseConfiguration.STORAGE_READ_WAITTIME.getDefaultValue()); } return transaction; }
if (!storeFeatures.hasBatchMutation()) { bufferSize = Integer.MAX_VALUE; } else bufferSize = bufferSizeTmp; maxReadTime = configuration.get(STORAGE_READ_WAITTIME); if (!storeFeatures.hasLocking()) { Preconditions.checkArgument(storeFeatures.isKeyConsistent(),"Store needs to support some form of locking"); storeManagerLocking = new ExpectedValueCheckingStoreManager(storeManager,LOCK_STORE_SUFFIX,this,maxReadTime); } else {
protected StandardBaseTransactionConfig getConsistentTxConfig(StoreManager manager) { return StandardBaseTransactionConfig.of(times,manager.getFeatures().getKeyConsistentTxConfig()); }
for (Iterator<VertexProperty<Object>> propertyIterator = v1.properties(name); propertyIterator.hasNext(); ) { VertexProperty prop = propertyIterator.next(); if (features.hasTimestamps()) { Instant t = prop.value("~timestamp"); assertEquals(100,t.getEpochSecond()); assertEquals(Instant.ofEpochSecond(0, 1000).getNano(),t.getNano()); if (features.hasCellTTL()) { Duration d = prop.value("~ttl"); assertEquals(0L, d.getSeconds());
@Test @Category({ OrderedKeyStoreTests.class }) public void testGetLocalKeyPartition() throws BackendException { assumeTrue(manager.getFeatures().hasLocalKeyPartition()); List<KeyRange> local = manager.getLocalKeyPartition(); assertNotNull(local); assertEquals(1, local.size()); assertNotNull(local.get(0).getStart()); assertNotNull(local.get(0).getEnd()); } }
public Map<StaticBuffer,EntryList> edgeStoreMultiQuery(final List<StaticBuffer> keys, final SliceQuery query) { if (storeFeatures.hasMultiQuery()) { return executeRead(new Callable<Map<StaticBuffer,EntryList>>() { @Override
StoreFeatures f = storeManager.getFeatures(); final TimestampProviders backendPreference; if (f.hasTimestamps() && null != (backendPreference = f.getPreferredTimestamps())) { globalWrite.set(TIMESTAMP_PROVIDER, backendPreference); log.info("Set timestamps to {} according to storage backend preference",
public final boolean storeUsesConsistentKeyLocker() { return !this.features.hasLocking(); }
final boolean isLockingOptimistic() { return features.hasOptimisticLocking(); }
@Test(expected = IllegalArgumentException.class) public void testSettingTTLOnUnsupportedType() { if (!features.hasCellTTL()) { throw new IllegalArgumentException(); } JanusGraphSchemaType type = ImplicitKey.ID; mgmt.setTTL(type, Duration.ZERO); }