Created
June 29, 2015 02:14
-
-
Save dbousamra/46bdd00666da83b465b1 to your computer and use it in GitHub Desktop.
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
| def getSnapshotForTable(key: SnapshotKey, tableName: TableName): Either[AmazonClientException, Option[Snapshot]] = ??? | |
| def getSnapshot(key: SnapshotKey): Either[AmazonClientException, Option[Snapshot]] = { | |
| val fallbackTableName = tableNameFactory.tableConfig.fallbackTableName.map(PrefixOnlyTableName(_, "")) | |
| val tableNames: List[TableName] = (List(Some(tableNameFactory.fromSnapshotKey(key))) :+ fallbackTableName).flatten | |
| val futures = Future.sequence(tableNames.map(tableName => { | |
| Future { getSnapshotForTable(key, tableName) } | |
| })) | |
| val results: List[Either[AmazonClientException, Option[Snapshot]]] = Await.result(futures, Duration.Inf) | |
| ????????????? | |
| How to take the first one that has a Some(snapshot), else the first Error? | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment