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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations