-
Notifications
You must be signed in to change notification settings - Fork 130
PAN-2485#Add net_services json rpc endpoint #1295
PAN-2485#Add net_services json rpc endpoint #1295
Conversation
Implemented a JSON RPC method "net_services" that takes no input parameter and returns an object containing a list of enabled services (jsonrpc, p2p, ws, metrics) with "host" and "port", as show below; { "id":1, "jsonrpc": "2.0", "result": { "jsonrpc": {"host": "127.0.0.1", "port":3000}, "p2p":{"host": "127.0.0.1", "port":3000}, "ws":{"host": "127.0.0.1", "port":3000}, "metrics":{"host": "127.0.0.1", "port":3000} } } In case a service is not enabled, that will not be included in the list; { "id":1, "jsonrpc": "2.0", "result": {} }
createServiceDetailsMap(metricsConfiguration.getHost(), metricsConfiguration.getPort())); | ||
} | ||
|
||
services = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use an ImmutalbeMap.Builder instead of filling a mutable map and copying it into an ImmutableMap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once the ImmutableMap in the NetServices constructor is fixed I can merge this.
import com.google.common.collect.ImmutableMap; | ||
import com.google.common.collect.ImmutableMap.Builder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This causes ErrorProne to throw an error. Please use ImmutableMap.Builder instead of importing the inner class.
https://jenkins.pegasys.tech/job/Pantheon/job/PR-1295/2/execution/node/59/log/
https://errorprone.info/bugpattern/BadImport
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I have changed it and performed these gradle task aswell locally; (spotlessApply clean check test). I hope there are no more errors :)
Implemented a JSON RPC method "net_services" that takes no input parameter and returns an object containing a list of enabled services (jsonrpc, p2p, ws, metrics) with "host" and "port", as show below; { "id":1, "jsonrpc": "2.0", "result": { "jsonrpc": {"host": "127.0.0.1", "port":3000}, "p2p":{"host": "127.0.0.1", "port":3000}, "ws":{"host": "127.0.0.1", "port":3000}, "metrics":{"host": "127.0.0.1", "port":3000} } } In case a service is not enabled, that will not be included in the list; { "id":1, "jsonrpc": "2.0", "result": {} } Fixes PAN-2485
Implemented a JSON RPC method "net_services" that takes no input parameter and returns an object containing a list of enabled services (jsonrpc, p2p, ws, metrics) with "host" and "port", as show below; { "id":1, "jsonrpc": "2.0", "result": { "jsonrpc": {"host": "127.0.0.1", "port":3000}, "p2p":{"host": "127.0.0.1", "port":3000}, "ws":{"host": "127.0.0.1", "port":3000}, "metrics":{"host": "127.0.0.1", "port":3000} } } In case a service is not enabled, that will not be included in the list; { "id":1, "jsonrpc": "2.0", "result": {} } Fixes PAN-2485
PR description
Implemented a JSON RPC method "net_services" that takes no input
parameter and returns an object
containing a list of enabled services (jsonrpc, p2p, ws, metrics) with
"host" and "port", as show below;
{
"id":1,
"jsonrpc": "2.0",
"result": {
"jsonrpc": {"host": "127.0.0.1", "port":3000},
"p2p":{"host": "127.0.0.1", "port":3000},
"ws":{"host": "127.0.0.1", "port":3000},
"metrics":{"host": "127.0.0.1", "port":3000}
}
}
In case a service is not enabled, that will not be included in the list;
{
"id":1,
"jsonrpc": "2.0",
"result": {}
}
**This PR includes all the changes requested by reviewer in the PR# 1269 (closed uncommitted)