Search in sources :

Example 1 with ListCatalogResponse

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

the class ManagerProcessContext method startListCatalogListener.

/**
 * Starts a request stream observer for {@link HostedManagerServiceGrpc} ListCatalog RPC calls.
 */
public void startListCatalogListener() {
    HostedManagerServiceGrpc.HostedManagerServiceStub asyncStub = getHostedAsyncStub();
    RequestStreamObserver requestObserver = new RequestStreamObserver<ListCatalogRequest, ListCatalogResponse>() {

        @Override
        public ListCatalogResponse exec(ListCatalogRequest req) {
            PrestoCatalogListingResult result = listCatalogs(getUpdatedProps(configurationSetFor(AlluxioNodeType.MASTER)).getString(PropertyKey.HUB_MANAGER_PRESTO_CONF_PATH));
            return ListCatalogResponse.newBuilder().setHubMetadata(mHubMetadata).setPayload(ListCatalogResponse.Payload.newBuilder().addAllCatalog(result.getCatalogList())).build();
        }

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

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

Aggregations

RequestStreamObserver (alluxio.hub.manager.rpc.observer.RequestStreamObserver)1 AgentListCatalogRequest (alluxio.hub.proto.AgentListCatalogRequest)1 HostedManagerServiceGrpc (alluxio.hub.proto.HostedManagerServiceGrpc)1 ListCatalogRequest (alluxio.hub.proto.ListCatalogRequest)1 ListCatalogResponse (alluxio.hub.proto.ListCatalogResponse)1 PrestoCatalogListingResult (alluxio.hub.proto.PrestoCatalogListingResult)1 ByteString (com.google.protobuf.ByteString)1