Search in sources :

Example 1 with WriteConfigurationSetRequest

use of alluxio.hub.proto.WriteConfigurationSetRequest in project alluxio by Alluxio.

the class ManagerProcessContext method startWriteConfigurationSetListener.

/**
 * Starts a request stream observer for {@link HostedManagerServiceGrpc} WriteConfigurationSet
 * RPC calls.
 */
public void startWriteConfigurationSetListener() {
    HostedManagerServiceGrpc.HostedManagerServiceStub asyncStub = getHostedAsyncStub();
    RequestStreamObserver requestObserver = new RequestStreamObserver<WriteConfigurationSetRequest, WriteConfigurationSetResponse>() {

        @Override
        public WriteConfigurationSetResponse exec(WriteConfigurationSetRequest req) {
            Preconditions.checkArgument(req.hasPayload());
            Preconditions.checkArgument(req.getPayload().hasConfSet());
            Preconditions.checkArgument(req.getPayload().getNodeTypeCount() > 0);
            req.getPayload().getNodeTypeList().forEach(nodeType -> updateConfigurationFor(nodeType, req.getPayload().getConfSet()));
            return WriteConfigurationSetResponse.newBuilder().setHubMetadata(mHubMetadata).build();
        }

        @Override
        public void restart() {
            startWriteConfigurationSetListener();
        }

        @Override
        public void handleError(String message, Throwable t) {
            handleStatusRuntimeException(message, t);
        }
    };
    StreamObserver<WriteConfigurationSetResponse> responseObserver = asyncStub.writeConfigurationSet(requestObserver);
    requestObserver.start(responseObserver, WriteConfigurationSetResponse.newBuilder().setHubMetadata(mHubMetadata).build());
    LOG.info("Started WriteConfigurationSet async listener", asyncStub);
}
Also used : RequestStreamObserver(alluxio.hub.manager.rpc.observer.RequestStreamObserver) AgentWriteConfigurationSetResponse(alluxio.hub.proto.AgentWriteConfigurationSetResponse) WriteConfigurationSetResponse(alluxio.hub.proto.WriteConfigurationSetResponse) HostedManagerServiceGrpc(alluxio.hub.proto.HostedManagerServiceGrpc) ByteString(com.google.protobuf.ByteString) AgentWriteConfigurationSetRequest(alluxio.hub.proto.AgentWriteConfigurationSetRequest) WriteConfigurationSetRequest(alluxio.hub.proto.WriteConfigurationSetRequest)

Aggregations

RequestStreamObserver (alluxio.hub.manager.rpc.observer.RequestStreamObserver)1 AgentWriteConfigurationSetRequest (alluxio.hub.proto.AgentWriteConfigurationSetRequest)1 AgentWriteConfigurationSetResponse (alluxio.hub.proto.AgentWriteConfigurationSetResponse)1 HostedManagerServiceGrpc (alluxio.hub.proto.HostedManagerServiceGrpc)1 WriteConfigurationSetRequest (alluxio.hub.proto.WriteConfigurationSetRequest)1 WriteConfigurationSetResponse (alluxio.hub.proto.WriteConfigurationSetResponse)1 ByteString (com.google.protobuf.ByteString)1