org.apache.ratis.protocol.GroupManagementRequest Java Examples

The following examples show how to use org.apache.ratis.protocol.GroupManagementRequest. 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: XceiverServerRatis.java    From hadoop-ozone with Apache License 2.0 6 votes vote down vote up
@Override
public void addGroup(HddsProtos.PipelineID pipelineId,
    Collection<DatanodeDetails> peers) throws IOException {
  final PipelineID pipelineID = PipelineID.getFromProtobuf(pipelineId);
  final RaftGroupId groupId = RaftGroupId.valueOf(pipelineID.getId());
  final RaftGroup group = RatisHelper.newRaftGroup(groupId, peers);
  GroupManagementRequest request = GroupManagementRequest.newAdd(
      clientId, server.getId(), nextCallId(), group);

  RaftClientReply reply;
  try {
    reply = server.groupManagement(request);
  } catch (Exception e) {
    throw new IOException(e.getMessage(), e);
  }
  processReply(reply);
}
 
Example #2
Source File: XceiverServerRatis.java    From hadoop-ozone with Apache License 2.0 6 votes vote down vote up
@Override
public void removeGroup(HddsProtos.PipelineID pipelineId)
    throws IOException {
  GroupManagementRequest request = GroupManagementRequest.newRemove(
      clientId, server.getId(), nextCallId(),
      RaftGroupId.valueOf(PipelineID.getFromProtobuf(pipelineId).getId()),
      true);

  RaftClientReply reply;
  try {
    reply = server.groupManagement(request);
  } catch (Exception e) {
    throw new IOException(e.getMessage(), e);
  }
  processReply(reply);
}
 
Example #3
Source File: CombinedClientProtocolClientSideTranslatorPB.java    From incubator-ratis with Apache License 2.0 5 votes vote down vote up
@Override
public RaftClientReply groupManagement(GroupManagementRequest request) throws IOException {
  return handleRequest(request,
      ClientProtoUtils::toGroupManagementRequestProto,
      ClientProtoUtils::toRaftClientReply,
      p -> getProtocol().groupManagement(null, p));
}
 
Example #4
Source File: GrpcAdminProtocolService.java    From incubator-ratis with Apache License 2.0 5 votes vote down vote up
@Override
public void groupManagement(GroupManagementRequestProto proto,
      StreamObserver<RaftClientReplyProto> responseObserver) {
  final GroupManagementRequest request = ClientProtoUtils.toGroupManagementRequest(proto);
  GrpcUtil.asyncCall(responseObserver, () -> protocol.groupManagementAsync(request),
      ClientProtoUtils::toRaftClientReplyProto);
}
 
Example #5
Source File: CombinedClientProtocolClientSideTranslatorPB.java    From ratis with Apache License 2.0 5 votes vote down vote up
@Override
public RaftClientReply groupManagement(GroupManagementRequest request) throws IOException {
  return handleRequest(request,
      ClientProtoUtils::toGroupManagementRequestProto,
      ClientProtoUtils::toRaftClientReply,
      p -> getProtocol().groupManagement(null, p));
}
 
Example #6
Source File: GrpcAdminProtocolService.java    From ratis with Apache License 2.0 4 votes vote down vote up
@Override
public void groupManagement(GroupManagementRequestProto proto, StreamObserver<RaftClientReplyProto> responseObserver) {
  final GroupManagementRequest request = ClientProtoUtils.toGroupManagementRequest(proto);
  GrpcUtil.asyncCall(responseObserver, () -> protocol.groupManagementAsync(request),
      ClientProtoUtils::toRaftClientReplyProto);
}