Fix Blockchain Plugin service javadoc (#5250)

Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
pull/5252/head
Gabriel-Trintinalia 2 years ago committed by GitHub
parent c55d810321
commit 8ab19bfff8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      besu/src/main/java/org/hyperledger/besu/services/BlockchainServiceImpl.java
  2. 2
      plugin-api/build.gradle
  3. 7
      plugin-api/src/main/java/org/hyperledger/besu/plugin/services/BlockchainService.java
  4. 20
      plugin-api/src/main/java/org/hyperledger/besu/plugin/services/exception/PluginRpcEndpointException.java

@ -24,14 +24,26 @@ import org.hyperledger.besu.plugin.services.BlockchainService;
import java.util.Optional;
import java.util.function.Supplier;
/** The Blockchain service implementation. */
public class BlockchainServiceImpl implements BlockchainService {
private final Blockchain blockchain;
/**
* Instantiates a new Blockchain service.
*
* @param blockchain the blockchain
*/
public BlockchainServiceImpl(final Blockchain blockchain) {
this.blockchain = blockchain;
}
/**
* Gets block by number
*
* @param number the block number
* @return the BlockContext if block exists otherwise empty
*/
@Override
public Optional<BlockContext> getBlockByNumber(final long number) {
return blockchain

@ -67,7 +67,7 @@ Calculated : ${currentHash}
tasks.register('checkAPIChanges', FileStateChecker) {
description = "Checks that the API for the Plugin-API project does not change without deliberate thought"
files = sourceSets.main.allJava.files
knownHash = '9FHwr8juEGZBU6+nCdHINFIJO7fetydF4AhMZzkOxIs='
knownHash = 'VFMEmmE/7EyfKVpNhcK7KxMn0s5muPP4lorhW5iTuxo='
}
check.dependsOn('checkAPIChanges')

@ -18,6 +18,13 @@ import org.hyperledger.besu.plugin.data.BlockContext;
import java.util.Optional;
/** A service that plugins can use to query blocks by number */
public interface BlockchainService extends BesuService {
/**
* Gets block by number
*
* @param number the block number
* @return the BlockContext
*/
Optional<BlockContext> getBlockByNumber(final long number);
}

@ -14,12 +14,28 @@
*/
package org.hyperledger.besu.plugin.services.exception;
/** Base exception class for problems encountered in the RpcEndpointService. */
public class PluginRpcEndpointException extends RuntimeException {
/**
* Constructs a new PluginRpcEndpointException exception with the specified message.
*
* @param message the detail message (which is saved for later retrieval by the {@link
* #getMessage()} method).
*/
public PluginRpcEndpointException(final String message) {
super(message);
}
public PluginRpcEndpointException(final String message, final Throwable throwable) {
super(message, throwable);
/**
* Constructs a new PluginRpcEndpointException exception with the specified message.
*
* @param message the detail message (which is saved for later retrieval by the {@link
* #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method).
* (A {@code null} value is permitted, and indicates that the cause is nonexistent or
* unknown.)
*/
public PluginRpcEndpointException(final String message, final Throwable cause) {
super(message, cause);
}
}

Loading…
Cancel
Save