Search in sources :

Example 1 with CheckAccessPOptions

use of alluxio.grpc.CheckAccessPOptions in project alluxio by Alluxio.

the class AbstractFileSystem method access.

@Override
public void access(Path path, FsAction mode) throws IOException {
    LOG.debug("access({}, {})", path, mode);
    AlluxioURI uri = getAlluxioPath(path);
    CheckAccessPOptions options = CheckAccessPOptions.newBuilder().setBits(Mode.Bits.fromShort((short) mode.ordinal()).toProto()).build();
    try {
        mFileSystem.checkAccess(uri, options);
    } catch (AlluxioException e) {
        throw new IOException(e);
    }
}
Also used : CheckAccessPOptions(alluxio.grpc.CheckAccessPOptions) IOException(java.io.IOException) AlluxioURI(alluxio.AlluxioURI) AlluxioException(alluxio.exception.AlluxioException)

Example 2 with CheckAccessPOptions

use of alluxio.grpc.CheckAccessPOptions in project alluxio by Alluxio.

the class BaseFileSystem method checkAccess.

@Override
public void checkAccess(AlluxioURI path, CheckAccessPOptions options) throws InvalidPathException, IOException, AlluxioException {
    checkUri(path);
    rpc(client -> {
        CheckAccessPOptions mergedOptions = FileSystemOptions.checkAccessDefaults(mFsContext.getPathConf(path)).toBuilder().mergeFrom(options).build();
        client.checkAccess(path, mergedOptions);
        LOG.debug("Checked access {}, options: {}", path.getPath(), mergedOptions);
        return null;
    });
}
Also used : CheckAccessPOptions(alluxio.grpc.CheckAccessPOptions)

Example 3 with CheckAccessPOptions

use of alluxio.grpc.CheckAccessPOptions in project alluxio by Alluxio.

the class CheckAccessContext method mergeFrom.

/**
 * Merges and embeds the given {@link CheckAccessPOptions} with the corresponding master
 * options.
 *
 * @param optionsBuilder Builder for proto {@link CheckAccessPOptions} to merge with defaults
 * @return the instance of {@link CheckAccessContext} with default values for master
 */
public static CheckAccessContext mergeFrom(CheckAccessPOptions.Builder optionsBuilder) {
    CheckAccessPOptions masterOptions = FileSystemOptions.checkAccessDefaults(ServerConfiguration.global());
    CheckAccessPOptions.Builder mergedOptionsBuilder = masterOptions.toBuilder().mergeFrom(optionsBuilder.build());
    return create(mergedOptionsBuilder);
}
Also used : CheckAccessPOptions(alluxio.grpc.CheckAccessPOptions)

Aggregations

CheckAccessPOptions (alluxio.grpc.CheckAccessPOptions)3 AlluxioURI (alluxio.AlluxioURI)1 AlluxioException (alluxio.exception.AlluxioException)1 IOException (java.io.IOException)1