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

Commit

Permalink
Rename GraphQLRPC to just GraphQL (#1472)
Browse files Browse the repository at this point in the history
In most places the RPC gets dropped.  In a few places it made more sense
to rename to GraphQLHttp when we are talking about the HTTP Server and
service.
  • Loading branch information
Danno Ferrin authored May 21, 2019
1 parent e1052a7 commit 4c13bf4
Show file tree
Hide file tree
Showing 106 changed files with 347 additions and 352 deletions.
2 changes: 1 addition & 1 deletion acceptance-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies {
testImplementation project(':ethereum:core')
testImplementation project(path: ':ethereum:core', configuration: 'testSupportArtifacts')
testImplementation project(':ethereum:eth')
testImplementation project(':ethereum:graphqlrpc')
testImplementation project(':ethereum:graphql')
testImplementation project(':ethereum:jsonrpc')
testImplementation project(':ethereum:permissioning')
testImplementation project(':ethereum:rlp')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import tech.pegasys.pantheon.ethereum.eth.EthereumWireProtocolConfiguration;
import tech.pegasys.pantheon.ethereum.eth.sync.SynchronizerConfiguration;
import tech.pegasys.pantheon.ethereum.eth.transactions.PendingTransactions;
import tech.pegasys.pantheon.ethereum.graphqlrpc.GraphQLRpcConfiguration;
import tech.pegasys.pantheon.ethereum.graphql.GraphQLConfiguration;
import tech.pegasys.pantheon.metrics.MetricsSystem;
import tech.pegasys.pantheon.metrics.noop.NoOpMetricsSystem;
import tech.pegasys.pantheon.services.kvstore.RocksDbConfiguration;
Expand Down Expand Up @@ -110,7 +110,7 @@ public void startNode(final PantheonNode node) {
.metricsSystem(noOpMetricsSystem)
.metricsConfiguration(node.metricsConfiguration())
.p2pEnabled(node.isP2pEnabled())
.graphQLRpcConfiguration(GraphQLRpcConfiguration.createDefault())
.graphQLConfiguration(GraphQLConfiguration.createDefault())
.build();

runner.start();
Expand Down
2 changes: 1 addition & 1 deletion docs/Reference/Pantheon-API-Methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ None

!!! note
Methods with an equivalent [GraphQL](../Pantheon-API/GraphQL.md) query include a GraphQL request and result in the method example.
The parameter and result descriptions apply to the JSON-RPC requests. The GraphQL specification is defined in the [schema](https://github.com/PegaSysEng/pantheon/blob/master/ethereum/graphqlrpc/src/main/resources/schema.graphqls).
The parameter and result descriptions apply to the JSON-RPC requests. The GraphQL specification is defined in the [schema](https://github.com/PegaSysEng/pantheon/blob/master/ethereum/graphql/src/main/resources/schema.graphqls).

### eth_syncing

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
apply plugin: 'java-library'

jar {
baseName 'pantheon-graphql-rpc'
baseName 'pantheon-graphql'
manifest {
attributes(
'Specification-Title': baseName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package tech.pegasys.pantheon.ethereum.graphqlrpc;
package tech.pegasys.pantheon.ethereum.graphql;

import static com.google.common.base.Preconditions.checkNotNull;

Expand All @@ -22,25 +22,25 @@

import com.google.common.base.MoreObjects;

public class GraphQLRpcConfiguration {
private static final String DEFAULT_GRAPHQL_RPC_HOST = "127.0.0.1";
public static final int DEFAULT_GRAPHQL_RPC_PORT = 8547;
public class GraphQLConfiguration {
private static final String DEFAULT_GRAPHQL_HTTP_HOST = "127.0.0.1";
public static final int DEFAULT_GRAPHQL_HTTP_PORT = 8547;

private boolean enabled;
private int port;
private String host;
private List<String> corsAllowedDomains = Collections.emptyList();
private List<String> hostsWhitelist = Arrays.asList("localhost", "127.0.0.1");

public static GraphQLRpcConfiguration createDefault() {
final GraphQLRpcConfiguration config = new GraphQLRpcConfiguration();
public static GraphQLConfiguration createDefault() {
final GraphQLConfiguration config = new GraphQLConfiguration();
config.setEnabled(false);
config.setPort(DEFAULT_GRAPHQL_RPC_PORT);
config.setHost(DEFAULT_GRAPHQL_RPC_HOST);
config.setPort(DEFAULT_GRAPHQL_HTTP_PORT);
config.setHost(DEFAULT_GRAPHQL_HTTP_HOST);
return config;
}

private GraphQLRpcConfiguration() {}
private GraphQLConfiguration() {}

public boolean isEnabled() {
return enabled;
Expand Down Expand Up @@ -103,7 +103,7 @@ public boolean equals(final Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
}
final GraphQLRpcConfiguration that = (GraphQLRpcConfiguration) o;
final GraphQLConfiguration that = (GraphQLConfiguration) o;
return enabled == that.enabled
&& port == that.port
&& Objects.equals(host, that.host)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package tech.pegasys.pantheon.ethereum.graphqlrpc;
package tech.pegasys.pantheon.ethereum.graphql;

import tech.pegasys.pantheon.ethereum.blockcreation.MiningCoordinator;
import tech.pegasys.pantheon.ethereum.chain.Blockchain;
import tech.pegasys.pantheon.ethereum.core.Synchronizer;
import tech.pegasys.pantheon.ethereum.eth.transactions.TransactionPool;
import tech.pegasys.pantheon.ethereum.graphqlrpc.internal.BlockchainQuery;
import tech.pegasys.pantheon.ethereum.graphql.internal.BlockchainQuery;
import tech.pegasys.pantheon.ethereum.mainnet.ProtocolSchedule;
import tech.pegasys.pantheon.ethereum.worldstate.WorldStateArchive;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package tech.pegasys.pantheon.ethereum.graphqlrpc;
package tech.pegasys.pantheon.ethereum.graphql;

import static com.google.common.base.Preconditions.checkArgument;

Expand All @@ -24,15 +24,15 @@
import tech.pegasys.pantheon.ethereum.core.WorldState;
import tech.pegasys.pantheon.ethereum.eth.EthProtocol;
import tech.pegasys.pantheon.ethereum.eth.transactions.TransactionPool;
import tech.pegasys.pantheon.ethereum.graphqlrpc.internal.BlockWithMetadata;
import tech.pegasys.pantheon.ethereum.graphqlrpc.internal.BlockchainQuery;
import tech.pegasys.pantheon.ethereum.graphqlrpc.internal.TransactionWithMetadata;
import tech.pegasys.pantheon.ethereum.graphqlrpc.internal.pojoadapter.AccountAdapter;
import tech.pegasys.pantheon.ethereum.graphqlrpc.internal.pojoadapter.NormalBlockAdapter;
import tech.pegasys.pantheon.ethereum.graphqlrpc.internal.pojoadapter.PendingStateAdapter;
import tech.pegasys.pantheon.ethereum.graphqlrpc.internal.pojoadapter.SyncStateAdapter;
import tech.pegasys.pantheon.ethereum.graphqlrpc.internal.pojoadapter.TransactionAdapter;
import tech.pegasys.pantheon.ethereum.graphqlrpc.internal.response.GraphQLRpcError;
import tech.pegasys.pantheon.ethereum.graphql.internal.BlockWithMetadata;
import tech.pegasys.pantheon.ethereum.graphql.internal.BlockchainQuery;
import tech.pegasys.pantheon.ethereum.graphql.internal.TransactionWithMetadata;
import tech.pegasys.pantheon.ethereum.graphql.internal.pojoadapter.AccountAdapter;
import tech.pegasys.pantheon.ethereum.graphql.internal.pojoadapter.NormalBlockAdapter;
import tech.pegasys.pantheon.ethereum.graphql.internal.pojoadapter.PendingStateAdapter;
import tech.pegasys.pantheon.ethereum.graphql.internal.pojoadapter.SyncStateAdapter;
import tech.pegasys.pantheon.ethereum.graphql.internal.pojoadapter.TransactionAdapter;
import tech.pegasys.pantheon.ethereum.graphql.internal.response.GraphQLError;
import tech.pegasys.pantheon.ethereum.mainnet.TransactionValidator.TransactionInvalidReason;
import tech.pegasys.pantheon.ethereum.mainnet.ValidationResult;
import tech.pegasys.pantheon.ethereum.p2p.wire.Capability;
Expand Down Expand Up @@ -80,9 +80,9 @@ DataFetcher<Optional<Bytes32>> getSendRawTransactionDataFetcher() {
return Optional.of(transaction.hash());
}
} catch (final IllegalArgumentException | RLPException e) {
throw new GraphQLRpcException(GraphQLRpcError.INVALID_PARAMS);
throw new GraphQLException(GraphQLError.INVALID_PARAMS);
}
throw new GraphQLRpcException(GraphQLRpcError.INVALID_PARAMS);
throw new GraphQLException(GraphQLError.INVALID_PARAMS);
};
}

Expand Down Expand Up @@ -126,7 +126,7 @@ DataFetcher<List<NormalBlockAdapter>> getRangeBlockDataFetcher() {
to = blockchainQuery.latestBlock().map(block -> block.getHeader().getNumber()).orElse(0L);
}
if (from > to) {
throw new GraphQLRpcException(GraphQLRpcError.INVALID_PARAMS);
throw new GraphQLException(GraphQLError.INVALID_PARAMS);
}

final List<NormalBlockAdapter> results = new ArrayList<>();
Expand All @@ -147,7 +147,7 @@ public DataFetcher<Optional<NormalBlockAdapter>> getBlockDataFetcher() {
final Long number = dataFetchingEnvironment.getArgument("number");
final Bytes32 hash = dataFetchingEnvironment.getArgument("hash");
if ((number != null) && (hash != null)) {
throw new GraphQLRpcException(GraphQLRpcError.INVALID_PARAMS);
throw new GraphQLException(GraphQLError.INVALID_PARAMS);
}

final Optional<BlockWithMetadata<TransactionWithMetadata, Hash>> block;
Expand Down Expand Up @@ -176,10 +176,10 @@ DataFetcher<Optional<AccountAdapter>> getAccountDataFetcher() {
return Optional.of(new AccountAdapter(account));
} else if (bn > blockchainQuery.getBlockchain().getChainHeadBlockNumber()) {
// block is past chainhead
throw new GraphQLRpcException(GraphQLRpcError.INVALID_PARAMS);
throw new GraphQLException(GraphQLError.INVALID_PARAMS);
} else {
// we don't have that block
throw new GraphQLRpcException(GraphQLRpcError.CHAIN_HEAD_WORLD_STATE_NOT_AVAILABLE);
throw new GraphQLException(GraphQLError.CHAIN_HEAD_WORLD_STATE_NOT_AVAILABLE);
}
} else {
// return account on latest block
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,21 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package tech.pegasys.pantheon.ethereum.graphqlrpc;
package tech.pegasys.pantheon.ethereum.graphql;

import tech.pegasys.pantheon.ethereum.graphqlrpc.internal.response.GraphQLRpcError;
import tech.pegasys.pantheon.ethereum.graphql.internal.response.GraphQLError;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import graphql.ErrorType;
import graphql.GraphQLError;
import graphql.language.SourceLocation;

class GraphQLRpcException extends RuntimeException implements GraphQLError {
private final GraphQLRpcError error;
class GraphQLException extends RuntimeException implements graphql.GraphQLError {
private final GraphQLError error;

GraphQLRpcException(final GraphQLRpcError error) {
GraphQLException(final GraphQLError error) {

super(error.getMessage());

Expand Down
Loading

0 comments on commit 4c13bf4

Please sign in to comment.