org.apache.ratis.protocol.GroupInfoRequest Java Examples

The following examples show how to use org.apache.ratis.protocol.GroupInfoRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestRatisPipelineLeader.java    From hadoop-ozone with Apache License 2.0 6 votes vote down vote up
private boolean verifyLeaderInfo(Pipeline ratisPipeline) throws Exception {
  Optional<HddsDatanodeService> hddsDatanodeService =
      cluster.getHddsDatanodes().stream().filter(s ->
          s.getDatanodeStateMachine().getDatanodeDetails().getUuid()
              .equals(ratisPipeline.getLeaderId())).findFirst();
  Assert.assertTrue(hddsDatanodeService.isPresent());

  XceiverServerRatis serverRatis =
      (XceiverServerRatis) hddsDatanodeService.get()
          .getDatanodeStateMachine().getContainer().getWriteChannel();

  GroupInfoRequest groupInfoRequest = new GroupInfoRequest(
      ClientId.randomId(), serverRatis.getServer().getId(),
      RaftGroupId.valueOf(ratisPipeline.getId().getId()), 100);
  GroupInfoReply reply =
      serverRatis.getServer().getGroupInfo(groupInfoRequest);
  return reply.getRoleInfoProto().hasLeaderInfo() &&
      ratisPipeline.getLeaderId().toString().equals(
          reply.getRoleInfoProto().getSelf().getId().toStringUtf8());
}
 
Example #2
Source File: CombinedClientProtocolClientSideTranslatorPB.java    From incubator-ratis with Apache License 2.0 5 votes vote down vote up
@Override
public GroupInfoReply getGroupInfo(GroupInfoRequest request) throws IOException {
  return handleRequest(request,
      ClientProtoUtils::toGroupInfoRequestProto,
      ClientProtoUtils::toGroupInfoReply,
      p -> getProtocol().groupInfo(null, p));
}
 
Example #3
Source File: CombinedClientProtocolClientSideTranslatorPB.java    From ratis with Apache License 2.0 5 votes vote down vote up
@Override
public GroupInfoReply getGroupInfo(GroupInfoRequest request) throws IOException {
  return handleRequest(request,
      ClientProtoUtils::toGroupInfoRequestProto,
      ClientProtoUtils::toGroupInfoReply,
      p -> getProtocol().groupInfo(null, p));
}
 
Example #4
Source File: XceiverServerRatis.java    From hadoop-ozone with Apache License 2.0 4 votes vote down vote up
private GroupInfoRequest createGroupInfoRequest(
    HddsProtos.PipelineID pipelineID) {
  return new GroupInfoRequest(clientId, server.getId(),
      RaftGroupId.valueOf(PipelineID.getFromProtobuf(pipelineID).getId()),
      nextCallId());
}
 
Example #5
Source File: OzoneManagerRatisServer.java    From hadoop-ozone with Apache License 2.0 4 votes vote down vote up
private GroupInfoReply getGroupInfo() throws IOException {
  GroupInfoRequest groupInfoRequest = new GroupInfoRequest(clientId,
      raftPeerId, raftGroupId, nextCallId());
  GroupInfoReply groupInfo = server.getGroupInfo(groupInfoRequest);
  return groupInfo;
}
 
Example #6
Source File: GrpcAdminProtocolService.java    From incubator-ratis with Apache License 2.0 4 votes vote down vote up
@Override
public void groupInfo(GroupInfoRequestProto proto, StreamObserver<GroupInfoReplyProto> responseObserver) {
  final GroupInfoRequest request = ClientProtoUtils.toGroupInfoRequest(proto);
  GrpcUtil.asyncCall(responseObserver, () -> protocol.getGroupInfoAsync(request),
      ClientProtoUtils::toGroupInfoReplyProto);
}
 
Example #7
Source File: GrpcAdminProtocolService.java    From ratis with Apache License 2.0 4 votes vote down vote up
@Override
public void groupInfo(GroupInfoRequestProto proto, StreamObserver<GroupInfoReplyProto> responseObserver) {
  final GroupInfoRequest request = ClientProtoUtils.toGroupInfoRequest(proto);
  GrpcUtil.asyncCall(responseObserver, () -> protocol.getGroupInfoAsync(request),
      ClientProtoUtils::toGroupInfoReplyProto);
}