Search in sources :

Example 1 with GroupManagementRequest

use of org.apache.ratis.protocol.GroupManagementRequest in project incubator-ratis by apache.

the class GrpcAdminProtocolService method groupManagement.

@Override
public void groupManagement(GroupManagementRequestProto proto, StreamObserver<RaftClientReplyProto> responseObserver) {
    final GroupManagementRequest request = ClientProtoUtils.toGroupManagementRequest(proto);
    GrpcUtil.asyncCall(responseObserver, () -> protocol.groupManagementAsync(request), ClientProtoUtils::toRaftClientReplyProto);
}
Also used : GroupManagementRequest(org.apache.ratis.protocol.GroupManagementRequest) ClientProtoUtils(org.apache.ratis.client.impl.ClientProtoUtils)

Example 2 with GroupManagementRequest

use of org.apache.ratis.protocol.GroupManagementRequest in project ozone by apache.

the class XceiverServerRatis method removeGroup.

@Override
public void removeGroup(HddsProtos.PipelineID pipelineId) throws IOException {
    // if shouldDeleteRatisLogDirectory is set to false, the raft log
    // directory will be renamed and kept aside for debugging.
    // In case, its set to true, the raft log directory will be removed
    GroupManagementRequest request = GroupManagementRequest.newRemove(clientId, server.getId(), nextCallId(), RaftGroupId.valueOf(PipelineID.getFromProtobuf(pipelineId).getId()), shouldDeleteRatisLogDirectory, !shouldDeleteRatisLogDirectory);
    RaftClientReply reply;
    try {
        reply = server.groupManagement(request);
    } catch (Exception e) {
        throw new IOException(e.getMessage(), e);
    }
    processReply(reply);
}
Also used : GroupManagementRequest(org.apache.ratis.protocol.GroupManagementRequest) RaftClientReply(org.apache.ratis.protocol.RaftClientReply) IOException(java.io.IOException) TimeoutException(java.util.concurrent.TimeoutException) StateMachineException(org.apache.ratis.protocol.exceptions.StateMachineException) NotLeaderException(org.apache.ratis.protocol.exceptions.NotLeaderException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException)

Example 3 with GroupManagementRequest

use of org.apache.ratis.protocol.GroupManagementRequest in project ozone by apache.

the class XceiverServerRatis method addGroup.

@Override
public void addGroup(HddsProtos.PipelineID pipelineId, List<DatanodeDetails> peers, List<Integer> priorityList) throws IOException {
    final PipelineID pipelineID = PipelineID.getFromProtobuf(pipelineId);
    final RaftGroupId groupId = RaftGroupId.valueOf(pipelineID.getId());
    final RaftGroup group = RatisHelper.newRaftGroup(groupId, peers, priorityList);
    GroupManagementRequest request = GroupManagementRequest.newAdd(clientId, server.getId(), nextCallId(), group);
    RaftClientReply reply;
    LOG.debug("Received addGroup request for pipeline {}", pipelineID);
    try {
        reply = server.groupManagement(request);
    } catch (Exception e) {
        throw new IOException(e.getMessage(), e);
    }
    processReply(reply);
    LOG.info("Created group {}", pipelineID);
}
Also used : GroupManagementRequest(org.apache.ratis.protocol.GroupManagementRequest) RaftClientReply(org.apache.ratis.protocol.RaftClientReply) PipelineID(org.apache.hadoop.hdds.scm.pipeline.PipelineID) RaftGroupId(org.apache.ratis.protocol.RaftGroupId) RaftGroup(org.apache.ratis.protocol.RaftGroup) IOException(java.io.IOException) TimeoutException(java.util.concurrent.TimeoutException) StateMachineException(org.apache.ratis.protocol.exceptions.StateMachineException) NotLeaderException(org.apache.ratis.protocol.exceptions.NotLeaderException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

GroupManagementRequest (org.apache.ratis.protocol.GroupManagementRequest)3 IOException (java.io.IOException)2 ExecutionException (java.util.concurrent.ExecutionException)2 TimeoutException (java.util.concurrent.TimeoutException)2 RaftClientReply (org.apache.ratis.protocol.RaftClientReply)2 NotLeaderException (org.apache.ratis.protocol.exceptions.NotLeaderException)2 StateMachineException (org.apache.ratis.protocol.exceptions.StateMachineException)2 PipelineID (org.apache.hadoop.hdds.scm.pipeline.PipelineID)1 ClientProtoUtils (org.apache.ratis.client.impl.ClientProtoUtils)1 RaftGroup (org.apache.ratis.protocol.RaftGroup)1 RaftGroupId (org.apache.ratis.protocol.RaftGroupId)1