Search in sources :

Example 1 with HostedManagerServiceGrpc

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

the class ManagerProcessContext method startApplyMountPointListener.

/**
 * Starts a request stream observer for {@link HostedManagerServiceGrpc} ApplyMountPoint
 * RPC calls.
 */
public void startApplyMountPointListener() {
    HostedManagerServiceGrpc.HostedManagerServiceStub asyncStub = getHostedAsyncStub();
    RequestStreamObserver requestObserver = new RequestStreamObserver<ApplyMountPointRequest, ApplyMountPointResponse>() {

        @Override
        public ApplyMountPointResponse exec(ApplyMountPointRequest req) {
            return ApplyMountPointResponse.newBuilder().setHubMetadata(mHubMetadata).setPayload(applyMount(req)).build();
        }

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

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

Example 2 with HostedManagerServiceGrpc

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

the class ManagerProcessContext method startSpeedTestListener.

/**
 * Starts a request stream observer for {@link HostedManagerServiceGrpc} SpeedTest RPC calls.
 */
public void startSpeedTestListener() {
    HostedManagerServiceGrpc.HostedManagerServiceStub asyncStub = getHostedAsyncStub();
    RequestStreamObserver requestObserver = new RequestStreamObserver<SpeedTestRequest, SpeedTestResponse>() {

        @Override
        public SpeedTestResponse exec(SpeedTestRequest req) {
            return SpeedTestResponse.newBuilder().setHubMetadata(mHubMetadata).setPayload(speedTest(req)).build();
        }

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

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

Example 3 with HostedManagerServiceGrpc

use of alluxio.hub.proto.HostedManagerServiceGrpc 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)

Example 4 with HostedManagerServiceGrpc

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

the class ManagerProcessContext method startDeleteMountPointListener.

/**
 * Starts a request stream observer for {@link HostedManagerServiceGrpc} DeleteMountPoint
 * RPC calls.
 */
public void startDeleteMountPointListener() {
    HostedManagerServiceGrpc.HostedManagerServiceStub asyncStub = getHostedAsyncStub();
    RequestStreamObserver requestObserver = new RequestStreamObserver<DeleteMountPointRequest, DeleteMountPointResponse>() {

        @Override
        public DeleteMountPointResponse exec(DeleteMountPointRequest req) {
            return DeleteMountPointResponse.newBuilder().setHubMetadata(mHubMetadata).setPayload(deleteMount(req.getPayload().getMountPoint())).build();
        }

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

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

Example 5 with HostedManagerServiceGrpc

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

the class ManagerProcessContext method startUploadFileListener.

/**
 * Starts a request stream observer for {@link HostedManagerServiceGrpc} UploadFile RPC calls.
 */
public void startUploadFileListener() {
    HostedManagerServiceGrpc.HostedManagerServiceStub asyncStub = getHostedAsyncStub();
    RequestStreamObserver requestObserver = new RequestStreamObserver<UploadFileRequest, UploadFileResponse>() {

        @Override
        public UploadFileResponse exec(UploadFileRequest req) {
            boolean success = uploadFile(req.getPayload().getFileList());
            return UploadFileResponse.newBuilder().setHubMetadata(mHubMetadata).setPayload(UploadFileResponse.Payload.newBuilder().setSuccess(success)).build();
        }

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

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

Aggregations

RequestStreamObserver (alluxio.hub.manager.rpc.observer.RequestStreamObserver)15 HostedManagerServiceGrpc (alluxio.hub.proto.HostedManagerServiceGrpc)15 ByteString (com.google.protobuf.ByteString)15 AgentDetectPrestoRequest (alluxio.hub.proto.AgentDetectPrestoRequest)1 AgentDetectPrestoResponse (alluxio.hub.proto.AgentDetectPrestoResponse)1 AgentGetConfigurationSetRequest (alluxio.hub.proto.AgentGetConfigurationSetRequest)1 AgentListCatalogRequest (alluxio.hub.proto.AgentListCatalogRequest)1 AgentListFileRequest (alluxio.hub.proto.AgentListFileRequest)1 AgentProcessStatusChangeResponse (alluxio.hub.proto.AgentProcessStatusChangeResponse)1 AgentRemoveFileRequest (alluxio.hub.proto.AgentRemoveFileRequest)1 AgentRemoveFileResponse (alluxio.hub.proto.AgentRemoveFileResponse)1 AgentWriteConfigurationSetRequest (alluxio.hub.proto.AgentWriteConfigurationSetRequest)1 AgentWriteConfigurationSetResponse (alluxio.hub.proto.AgentWriteConfigurationSetResponse)1 AlluxioConfigurationSet (alluxio.hub.proto.AlluxioConfigurationSet)1 ApplyMountPointRequest (alluxio.hub.proto.ApplyMountPointRequest)1 ApplyMountPointResponse (alluxio.hub.proto.ApplyMountPointResponse)1 DeleteMountPointRequest (alluxio.hub.proto.DeleteMountPointRequest)1 DeleteMountPointResponse (alluxio.hub.proto.DeleteMountPointResponse)1 DetectPrestoRequest (alluxio.hub.proto.DetectPrestoRequest)1 DetectPrestoResponse (alluxio.hub.proto.DetectPrestoResponse)1