Created
February 26, 2018 18:40
-
-
Save maxpospischil/ffd7ebb452a7eb5518232b0d64eb098a to your computer and use it in GitHub Desktop.
Strongly consistent local secondary index query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private def recordsQuery = | |
ScanamoOps.query( | |
ScanamoQueryRequest( | |
tableName, | |
Some("incomplete_index"), | |
'pkey -> s"$uuid.${schema.id}", | |
new ScanamoQueryOptions(consistent = true, limit = Some(concurrencyLimit), None, None) | |
) | |
).map { | |
_.getItems.asScala.map { r => | |
DynamoFormat[BatchRecord].read(new AttributeValue().withM(r)) | |
}.toSet | |
} | |
def nextRecords: Task[Set[BatchRecord]] = Task { | |
Scanamo.exec(client)(recordsQuery).collect { | |
case Right(r) => r | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment