use of alluxio.security.authorization.Mode in project alluxio by Alluxio.
the class AlluxioJniFuseFileSystemTest method chmod.
@Test
public void chmod() throws Exception {
long mode = 123;
mFuseFs.chmod("/foo/bar", mode);
AlluxioURI expectedPath = BASE_EXPECTED_URI.join("/foo/bar");
SetAttributePOptions options = SetAttributePOptions.newBuilder().setMode(new Mode((short) mode).toProto()).build();
verify(mFileSystem).setAttribute(expectedPath, options);
}
use of alluxio.security.authorization.Mode in project alluxio by Alluxio.
the class AlluxioJniFuseFileSystem method mkdirInternal.
private int mkdirInternal(String path, long mode) {
final AlluxioURI uri = mPathResolverCache.getUnchecked(path);
if (uri.getName().length() > MAX_NAME_LENGTH) {
LOG.error("Failed to create directory {}: name longer than {} characters", path, MAX_NAME_LENGTH);
return -ErrorCodes.ENAMETOOLONG();
}
try {
mFileSystem.createDirectory(uri, CreateDirectoryPOptions.newBuilder().setMode(new Mode((short) mode).toProto()).build());
mAuthPolicy.setUserGroupIfNeeded(uri);
} catch (Throwable e) {
LOG.error("Failed to mkdir {}: ", path, e);
return -ErrorCodes.EIO();
}
return 0;
}
use of alluxio.security.authorization.Mode in project alluxio by Alluxio.
the class AlluxioJniFuseFileSystem method createInternal.
private int createInternal(String path, long mode, FuseFileInfo fi) {
final AlluxioURI uri = mPathResolverCache.getUnchecked(path);
if (uri.getName().length() > MAX_NAME_LENGTH) {
LOG.error("Failed to create {}: file name longer than {} characters", path, MAX_NAME_LENGTH);
return -ErrorCodes.ENAMETOOLONG();
}
try {
FileOutStream os = mFileSystem.createFile(uri, CreateFilePOptions.newBuilder().setMode(new Mode((short) mode).toProto()).build());
long fid = mNextOpenFileId.getAndIncrement();
mCreateFileEntries.add(new CreateFileEntry(fid, path, os));
fi.fh.set(fid);
mAuthPolicy.setUserGroupIfNeeded(uri);
} catch (Throwable e) {
LOG.error("Failed to create {}: ", path, e);
return -ErrorCodes.EIO();
}
return 0;
}
Aggregations