Search in sources :

Example 6 with RequestStreamObserver

use of alluxio.hub.manager.rpc.observer.RequestStreamObserver in project alluxio by Alluxio.

the class ManagerProcessContext method startProcessStatusChangeListener.

/**
 * Starts a request stream observer for {@link HostedManagerServiceGrpc} ProcessStatusChange
 * RPC calls.
 */
public void startProcessStatusChangeListener() {
    HostedManagerServiceGrpc.HostedManagerServiceStub asyncStub = getHostedAsyncStub();
    RequestStreamObserver requestObserver = new RequestStreamObserver<ProcessStatusChangeRequest, ProcessStatusChangeResponse>() {

        @Override
        public ProcessStatusChangeResponse exec(ProcessStatusChangeRequest req) {
            return ProcessStatusChangeResponse.newBuilder().setHubMetadata(mHubMetadata).setPayload(ProcessStatusChangeResponse.Payload.newBuilder().addAllProcessStatusChangeResponse(processStatusChange(req))).build();
        }

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

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

Example 7 with RequestStreamObserver

use of alluxio.hub.manager.rpc.observer.RequestStreamObserver in project alluxio by Alluxio.

the class ManagerProcessContext method startGetPrestoConfDirListener.

/**
 * Starts a request stream observer for {@link HostedManagerServiceGrpc} GetPrestoConfDir
 * RPC calls.
 */
public void startGetPrestoConfDirListener() {
    HostedManagerServiceGrpc.HostedManagerServiceStub asyncStub = getHostedAsyncStub();
    RequestStreamObserver requestObserver = new RequestStreamObserver<GetPrestoConfDirRequest, GetPrestoConfDirResponse>() {

        @Override
        public GetPrestoConfDirResponse exec(GetPrestoConfDirRequest req) {
            return GetPrestoConfDirResponse.newBuilder().setHubMetadata(mHubMetadata).setPayload(getPrestoConf()).build();
        }

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

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

Example 8 with RequestStreamObserver

use of alluxio.hub.manager.rpc.observer.RequestStreamObserver 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)

Example 9 with RequestStreamObserver

use of alluxio.hub.manager.rpc.observer.RequestStreamObserver in project alluxio by Alluxio.

the class ManagerProcessContext method startGetConfigurationSetListener.

/**
 * Starts a request stream observer for {@link HostedManagerServiceGrpc} GetConfigurationSet
 * RPC calls.
 */
public void startGetConfigurationSetListener() {
    HostedManagerServiceGrpc.HostedManagerServiceStub asyncStub = getHostedAsyncStub();
    RequestStreamObserver requestObserver = new RequestStreamObserver<GetConfigurationSetRequest, GetConfigurationSetResponse>() {

        @Override
        public GetConfigurationSetResponse exec(GetConfigurationSetRequest req) {
            AlluxioConfigurationSet confSet = configurationSetFor(req.getPayload().getNodeType());
            return GetConfigurationSetResponse.newBuilder().setHubMetadata(mHubMetadata).setPayload(GetConfigurationSetResponse.Payload.newBuilder().setConfSet(confSet).build()).build();
        }

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

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

Example 10 with RequestStreamObserver

use of alluxio.hub.manager.rpc.observer.RequestStreamObserver 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)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