Add AbstractDynamoDbStore#scan

This commit is contained in:
Chris Eager 2021-06-04 13:17:31 -05:00 committed by Chris Eager
parent ae97c4db9f
commit fc1541591a
1 changed files with 9 additions and 0 deletions

View File

@ -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) {
final List<T> batch = new ArrayList<>(DYNAMO_DB_MAX_BATCH_SIZE);