Repository: incubator-ratis Updated Branches: refs/heads/master 1185121ab -> b47ba4266
RATIS-213. Typo: ServerInformatonRequest. Contributed by Kit Hui. Project: http://git-wip-us.apache.org/repos/asf/incubator-ratis/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ratis/commit/b47ba426 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ratis/tree/b47ba426 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ratis/diff/b47ba426 Branch: refs/heads/master Commit: b47ba4266c1ecb308130530e4d34ad08e209924b Parents: 1185121 Author: Tsz-Wo Nicholas Sze <[email protected]> Authored: Thu Mar 22 08:46:34 2018 +0800 Committer: Tsz-Wo Nicholas Sze <[email protected]> Committed: Thu Mar 22 08:46:34 2018 +0800 ---------------------------------------------------------------------- .../ratis/client/impl/ClientProtoUtils.java | 6 ++-- .../ratis/client/impl/RaftClientImpl.java | 2 +- .../protocol/AdminAsynchronousProtocol.java | 2 +- .../apache/ratis/protocol/AdminProtocol.java | 2 +- .../protocol/ServerInformationRequest.java | 29 ++++++++++++++++++++ .../ratis/protocol/ServerInformatonRequest.java | 29 -------------------- .../apache/ratis/grpc/client/GrpcClientRpc.java | 4 +-- .../ratis/grpc/server/AdminProtocolService.java | 4 +-- ...nedClientProtocolClientSideTranslatorPB.java | 4 +-- ...nedClientProtocolServerSideTranslatorPB.java | 2 +- .../ratis/hadooprpc/client/HadoopClientRpc.java | 4 +-- .../ratis/netty/client/NettyClientRpc.java | 6 ++-- .../ratis/server/impl/RaftServerImpl.java | 2 +- .../ratis/server/impl/RaftServerProxy.java | 4 +-- .../server/simulation/SimulatedServerRpc.java | 4 +-- 15 files changed, 52 insertions(+), 52 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/b47ba426/ratis-client/src/main/java/org/apache/ratis/client/impl/ClientProtoUtils.java ---------------------------------------------------------------------- diff --git a/ratis-client/src/main/java/org/apache/ratis/client/impl/ClientProtoUtils.java b/ratis-client/src/main/java/org/apache/ratis/client/impl/ClientProtoUtils.java index 241f704..4d858e4 100644 --- a/ratis-client/src/main/java/org/apache/ratis/client/impl/ClientProtoUtils.java +++ b/ratis-client/src/main/java/org/apache/ratis/client/impl/ClientProtoUtils.java @@ -285,10 +285,10 @@ public interface ClientProtoUtils { ProtoUtils.toRaftGroup(p.getGroup())); } - static ServerInformatonRequest toServerInformationRequest( + static ServerInformationRequest toServerInformationRequest( ServerInformationRequestProto p) { final RaftRpcRequestProto m = p.getRpcRequest(); - return new ServerInformatonRequest( + return new ServerInformationRequest( ClientId.valueOf(m.getRequestorId()), RaftPeerId.valueOf(m.getReplyId()), ProtoUtils.toRaftGroupId(m.getRaftGroupId()), @@ -304,7 +304,7 @@ public interface ClientProtoUtils { } static ServerInformationRequestProto toServerInformationRequestProto( - ServerInformatonRequest request) { + ServerInformationRequest request) { return ServerInformationRequestProto.newBuilder() .setRpcRequest(toRaftRpcRequestProtoBuilder(request)) .build(); http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/b47ba426/ratis-client/src/main/java/org/apache/ratis/client/impl/RaftClientImpl.java ---------------------------------------------------------------------- diff --git a/ratis-client/src/main/java/org/apache/ratis/client/impl/RaftClientImpl.java b/ratis-client/src/main/java/org/apache/ratis/client/impl/RaftClientImpl.java index b7aae19..f0abb10 100644 --- a/ratis-client/src/main/java/org/apache/ratis/client/impl/RaftClientImpl.java +++ b/ratis-client/src/main/java/org/apache/ratis/client/impl/RaftClientImpl.java @@ -221,7 +221,7 @@ final class RaftClientImpl implements RaftClient { throws IOException { Objects.requireNonNull(server, "server == null"); - return sendRequest(new ServerInformatonRequest(clientId, server, + return sendRequest(new ServerInformationRequest(clientId, server, groupId, nextCallId())); } http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/b47ba426/ratis-common/src/main/java/org/apache/ratis/protocol/AdminAsynchronousProtocol.java ---------------------------------------------------------------------- diff --git a/ratis-common/src/main/java/org/apache/ratis/protocol/AdminAsynchronousProtocol.java b/ratis-common/src/main/java/org/apache/ratis/protocol/AdminAsynchronousProtocol.java index fd8444d..4907386 100644 --- a/ratis-common/src/main/java/org/apache/ratis/protocol/AdminAsynchronousProtocol.java +++ b/ratis-common/src/main/java/org/apache/ratis/protocol/AdminAsynchronousProtocol.java @@ -26,5 +26,5 @@ public interface AdminAsynchronousProtocol { ReinitializeRequest request) throws IOException; CompletableFuture<ServerInformationReply> getInfoAsync( - ServerInformatonRequest request) throws IOException; + ServerInformationRequest request) throws IOException; } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/b47ba426/ratis-common/src/main/java/org/apache/ratis/protocol/AdminProtocol.java ---------------------------------------------------------------------- diff --git a/ratis-common/src/main/java/org/apache/ratis/protocol/AdminProtocol.java b/ratis-common/src/main/java/org/apache/ratis/protocol/AdminProtocol.java index 6f81a8a..a480953 100644 --- a/ratis-common/src/main/java/org/apache/ratis/protocol/AdminProtocol.java +++ b/ratis-common/src/main/java/org/apache/ratis/protocol/AdminProtocol.java @@ -23,5 +23,5 @@ import java.io.IOException; public interface AdminProtocol { RaftClientReply reinitialize(ReinitializeRequest request) throws IOException; - ServerInformationReply getInfo(ServerInformatonRequest request) throws IOException; + ServerInformationReply getInfo(ServerInformationRequest request) throws IOException; } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/b47ba426/ratis-common/src/main/java/org/apache/ratis/protocol/ServerInformationRequest.java ---------------------------------------------------------------------- diff --git a/ratis-common/src/main/java/org/apache/ratis/protocol/ServerInformationRequest.java b/ratis-common/src/main/java/org/apache/ratis/protocol/ServerInformationRequest.java new file mode 100644 index 0000000..6259332 --- /dev/null +++ b/ratis-common/src/main/java/org/apache/ratis/protocol/ServerInformationRequest.java @@ -0,0 +1,29 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on 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 org.apache.ratis.protocol; + +/** + * Client sends this request to a server to request for the information about + * the server itself. + */ +public class ServerInformationRequest extends RaftClientRequest { + public ServerInformationRequest(ClientId clientId, RaftPeerId serverId, + RaftGroupId groupId, long callId) { + super(clientId, serverId, groupId, callId, 0L, null, RaftClientRequest.readRequestType()); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/b47ba426/ratis-common/src/main/java/org/apache/ratis/protocol/ServerInformatonRequest.java ---------------------------------------------------------------------- diff --git a/ratis-common/src/main/java/org/apache/ratis/protocol/ServerInformatonRequest.java b/ratis-common/src/main/java/org/apache/ratis/protocol/ServerInformatonRequest.java deleted file mode 100644 index 5e047af..0000000 --- a/ratis-common/src/main/java/org/apache/ratis/protocol/ServerInformatonRequest.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on 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 org.apache.ratis.protocol; - -/** - * Client sends this request to a server to request for the information about - * the server itself. - */ -public class ServerInformatonRequest extends RaftClientRequest { - public ServerInformatonRequest(ClientId clientId, RaftPeerId serverId, - RaftGroupId groupId, long callId) { - super(clientId, serverId, groupId, callId, 0L, null, RaftClientRequest.readRequestType()); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/b47ba426/ratis-grpc/src/main/java/org/apache/ratis/grpc/client/GrpcClientRpc.java ---------------------------------------------------------------------- diff --git a/ratis-grpc/src/main/java/org/apache/ratis/grpc/client/GrpcClientRpc.java b/ratis-grpc/src/main/java/org/apache/ratis/grpc/client/GrpcClientRpc.java index 513638a..6f1142e 100644 --- a/ratis-grpc/src/main/java/org/apache/ratis/grpc/client/GrpcClientRpc.java +++ b/ratis-grpc/src/main/java/org/apache/ratis/grpc/client/GrpcClientRpc.java @@ -80,9 +80,9 @@ public class GrpcClientRpc extends RaftClientRpcWithProxy<RaftClientProtocolClie SetConfigurationRequestProto setConf = toSetConfigurationRequestProto((SetConfigurationRequest) request); return toRaftClientReply(proxy.setConfiguration(setConf)); - } else if (request instanceof ServerInformatonRequest){ + } else if (request instanceof ServerInformationRequest){ RaftProtos.ServerInformationRequestProto proto = - toServerInformationRequestProto((ServerInformatonRequest) request); + toServerInformationRequestProto((ServerInformationRequest) request); return ClientProtoUtils.toServerInformationReply( proxy.serverInformation(proto)); } else { http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/b47ba426/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/AdminProtocolService.java ---------------------------------------------------------------------- diff --git a/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/AdminProtocolService.java b/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/AdminProtocolService.java index e4d169a..c7ba297 100644 --- a/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/AdminProtocolService.java +++ b/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/AdminProtocolService.java @@ -21,7 +21,7 @@ import org.apache.ratis.client.impl.ClientProtoUtils; import org.apache.ratis.grpc.RaftGrpcUtil; import org.apache.ratis.protocol.AdminAsynchronousProtocol; import org.apache.ratis.protocol.ReinitializeRequest; -import org.apache.ratis.protocol.ServerInformatonRequest; +import org.apache.ratis.protocol.ServerInformationRequest; import org.apache.ratis.shaded.io.grpc.stub.StreamObserver; import org.apache.ratis.shaded.proto.RaftProtos.RaftClientReplyProto; import org.apache.ratis.shaded.proto.RaftProtos.ReinitializeRequestProto; @@ -47,7 +47,7 @@ public class AdminProtocolService extends AdminProtocolServiceImplBase { @Override public void serverInformation(ServerInformationRequestProto proto, StreamObserver<ServerInformationReplyProto> responseObserver) { - final ServerInformatonRequest request = ClientProtoUtils.toServerInformationRequest(proto); + final ServerInformationRequest request = ClientProtoUtils.toServerInformationRequest(proto); RaftGrpcUtil.asyncCall(responseObserver, () -> protocol.getInfoAsync(request), ClientProtoUtils::toServerInformationReplyProto); } http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/b47ba426/ratis-hadoop/src/main/java/org/apache/ratis/hadooprpc/client/CombinedClientProtocolClientSideTranslatorPB.java ---------------------------------------------------------------------- diff --git a/ratis-hadoop/src/main/java/org/apache/ratis/hadooprpc/client/CombinedClientProtocolClientSideTranslatorPB.java b/ratis-hadoop/src/main/java/org/apache/ratis/hadooprpc/client/CombinedClientProtocolClientSideTranslatorPB.java index 9e5e7a8..c47a69b 100644 --- a/ratis-hadoop/src/main/java/org/apache/ratis/hadooprpc/client/CombinedClientProtocolClientSideTranslatorPB.java +++ b/ratis-hadoop/src/main/java/org/apache/ratis/hadooprpc/client/CombinedClientProtocolClientSideTranslatorPB.java @@ -24,7 +24,7 @@ import org.apache.ratis.hadooprpc.Proxy; import org.apache.ratis.protocol.RaftClientReply; import org.apache.ratis.protocol.RaftClientRequest; import org.apache.ratis.protocol.ReinitializeRequest; -import org.apache.ratis.protocol.ServerInformatonRequest; +import org.apache.ratis.protocol.ServerInformationRequest; import org.apache.ratis.protocol.ServerInformationReply; import org.apache.ratis.protocol.SetConfigurationRequest; import org.apache.ratis.shaded.com.google.protobuf.ServiceException; @@ -75,7 +75,7 @@ public class CombinedClientProtocolClientSideTranslatorPB } @Override - public ServerInformationReply getInfo(ServerInformatonRequest request) throws IOException { + public ServerInformationReply getInfo(ServerInformationRequest request) throws IOException { return handleRequest(request, ClientProtoUtils::toServerInformationRequestProto, ClientProtoUtils::toServerInformationReply, http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/b47ba426/ratis-hadoop/src/main/java/org/apache/ratis/hadooprpc/client/CombinedClientProtocolServerSideTranslatorPB.java ---------------------------------------------------------------------- diff --git a/ratis-hadoop/src/main/java/org/apache/ratis/hadooprpc/client/CombinedClientProtocolServerSideTranslatorPB.java b/ratis-hadoop/src/main/java/org/apache/ratis/hadooprpc/client/CombinedClientProtocolServerSideTranslatorPB.java index 7b370cb..5b88208 100644 --- a/ratis-hadoop/src/main/java/org/apache/ratis/hadooprpc/client/CombinedClientProtocolServerSideTranslatorPB.java +++ b/ratis-hadoop/src/main/java/org/apache/ratis/hadooprpc/client/CombinedClientProtocolServerSideTranslatorPB.java @@ -86,7 +86,7 @@ public class CombinedClientProtocolServerSideTranslatorPB public ServerInformationReplyProto serverInformation( RpcController controller, ServerInformationRequestProto proto) throws ServiceException { - final ServerInformatonRequest request; + final ServerInformationRequest request; try { request = ClientProtoUtils.toServerInformationRequest(proto); final ServerInformationReply reply = impl.getInfo(request); http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/b47ba426/ratis-hadoop/src/main/java/org/apache/ratis/hadooprpc/client/HadoopClientRpc.java ---------------------------------------------------------------------- diff --git a/ratis-hadoop/src/main/java/org/apache/ratis/hadooprpc/client/HadoopClientRpc.java b/ratis-hadoop/src/main/java/org/apache/ratis/hadooprpc/client/HadoopClientRpc.java index 9c7cdf9..e35875c 100644 --- a/ratis-hadoop/src/main/java/org/apache/ratis/hadooprpc/client/HadoopClientRpc.java +++ b/ratis-hadoop/src/main/java/org/apache/ratis/hadooprpc/client/HadoopClientRpc.java @@ -42,8 +42,8 @@ public class HadoopClientRpc extends RaftClientRpcWithProxy<CombinedClientProtoc return proxy.reinitialize((ReinitializeRequest) request); } else if (request instanceof SetConfigurationRequest) { return proxy.setConfiguration((SetConfigurationRequest) request); - } else if (request instanceof ServerInformatonRequest) { - return proxy.getInfo((ServerInformatonRequest) request); + } else if (request instanceof ServerInformationRequest) { + return proxy.getInfo((ServerInformationRequest) request); } else { return proxy.submitClientRequest(request); } http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/b47ba426/ratis-netty/src/main/java/org/apache/ratis/netty/client/NettyClientRpc.java ---------------------------------------------------------------------- diff --git a/ratis-netty/src/main/java/org/apache/ratis/netty/client/NettyClientRpc.java b/ratis-netty/src/main/java/org/apache/ratis/netty/client/NettyClientRpc.java index 703e040..f4c1f11 100644 --- a/ratis-netty/src/main/java/org/apache/ratis/netty/client/NettyClientRpc.java +++ b/ratis-netty/src/main/java/org/apache/ratis/netty/client/NettyClientRpc.java @@ -52,9 +52,9 @@ public class NettyClientRpc extends RaftClientRpcWithProxy<NettyRpcProxy> { (SetConfigurationRequest)request); b.setSetConfigurationRequest(proto); rpcRequest = proto.getRpcRequest(); - } else if (request instanceof ServerInformatonRequest) { + } else if (request instanceof ServerInformationRequest) { final RaftProtos.ServerInformationRequestProto proto = ClientProtoUtils.toServerInformationRequestProto( - (ServerInformatonRequest)request); + (ServerInformationRequest)request); b.setServerInformationRequest(proto); rpcRequest = proto.getRpcRequest(); } else { @@ -62,7 +62,7 @@ public class NettyClientRpc extends RaftClientRpcWithProxy<NettyRpcProxy> { b.setRaftClientRequest(proto); rpcRequest = proto.getRpcRequest(); } - if (request instanceof ServerInformatonRequest) { + if (request instanceof ServerInformationRequest) { return ClientProtoUtils.toServerInformationReply( proxy.send(rpcRequest, b.build()).getServerInfoReply()); } else { http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/b47ba426/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java ---------------------------------------------------------------------- diff --git a/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java b/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java index 1777bb8..595a80a 100644 --- a/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java +++ b/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java @@ -359,7 +359,7 @@ public class RaftServerImpl implements RaftServerProtocol, RaftServerAsynchronou return infos; } - ServerInformationReply getServerInformation(ServerInformatonRequest request) { + ServerInformationReply getServerInformation(ServerInformationRequest request) { final RaftGroup group = new RaftGroup(groupId, getRaftConf().getPeers()); return new ServerInformationReply(request, getCommitInfos(), group); } http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/b47ba426/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerProxy.java ---------------------------------------------------------------------- diff --git a/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerProxy.java b/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerProxy.java index 760cf70..d7b7ad0 100644 --- a/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerProxy.java +++ b/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerProxy.java @@ -201,7 +201,7 @@ public class RaftServerProxy implements RaftServer { } @Override - public ServerInformationReply getInfo(ServerInformatonRequest request) + public ServerInformationReply getInfo(ServerInformationRequest request) throws IOException { return RaftServerImpl.waitForReply(getId(), request, getInfoAsync(request), r -> null); @@ -209,7 +209,7 @@ public class RaftServerProxy implements RaftServer { @Override public CompletableFuture<ServerInformationReply> getInfoAsync( - ServerInformatonRequest request) { + ServerInformationRequest request) { return impl.thenApply(server -> server.getServerInformation(request)); } http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/b47ba426/ratis-server/src/test/java/org/apache/ratis/server/simulation/SimulatedServerRpc.java ---------------------------------------------------------------------- diff --git a/ratis-server/src/test/java/org/apache/ratis/server/simulation/SimulatedServerRpc.java b/ratis-server/src/test/java/org/apache/ratis/server/simulation/SimulatedServerRpc.java index 67e1c25..fc80f15 100644 --- a/ratis-server/src/test/java/org/apache/ratis/server/simulation/SimulatedServerRpc.java +++ b/ratis-server/src/test/java/org/apache/ratis/server/simulation/SimulatedServerRpc.java @@ -152,9 +152,9 @@ class SimulatedServerRpc implements RaftServerRpc { if (request instanceof ReinitializeRequest) { future = CompletableFuture.completedFuture( server.reinitialize((ReinitializeRequest) request)); - } else if (request instanceof ServerInformatonRequest) { + } else if (request instanceof ServerInformationRequest) { future = CompletableFuture.completedFuture( - server.getInfo((ServerInformatonRequest) request)); + server.getInfo((ServerInformationRequest) request)); } else if (request instanceof SetConfigurationRequest) { future = server.setConfigurationAsync((SetConfigurationRequest) request); } else {
