Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

PAN-2485#Add net_services json rpc endpoint #1295

Merged
merged 4 commits into from
Apr 17, 2019

Conversation

usmananwar
Copy link
Contributor

@usmananwar usmananwar commented Apr 17, 2019

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)

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 =
Copy link
Contributor

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

Copy link
Contributor

@shemnon shemnon left a 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;
Copy link
Contributor

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

Copy link
Contributor Author

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 :)

@shemnon shemnon merged commit d5dd1d4 into PegaSysEng:master Apr 17, 2019
notlesh pushed a commit to notlesh/pantheon that referenced this pull request Apr 24, 2019
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
notlesh pushed a commit to notlesh/pantheon that referenced this pull request May 4, 2019
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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants