solution: select which kind of upstream to use for native call

This commit is contained in:
Igor Artamonov
2019-08-02 23:46:58 -04:00
parent 2c5551d818
commit 22c2294983
19 changed files with 607 additions and 94 deletions

View File

@@ -1,6 +1,5 @@
package io.emeraldpay.dshackle.upstream
import io.emeraldpay.dshackle.config.UpstreamsConfig
import io.emeraldpay.grpc.Chain
import org.slf4j.LoggerFactory
import java.io.Closeable
@@ -44,16 +43,16 @@ class ChainUpstreams (
head = updateHead()
}
override fun getApis(quorum: Int): Iterator<EthereumApi> {
override fun getApis(quorum: Int, matcher: Selector.Matcher): Iterator<EthereumApi> {
val i = seq++
if (seq >= Int.MAX_VALUE / 2) {
seq = 0
}
return QuorumApi(upstreams, 1, seq)
return FilteringApiIterator(upstreams, 1, seq, matcher)
}
override fun getApi(): EthereumApi {
return getApis(1).next()
override fun getApi(matcher: Selector.Matcher): EthereumApi {
return getApis(1, matcher).next()
}
override fun getHead(): EthereumHead {