@@ -853,24 +853,6 @@ class HttpScanHandler(
853853 )
854854 }
855855
856- override def getUpdateByIdV2 (respond : ScanResource .GetUpdateByIdV2Response .type )(
857- updateId : String ,
858- damlValueEncoding : Option [DamlValueEncoding ],
859- )(extracted : TraceContext ): Future [ScanResource .GetUpdateByIdV2Response ] = {
860- getUpdateById(
861- updateId = updateId,
862- encoding = damlValueEncoding.getOrElse(definitions.DamlValueEncoding .members.CompactJson ),
863- consistentResponses = true ,
864- extracted,
865- )
866- .map {
867- case Left (error) =>
868- ScanResource .GetUpdateByIdV2Response .NotFound (error)
869- case Right (update) =>
870- ScanResource .GetUpdateByIdV2Response .OK (toUpdateV2(update))
871- }
872- }
873-
874856 override def listActivity (
875857 respond : v0.ScanResource .ListActivityResponse .type
876858 )(
@@ -1484,24 +1466,22 @@ class HttpScanHandler(
14841466 extracted : TraceContext ,
14851467 ): Future [Either [definitions.ErrorResponse , definitions.UpdateHistoryItem ]] = {
14861468 implicit val tc = extracted
1487- withSpan(s " $workflowId.getUpdateById " ) { _ => _ =>
1488- for {
1489- tx <- store.updateHistory.getUpdate(updateId)
1490- } yield {
1491- tx.fold[Either [definitions.ErrorResponse , definitions.UpdateHistoryItem ]](
1492- Left (
1493- definitions.ErrorResponse (s " Transaction with id $updateId not found " )
1494- )
1495- )(txWithMigration =>
1496- Right (
1497- ScanHttpEncodings .encodeUpdate(
1498- txWithMigration,
1499- encoding = encoding,
1500- version = if (consistentResponses) ScanHttpEncodings .V1 else ScanHttpEncodings .V0 ,
1501- )
1469+ for {
1470+ tx <- store.updateHistory.getUpdate(updateId)
1471+ } yield {
1472+ tx.fold[Either [definitions.ErrorResponse , definitions.UpdateHistoryItem ]](
1473+ Left (
1474+ definitions.ErrorResponse (s " Transaction with id $updateId not found " )
1475+ )
1476+ )(txWithMigration =>
1477+ Right (
1478+ ScanHttpEncodings .encodeUpdate(
1479+ txWithMigration,
1480+ encoding = encoding,
1481+ version = if (consistentResponses) ScanHttpEncodings .V1 else ScanHttpEncodings .V0 ,
15021482 )
15031483 )
1504- }
1484+ )
15051485 }
15061486 }
15071487
@@ -1510,37 +1490,70 @@ class HttpScanHandler(
15101490 )(updateId : String , lossless : Option [Boolean ])(
15111491 extracted : TraceContext
15121492 ): Future [ScanResource .GetUpdateByIdResponse ] = {
1513- val encoding = if (lossless.getOrElse(false )) {
1514- definitions.DamlValueEncoding .ProtobufJson
1515- } else {
1516- definitions.DamlValueEncoding .CompactJson
1517- }
1518- getUpdateById(updateId = updateId, encoding = encoding, consistentResponses = false , extracted)
1519- .map {
1520- case Left (error) =>
1521- ScanResource .GetUpdateByIdResponse .NotFound (error)
1522- case Right (update) =>
1523- ScanResource .GetUpdateByIdResponse .OK (update)
1493+ implicit val tc = extracted
1494+ // in openAPI the operationID for /v0/updates/{update_id} is `getUpdateById`, logging as `getUpdateByIdV0` for clarity
1495+ withSpan(s " $workflowId.getUpdateByIdV0 " ) { _ => _ =>
1496+ val encoding = if (lossless.getOrElse(false )) {
1497+ definitions.DamlValueEncoding .ProtobufJson
1498+ } else {
1499+ definitions.DamlValueEncoding .CompactJson
15241500 }
1501+ getUpdateById(
1502+ updateId = updateId,
1503+ encoding = encoding,
1504+ consistentResponses = false ,
1505+ extracted,
1506+ )
1507+ .map {
1508+ case Left (error) =>
1509+ ScanResource .GetUpdateByIdResponse .NotFound (error)
1510+ case Right (update) =>
1511+ ScanResource .GetUpdateByIdResponse .OK (update)
1512+ }
1513+ }
15251514 }
15261515
15271516 override def getUpdateByIdV1 (
15281517 respond : ScanResource .GetUpdateByIdV1Response .type
15291518 )(updateId : String , damlValueEncoding : Option [definitions.DamlValueEncoding ])(
15301519 extracted : TraceContext
15311520 ): Future [ScanResource .GetUpdateByIdV1Response ] = {
1532- getUpdateById(
1533- updateId = updateId,
1534- encoding = damlValueEncoding.getOrElse(definitions.DamlValueEncoding .members.CompactJson ),
1535- consistentResponses = true ,
1536- extracted,
1537- )
1538- .map {
1539- case Left (error) =>
1540- ScanResource .GetUpdateByIdV1Response .NotFound (error)
1541- case Right (update) =>
1542- ScanResource .GetUpdateByIdV1Response .OK (update)
1543- }
1521+ implicit val tc = extracted
1522+ withSpan(s " $workflowId.getUpdateByIdV1 " ) { _ => _ =>
1523+ getUpdateById(
1524+ updateId = updateId,
1525+ encoding = damlValueEncoding.getOrElse(definitions.DamlValueEncoding .members.CompactJson ),
1526+ consistentResponses = true ,
1527+ extracted,
1528+ )
1529+ .map {
1530+ case Left (error) =>
1531+ ScanResource .GetUpdateByIdV1Response .NotFound (error)
1532+ case Right (update) =>
1533+ ScanResource .GetUpdateByIdV1Response .OK (update)
1534+ }
1535+ }
1536+ }
1537+
1538+ override def getUpdateByIdV2 (respond : ScanResource .GetUpdateByIdV2Response .type )(
1539+ updateId : String ,
1540+ damlValueEncoding : Option [DamlValueEncoding ],
1541+ )(extracted : TraceContext ): Future [ScanResource .GetUpdateByIdV2Response ] = {
1542+ implicit val tc = extracted
1543+ withSpan(s " $workflowId.getUpdateByIdV2 " ) { _ => _ =>
1544+ getUpdateById(
1545+ updateId = updateId,
1546+ encoding = damlValueEncoding.getOrElse(definitions.DamlValueEncoding .members.CompactJson ),
1547+ consistentResponses = true ,
1548+ extracted,
1549+ )
1550+ .map {
1551+ case Left (error) =>
1552+ ScanResource .GetUpdateByIdV2Response .NotFound (error)
1553+ case Right (update) =>
1554+ ScanResource .GetUpdateByIdV2Response .OK (toUpdateV2(update))
1555+ }
1556+ }
15441557 }
15451558
15461559 private def ensureValidRange [T ](start : Long , end : Long , maxRounds : Int )(
0 commit comments