mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-11 04:45:57 +03:00
Extract grpc statuses to separate module [KVL-1005] (#10582)
* Extract grpc statuses to separate module for reuse CHANGELOG_BEGIN CHANGELOG_END * Fix alphabetical order * Formatting
This commit is contained in:
parent
0ef894447f
commit
933b58e3aa
53
ledger/ledger-grpc/BUILD.bazel
Normal file
53
ledger/ledger-grpc/BUILD.bazel
Normal file
@ -0,0 +1,53 @@
|
||||
# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
load(
|
||||
"//bazel_tools:scala.bzl",
|
||||
"da_scala_library",
|
||||
"da_scala_test_suite",
|
||||
)
|
||||
|
||||
da_scala_library(
|
||||
name = "ledger-grpc",
|
||||
srcs = glob(["src/main/**/*.scala"]),
|
||||
resources = glob(["src/main/resources/**/*"]),
|
||||
tags = ["maven_coordinates=com.daml:ledger-grpc:__VERSION__"],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
exports = [
|
||||
],
|
||||
runtime_deps = [],
|
||||
deps = [
|
||||
"//language-support/scala/bindings",
|
||||
"//ledger-api/grpc-definitions:ledger_api_proto_scala",
|
||||
"//ledger/ledger-offset",
|
||||
"@maven//:com_google_protobuf_protobuf_java",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "sources",
|
||||
srcs = glob(["src/main/**/*.scala"]),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
da_scala_test_suite(
|
||||
name = "ledger-grpc-tests",
|
||||
size = "small",
|
||||
srcs = glob(["src/test/suite/**/*.scala"]),
|
||||
resources = glob(["src/test/resources/*"]),
|
||||
scala_deps = [
|
||||
"@maven//:org_scalatest_scalatest",
|
||||
"@maven//:org_scalaz_scalaz_core",
|
||||
"@maven//:org_scala_lang_modules_scala_collection_compat",
|
||||
"@maven//:org_scala_lang_modules_scala_java8_compat",
|
||||
],
|
||||
deps = [
|
||||
":ledger-grpc",
|
||||
"//daml-lf/data",
|
||||
"//ledger-api/grpc-definitions:ledger_api_proto_scala",
|
||||
"//ledger/ledger-offset",
|
||||
"@maven//:com_google_protobuf_protobuf_java",
|
||||
],
|
||||
)
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package com.daml.ledger.participant.state.v2
|
||||
package com.daml.ledger.grpc
|
||||
|
||||
import com.daml.ledger.offset.Offset
|
||||
import com.google.rpc.error_details.ErrorInfo
|
||||
@ -22,7 +22,7 @@ object GrpcStatuses {
|
||||
}
|
||||
}
|
||||
|
||||
def isDefiniteAnswer(errorInfo: ErrorInfo): Boolean =
|
||||
private def isDefiniteAnswer(errorInfo: ErrorInfo): Boolean =
|
||||
errorInfo.metadata.get(DefiniteAnswerKey).exists(value => java.lang.Boolean.valueOf(value))
|
||||
|
||||
def completeWithOffset(
|
@ -1,10 +1,10 @@
|
||||
// Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package com.daml.ledger.participant.state.v2
|
||||
package com.daml.ledger.grpc
|
||||
|
||||
import com.daml.ledger.grpc.GrpcStatuses.{CompletionOffsetKey, DefiniteAnswerKey}
|
||||
import com.daml.ledger.offset.Offset
|
||||
import com.daml.ledger.participant.state.v2.GrpcStatuses.{CompletionOffsetKey, DefiniteAnswerKey}
|
||||
import com.google.protobuf.any
|
||||
import com.google.rpc.error_details.{ErrorInfo, RequestInfo}
|
||||
import com.google.rpc.status.Status
|
@ -32,6 +32,7 @@ da_scala_library(
|
||||
"//ledger/ledger-api-health",
|
||||
"//ledger/ledger-configuration",
|
||||
"//ledger/ledger-configuration/protobuf:ledger_configuration_proto_java",
|
||||
"//ledger/ledger-grpc",
|
||||
"//ledger/ledger-offset",
|
||||
"//ledger/metrics",
|
||||
"//libs-scala/logging-entries",
|
||||
|
@ -7,6 +7,7 @@ import java.time.Duration
|
||||
|
||||
import com.daml.daml_lf_dev.DamlLf
|
||||
import com.daml.ledger.configuration.Configuration
|
||||
import com.daml.ledger.grpc.GrpcStatuses
|
||||
import com.daml.lf.data.Ref
|
||||
import com.daml.lf.data.Time.Timestamp
|
||||
import com.daml.lf.transaction.{BlindingInfo, CommittedTransaction}
|
||||
|
@ -135,6 +135,8 @@
|
||||
type: jar-lib
|
||||
- target: //ledger/ledger-configuration/protobuf:ledger_configuration_proto_java
|
||||
type: jar-proto
|
||||
- target: //ledger/ledger-grpc:ledger-grpc
|
||||
type: jar-scala
|
||||
- target: //ledger/ledger-offset:ledger-offset
|
||||
type: jar-scala
|
||||
- target: //ledger/ledger-on-memory:ledger-on-memory
|
||||
|
Loading…
Reference in New Issue
Block a user