fix disabled methods after autodetector
This commit is contained in:
@@ -65,4 +65,8 @@ interface CallMethods {
|
|||||||
* Returns list of methods conforming the methods group
|
* Returns list of methods conforming the methods group
|
||||||
*/
|
*/
|
||||||
fun getGroupMethods(groupName: String): Set<String>
|
fun getGroupMethods(groupName: String): Set<String>
|
||||||
|
|
||||||
|
fun getDisabledMethods(): Set<String> {
|
||||||
|
return setOf()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ class ManagedCallMethods(
|
|||||||
private val allAllowed: Set<String> = Collections.unmodifiableSet(
|
private val allAllowed: Set<String> = Collections.unmodifiableSet(
|
||||||
delegated.keys + allGroupEnabled - allGroupDisabled.toSet() + enabled - disabled,
|
delegated.keys + allGroupEnabled - allGroupDisabled.toSet() + enabled - disabled,
|
||||||
)
|
)
|
||||||
|
private val allDisabled: Set<String> = Collections.unmodifiableSet(
|
||||||
|
allGroupDisabled.toSet() + disabled
|
||||||
|
)
|
||||||
private val quorum: MutableMap<String, Factory<CallQuorum>> = HashMap()
|
private val quorum: MutableMap<String, Factory<CallQuorum>> = HashMap()
|
||||||
private val staticResponse: MutableMap<String, String> = HashMap()
|
private val staticResponse: MutableMap<String, String> = HashMap()
|
||||||
|
|
||||||
@@ -101,6 +104,10 @@ class ManagedCallMethods(
|
|||||||
return allAllowed
|
return allAllowed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getDisabledMethods(): Set<String> {
|
||||||
|
return allDisabled
|
||||||
|
}
|
||||||
|
|
||||||
override fun isHardcoded(method: String): Boolean {
|
override fun isHardcoded(method: String): Boolean {
|
||||||
return this.staticResponse.containsKey(method) || delegate.isHardcoded(method)
|
return this.staticResponse.containsKey(method) || delegate.isHardcoded(method)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -296,6 +296,7 @@ open class GenericUpstream(
|
|||||||
if (config.methods == null) {
|
if (config.methods == null) {
|
||||||
config.methods = UpstreamsConfig.Methods(mutableSetOf(), mutableSetOf())
|
config.methods = UpstreamsConfig.Methods(mutableSetOf(), mutableSetOf())
|
||||||
}
|
}
|
||||||
|
val allDisabled = getMethods().getDisabledMethods()
|
||||||
val enableMethods =
|
val enableMethods =
|
||||||
rpcDetector
|
rpcDetector
|
||||||
.filter { (_, enabled) -> enabled }
|
.filter { (_, enabled) -> enabled }
|
||||||
@@ -312,6 +313,7 @@ open class GenericUpstream(
|
|||||||
UpstreamsConfig.Methods(
|
UpstreamsConfig.Methods(
|
||||||
enableMethods
|
enableMethods
|
||||||
.minus(disableMethods)
|
.minus(disableMethods)
|
||||||
|
.filter { !allDisabled.contains(it.name) }.toSet()
|
||||||
.plus(config.methods!!.enabled),
|
.plus(config.methods!!.enabled),
|
||||||
disableMethods
|
disableMethods
|
||||||
.minus(enableMethods)
|
.minus(enableMethods)
|
||||||
|
|||||||
Reference in New Issue
Block a user