use of alluxio.grpc.GetStatusPOptions in project alluxio by Alluxio.
the class FileSystemMasterClientServiceHandler method getStatus.
@Override
public void getStatus(GetStatusPRequest request, StreamObserver<GetStatusPResponse> responseObserver) {
GetStatusPOptions options = request.getOptions();
RpcUtils.call(LOG, () -> {
AlluxioURI pathUri = getAlluxioURI(request.getPath());
return GetStatusPResponse.newBuilder().setFileInfo(GrpcUtils.toProto(mFileSystemMaster.getFileInfo(pathUri, GetStatusContext.create(options.toBuilder()).withTracker(new GrpcCallTracker(responseObserver))))).build();
}, "GetStatus", true, "request=%s", responseObserver, request);
}
use of alluxio.grpc.GetStatusPOptions in project alluxio by Alluxio.
the class GetStatusContext method mergeFrom.
/**
* Merges and embeds the given {@link GetStatusPOptions} with the corresponding master options.
*
* @param optionsBuilder Builder for proto {@link GetStatusPOptions} to merge with defaults
* @return the instance of {@link GetStatusContext} with default values for master
*/
public static GetStatusContext mergeFrom(GetStatusPOptions.Builder optionsBuilder) {
GetStatusPOptions masterOptions = FileSystemOptions.getStatusDefaults(ServerConfiguration.global());
GetStatusPOptions.Builder mergedOptionsBuilder = masterOptions.toBuilder().mergeFrom(optionsBuilder.build());
return create(mergedOptionsBuilder);
}
use of alluxio.grpc.GetStatusPOptions in project alluxio by Alluxio.
the class BaseFileSystemTest method getStatus.
/**
* Tests for the {@link BaseFileSystem#getStatus(AlluxioURI, GetStatusPOptions)} method.
*/
@Test
public void getStatus() throws Exception {
AlluxioURI file = new AlluxioURI("/file");
URIStatus status = new URIStatus(new FileInfo());
GetStatusPOptions getStatusOptions = GetStatusPOptions.getDefaultInstance();
when(mFileSystemMasterClient.getStatus(file, FileSystemOptions.getStatusDefaults(mConf).toBuilder().mergeFrom(getStatusOptions).build())).thenReturn(status);
assertSame(status, mFileSystem.getStatus(file, getStatusOptions));
verify(mFileSystemMasterClient).getStatus(file, FileSystemOptions.getStatusDefaults(mConf).toBuilder().mergeFrom(getStatusOptions).build());
verifyFilesystemContextAcquiredAndReleased();
}
use of alluxio.grpc.GetStatusPOptions in project alluxio by Alluxio.
the class BaseFileSystemTest method getStatusException.
/**
* Ensures that an exception is propagated correctly when retrieving information.
*/
@Test
public void getStatusException() throws Exception {
AlluxioURI file = new AlluxioURI("/file");
GetStatusPOptions getStatusOptions = GetStatusPOptions.getDefaultInstance();
when(mFileSystemMasterClient.getStatus(file, FileSystemOptions.getStatusDefaults(mConf).toBuilder().mergeFrom(getStatusOptions).build())).thenThrow(EXCEPTION);
try {
mFileSystem.getStatus(file, getStatusOptions);
fail(SHOULD_HAVE_PROPAGATED_MESSAGE);
} catch (Exception e) {
assertSame(EXCEPTION, e);
}
verifyFilesystemContextAcquiredAndReleased();
}
use of alluxio.grpc.GetStatusPOptions in project alluxio by Alluxio.
the class BaseFileSystemTest method openException.
/**
* Ensures that an exception is propagated successfully when opening a file.
*/
@Test
public void openException() throws Exception {
AlluxioURI file = new AlluxioURI("/file");
GetStatusPOptions getStatusOptions = getOpenOptions(GetStatusPOptions.getDefaultInstance());
when(mFileSystemMasterClient.getStatus(file, getStatusOptions)).thenThrow(EXCEPTION);
try {
mFileSystem.openFile(file, OpenFilePOptions.getDefaultInstance());
fail(SHOULD_HAVE_PROPAGATED_MESSAGE);
} catch (Exception e) {
assertSame(EXCEPTION, e);
}
verifyFilesystemContextAcquiredAndReleased();
}
Aggregations