/** * Gets a reference to the specified index. No network call. */ public Index getIndex(String indexName) { return new Index(client, indexName, this); }
final String indexName = getIndexName(); retry: for (;;) { final TableDescription desc = getTable().waitForActive(); List<GlobalSecondaryIndexDescription> list = desc.getGlobalSecondaryIndexes(); if (list != null) {
.withString(":v_date","2013-11-01") .withString(":v_issue","A-")); items = index.query(querySpec); } else if (indexName == "TitleIndex") { System.out.println("Compilation errors"); .withString(":v_title","Compilation error") .withString(":v_issue","A-")); items = index.query(querySpec); } else if (indexName == "DueDateIndex") { System.out.println("Items that are due on 2013-11-30"); .withValueMap(new ValueMap() .withString(":v_date","2013-11-30")); items = index.query(querySpec); } else { System.out.println("\nNo valid index name provided");
@Override protected ItemCollection<ScanOutcome> doScan(ScanSpec spec) { spec.getRequest().setIndexName(index.getIndexName()); return super.doScan(spec); } }
public IndexScanImpl(AmazonDynamoDB client, Index index) { super(client, index.getTable()); this.index = index; }
@Override protected ItemCollection<QueryOutcome> doQuery(QuerySpec spec) { spec.getRequest().setIndexName(index.getIndexName()); return super.doQuery(spec); } }
public IndexQueryImpl(AmazonDynamoDB client, Index index) { super(client, index.getTable()); this.index = index; }
/** * Returns the result of a request to get all items from the specified * DynamoDB table. * * @param table The DynamoDB table. * * @return The iterable item collection. */ ItemCollection<?> getAllItems(final Table table) { if (applyRangeKey) { RangeKeyCondition c = new RangeKeyCondition(rangeKeyName).eq(rangeKeyValue); return table.getIndex(getRangeKeyGSIName()).query(new QuerySpec().withRangeKeyCondition(c)); } return table.scan(new ScanSpec()); }
final Table table = getTable(); final String tableName = table.getTableName(); final String indexName = getIndexName(); retry: for (;;) { TableDescription desc = table.waitForActive();
@Override protected ItemCollection<QueryOutcome> doQuery(QuerySpec spec) { spec.getRequest().setIndexName(index.getIndexName()); return super.doQuery(spec); } }
public IndexScanImpl(AmazonDynamoDB client, Index index) { super(client, index.getTable()); this.index = index; }
/** * Gets a reference to the specified index. No network call. */ public Index getIndex(String indexName) { return new Index(client, indexName, this); }
@Override @SuppressWarnings("unchecked") public void executeQuery(final Query query, final Consumer<InfinispanEntry<K, V>> consumer) { if (! (query instanceof MatchQuery)) { throw new UnsupportedQueryException(query); } MatchQuery<String,String> matchQuery = (MatchQuery<String, String>)query; if (matchQuery.getMatchMap().isEmpty()) { throw new UnsupportedQueryException(query); } SimpleMatchQuery<String, String> simpleMatchQuery = toSimpleMatchQuery(matchQuery); Index index = initCtx.getDynamoDBIndex(simpleMatchQuery.getKey()); if (index != null) { // Query via GSI ItemCollection<QueryOutcome> items = index.query(toQuerySpec(simpleMatchQuery)); items.forEach(item -> consumer.accept(initCtx.getDynamoDBItemTransformer().toInfinispanEntry(item))); } else { // Fall back to scan with filter expression ItemCollection<ScanOutcome> scanOutcome = initCtx.getDynamoDBTable().scan(toScanSpec(simpleMatchQuery)); scanOutcome.forEach(item -> consumer.accept(initCtx.getDynamoDBItemTransformer().toInfinispanEntry(item))); } } }
final Table table = getTable(); final String indexName = getIndexName(); retry: for (;;) { TableDescription desc = table.waitForActive();
@Override protected ItemCollection<ScanOutcome> doScan(ScanSpec spec) { spec.getRequest().setIndexName(index.getIndexName()); return super.doScan(spec); } }
public IndexQueryImpl(AmazonDynamoDB client, Index index) { super(client, index.getTable()); this.index = index; }
private static PageIterable<Item, QueryOutcome> queryGSI(String appid, Pager p) { Pager pager = (p != null) ? p : new Pager(); Index index = getSharedIndex(); QuerySpec spec = new QuerySpec(). withMaxPageSize(pager.getLimit()). withMaxResultSize(pager.getLimit()). withKeyConditionExpression(Config._APPID + " = :aid"). withValueMap(new ValueMap().withString(":aid", appid)); if (!StringUtils.isBlank(pager.getLastKey())) { spec = spec.withExclusiveStartKey(new KeyAttribute(Config._APPID, appid), // HASH/PARTITION KEY new KeyAttribute(Config._ID, pager.getLastKey()), // RANGE/SORT KEY new KeyAttribute(Config._KEY, getKeyForAppid(pager.getLastKey(), appid))); // TABLE PRIMARY KEY } return index != null ? index.query(spec).pages() : null; }
final String indexName = getIndexName(); retry: for (;;) { final TableDescription desc = getTable().waitForActive(); List<GlobalSecondaryIndexDescription> list = desc.getGlobalSecondaryIndexes(); if (list != null) {
private static PageIterable<Item, QueryOutcome> queryGSI(String appid, Pager p) { Pager pager = (p != null) ? p : new Pager(); Index index = getSharedIndex(); QuerySpec spec = new QuerySpec(). withMaxPageSize(pager.getLimit()). withMaxResultSize(pager.getLimit()). withKeyConditionExpression(Config._APPID + " = :aid"). withValueMap(new ValueMap().withString(":aid", appid)); if (!StringUtils.isBlank(pager.getLastKey())) { spec = spec.withExclusiveStartKey(new KeyAttribute(Config._APPID, appid), // HASH/PARTITION KEY new KeyAttribute(Config._ID, pager.getLastKey()), // RANGE/SORT KEY new KeyAttribute(Config._KEY, getKeyForAppid(pager.getLastKey(), appid))); // TABLE PRIMARY KEY } return index != null ? index.query(spec).pages() : null; }