Search in sources :

Example 1 with RemoveFileRequest

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

the class ManagerProcessContext method startRemoveFileListener.

/**
 * Starts a request stream observer for {@link HostedManagerServiceGrpc} RemoveFile RPC calls.
 */
public void startRemoveFileListener() {
    HostedManagerServiceGrpc.HostedManagerServiceStub asyncStub = getHostedAsyncStub();
    RequestStreamObserver requestObserver = new RequestStreamObserver<RemoveFileRequest, RemoveFileResponse>() {

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

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

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

Aggregations

RequestStreamObserver (alluxio.hub.manager.rpc.observer.RequestStreamObserver)1 AgentRemoveFileRequest (alluxio.hub.proto.AgentRemoveFileRequest)1 AgentRemoveFileResponse (alluxio.hub.proto.AgentRemoveFileResponse)1 HostedManagerServiceGrpc (alluxio.hub.proto.HostedManagerServiceGrpc)1 RemoveFileRequest (alluxio.hub.proto.RemoveFileRequest)1 RemoveFileResponse (alluxio.hub.proto.RemoveFileResponse)1 ByteString (com.google.protobuf.ByteString)1