Search in sources :

Example 1 with ListFileRequest

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

the class ManagerProcessContext method startListFileListener.

/**
 * Starts a request stream observer for {@link HostedManagerServiceGrpc} ListFile RPC calls.
 */
public void startListFileListener() {
    HostedManagerServiceGrpc.HostedManagerServiceStub asyncStub = getHostedAsyncStub();
    RequestStreamObserver requestObserver = new RequestStreamObserver<ListFileRequest, ListFileResponse>() {

        @Override
        public ListFileResponse exec(ListFileRequest req) {
            return ListFileResponse.newBuilder().setHubMetadata(mHubMetadata).setPayload(ListFileResponse.Payload.newBuilder().addAllFile(listFiles())).build();
        }

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

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

Aggregations

RequestStreamObserver (alluxio.hub.manager.rpc.observer.RequestStreamObserver)1 AgentListFileRequest (alluxio.hub.proto.AgentListFileRequest)1 HostedManagerServiceGrpc (alluxio.hub.proto.HostedManagerServiceGrpc)1 ListFileRequest (alluxio.hub.proto.ListFileRequest)1 ListFileResponse (alluxio.hub.proto.ListFileResponse)1 ByteString (com.google.protobuf.ByteString)1