solution: rename grpc target to method

This commit is contained in:
Igor Artamonov
2019-08-19 22:36:29 -04:00
parent 03ce6f74a5
commit a03325a619
8 changed files with 10 additions and 14 deletions

View File

@@ -3,8 +3,6 @@ package io.emeraldpay.dshackle.rpc
import io.emeraldpay.api.proto.BlockchainOuterClass
import io.emeraldpay.api.proto.Common
import io.emeraldpay.dshackle.upstream.*
import io.emeraldpay.grpc.Chain
import io.grpc.stub.StreamObserver
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service
import reactor.core.publisher.Mono
@@ -24,7 +22,7 @@ class Describe(
val targets = chainUpstreams.getSupportedTargets()
val chainDescription = BlockchainOuterClass.DescribeChain.newBuilder()
.setChain(Common.ChainRef.forNumber(chain.id))
.addAllSupportedTargets(targets)
.addAllSupportedMethods(targets)
.setStatus(status)
chainUpstreams.getAll().let { ups ->
ups.forEach { up ->

View File

@@ -80,7 +80,7 @@ class NativeCall(
val matcher = Selector.convertToMatcher(request.selector)
val apis = upstream.getApis(matcher)
return request.itemsList.toFlux().map {
val method = it.target
val method = it.method
val params = it.payload.toStringUtf8()
val callQuorum = upstream.targets?.getQuorumFor(method) ?: AlwaysQuorum()
callQuorum.init(upstream.getHead())

View File

@@ -89,8 +89,7 @@ class EthereumGrpcTransport(
val params = objectMapper.writeValueAsBytes(call.params)
val nativeCallItem = BlockchainOuterClass.NativeCallItem.newBuilder()
.setId(id)
.setMethod("POST")
.setTarget(call.method)
.setMethod(call.method)
.setPayload(ByteString.copyFrom(params))
.build()
req.addItems(nativeCallItem)

View File

@@ -112,7 +112,7 @@ open class GrpcUpstream(
}
fun init(conf: BlockchainOuterClass.DescribeChain) {
supportedMethods.addAll(conf.supportedTargetsList)
supportedMethods.addAll(conf.supportedMethodsList)
val nodes = NodeDetailsList()
conf.nodesList.forEach { node ->
val node = NodeDetailsList.NodeDetails(node.quorum,

View File

@@ -26,7 +26,6 @@ class UpstreamValidator(
}
return UpstreamAvailability.OK
} catch (e: Throwable) {
e.printStackTrace()
return UpstreamAvailability.UNAVAILABLE
}
}