Skip to content

Commit

Permalink
javadoc: Adding javadoc for ethstats module (#7269)
Browse files Browse the repository at this point in the history
* javadoc: Adding javadoc for ethstats module

---------

Signed-off-by: Usman Saleem <usman@usmans.info>
  • Loading branch information
usmansaleem authored Jun 27, 2024
1 parent 67637fa commit 77183f6
Show file tree
Hide file tree
Showing 18 changed files with 462 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private void createConsoleAppender() {
dim("%t"),
colorize("%-5level"),
dim("%c{1}"),
colorize("%msg%n%throwable")))
colorize("%msgc%n%throwable")))
.build();
final ConsoleAppender consoleAppender =
ConsoleAppender.newBuilder().setName("Console").setLayout(patternLayout).build();
Expand Down
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ allprojects {
// TODO: these are temporary disabled (ethereum and sub modules), it should be removed in a future PR.
'-org.hyperledger.besu.ethereum,' +
'-org.hyperledger.besu.ethereum.*,' +
'-org.hyperledger.besu.ethstats.*,' +
'-org.hyperledger.besu.evmtool',
true)
options.addStringOption('Xmaxerrs','65535')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@
import org.slf4j.LoggerFactory;

/**
* This class describes the behaviour of the EthStats service. This class is used to report pending
* transactions, blocks, and several node-related information to a netstats server.
* This class describes the behaviour of the EthStatsService. This class is used to report pending
* transactions, blocks, and several node-related information to an ethstats server.
*/
public class EthStatsService {

Expand Down Expand Up @@ -112,18 +112,18 @@ public class EthStatsService {
private long pingTimestamp;

/**
* Instantiates a new EthStats service.
* Instantiates a new EthStatsService.
*
* @param ethStatsConnectOptions the netstats url
* @param ethStatsConnectOptions the ethstats options
* @param blockchainQueries the blockchain queries
* @param protocolManager the protocol manager
* @param transactionPool the transaction pool
* @param miningCoordinator the mining coordinator
* @param syncState the sync state
* @param vertx the vertx
* @param syncState the SyncState
* @param vertx the vertx instance
* @param clientVersion the client version
* @param genesisConfigOptions the genesis config options
* @param p2PNetwork the p 2 p network
* @param p2PNetwork the p2p network
*/
public EthStatsService(
final EthStatsConnectOptions ethStatsConnectOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,37 @@
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.immutables.value.Value;

/**
* This interface represents the authentication data. It provides methods to get the id, info, and
* secret of the authentication data.
*/
@Value.Immutable
@JsonSerialize(as = ImmutableAuthenticationData.class)
@JsonDeserialize(as = ImmutableAuthenticationData.class)
@Value.Style(allParameters = true)
public interface AuthenticationData {

/**
* Gets the id of the authentication data.
*
* @return the id of the authentication data.
*/
@JsonProperty("id")
String getId();

/**
* Gets the info of the authentication data.
*
* @return the info of the authentication data.
*/
@JsonProperty("info")
NodeInfo getInfo();

/**
* Gets the secret of the authentication data.
*
* @return the secret of the authentication data.
*/
@JsonProperty("secret")
String getSecret();
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,102 @@
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.immutables.value.Value;

/**
* This interface represents the information of a node. It provides methods to get the name, node,
* port, network, protocol, api, os, os version, client, update history capability, and contact of
* the node.
*/
@Value.Immutable
@JsonSerialize(as = ImmutableNodeInfo.class)
@JsonDeserialize(as = ImmutableNodeInfo.class)
@Value.Style(allParameters = true)
public interface NodeInfo {

/**
* Gets the name of the node.
*
* @return the name of the node.
*/
@JsonProperty("name")
String getName();

/**
* Gets the node.
*
* @return the node.
*/
@JsonProperty("node")
String getNode();

/**
* Gets the port of the node.
*
* @return the port of the node.
*/
@JsonProperty("port")
String getPort();

/**
* Gets the network of the node.
*
* @return the network of the node.
*/
@JsonProperty("net")
String getNetwork();

/**
* Gets the protocol of the node.
*
* @return the protocol of the node.
*/
@JsonProperty("protocol")
String getProtocol();

/**
* Gets the api of the node.
*
* @return the api of the node.
*/
@JsonProperty("api")
String getApi();

/**
* Gets the operating system of the node.
*
* @return the operating system of the node.
*/
@JsonProperty("os")
String getOs();

/**
* Gets the operating system version of the node.
*
* @return the operating system version of the node.
*/
@JsonProperty("os_v")
String getOsVer();

/**
* Gets the client of the node.
*
* @return the client of the node.
*/
@JsonProperty("client")
String getClient();

/**
* Gets the update history capability of the node.
*
* @return the update history capability of the node.
*/
@JsonProperty("canUpdateHistory")
Boolean getCanUpdateHistory();

/**
* Gets the contact of the node.
*
* @return the contact of the node.
*/
@JsonProperty("contact")
String getContact();
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,29 @@
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.immutables.value.Value;

/**
* This interface represents a block report. It provides methods to get the id and block result of
* the block report.
*/
@Value.Immutable
@Value.Style(allParameters = true)
@JsonSerialize(as = ImmutableBlockReport.class)
@JsonDeserialize(as = ImmutableBlockReport.class)
public interface BlockReport {

/**
* Gets the id of the block report.
*
* @return the id of the block report.
*/
@JsonProperty("id")
String getId();

/**
* Gets the block result of the block report.
*
* @return the block result of the block report.
*/
@JsonProperty("block")
BlockResult getBlock();
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,29 @@
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.immutables.value.Value;

/**
* This interface represents a history report. It provides methods to get the id and history of the
* history report.
*/
@Value.Immutable
@Value.Style(allParameters = true)
@JsonSerialize(as = ImmutableHistoryReport.class)
@JsonDeserialize(as = ImmutableHistoryReport.class)
public interface HistoryReport {

/**
* Gets the id of the history report.
*
* @return the id of the history report.
*/
@JsonProperty(value = "id")
String getId();

/**
* Gets the block results of the history report.
*
* @return the list of block results of the history report.
*/
@JsonProperty("history")
List<BlockResult> getHistory();
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,29 @@
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.immutables.value.Value;

/**
* This interface represents a latency report. It provides methods to get the id and latency of the
* latency report.
*/
@Value.Immutable
@Value.Style(allParameters = true)
@JsonSerialize(as = ImmutableLatencyReport.class)
@JsonDeserialize(as = ImmutableLatencyReport.class)
public interface LatencyReport {

/**
* Gets the id of the latency report.
*
* @return the id of the latency report.
*/
@JsonProperty("id")
String getId();

/**
* Gets the latency of the latency report.
*
* @return the latency of the latency report.
*/
@JsonProperty("latency")
String getLatency();
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,92 @@
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.immutables.value.Value;

/**
* This interface represents a node stats report. It provides methods to get the id and stats of the
* node stats report.
*/
@Value.Immutable
@Value.Style(deepImmutablesDetection = true, depluralize = true)
@JsonSerialize(as = ImmutableNodeStatsReport.class)
@JsonDeserialize(as = ImmutableNodeStatsReport.class)
public interface NodeStatsReport {

/**
* Gets the id of the node stats report.
*
* @return the id of the node stats report.
*/
@JsonProperty("id")
String getId();

/**
* Gets the stats of the node stats report.
*
* @return the stats of the node stats report.
*/
@JsonProperty("stats")
NStats getStats();

/** This interface represents the stats of a node. */
@Value.Immutable
@Value.Style(allParameters = true)
@JsonSerialize(as = ImmutableNStats.class)
@JsonDeserialize(as = ImmutableNStats.class)
interface NStats {

/**
* Checks if the node is active.
*
* @return true if the node is active, false otherwise.
*/
@JsonProperty("active")
boolean isActive();

/**
* Checks if the node is mining.
*
* @return true if the node is mining, false otherwise.
*/
@JsonProperty("mining")
boolean isMining();

/**
* Gets the hashrate of the node.
*
* @return the hashrate of the node.
*/
@JsonProperty("hashrate")
long getHashrate();

/**
* Gets the number of peers of the node.
*
* @return the number of peers of the node.
*/
@JsonProperty("peers")
int getPeers();

/**
* Gets the gas price of the node.
*
* @return the gas price of the node.
*/
@JsonProperty("gasPrice")
long getGasPrice();

/**
* Checks if the node is syncing.
*
* @return true if the node is syncing, false otherwise.
*/
@JsonProperty("syncing")
boolean isSyncing();

/**
* Gets the uptime of the node.
*
* @return the uptime of the node.
*/
@JsonProperty("uptime")
int getUpTime();
}
Expand Down
Loading

0 comments on commit 77183f6

Please sign in to comment.