Add AbstractDynamoDbStore#scan
This commit is contained in:
parent
ae97c4db9f
commit
fc1541591a
|
@ -68,6 +68,15 @@ public class AbstractDynamoDbStore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected List<Map<String, AttributeValue>> scan(ScanRequest scanRequest, int max) {
|
||||||
|
|
||||||
|
return db().scanPaginator(scanRequest)
|
||||||
|
.items()
|
||||||
|
.stream()
|
||||||
|
.limit(max)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
static <T> void writeInBatches(final Iterable<T> items, final Consumer<List<T>> action) {
|
static <T> void writeInBatches(final Iterable<T> items, final Consumer<List<T>> action) {
|
||||||
final List<T> batch = new ArrayList<>(DYNAMO_DB_MAX_BATCH_SIZE);
|
final List<T> batch = new ArrayList<>(DYNAMO_DB_MAX_BATCH_SIZE);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue