Add AbstractDynamoDbStore#scan

This commit is contained in:
Chris Eager authored and Chris Eager committed 2021-07-02 15:05:11 -05:00
1 parent ae97c4db9f
commit fc1541591a
1 file changed
+9
@@ -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);