Search in sources :

Example 1 with MutableLockedInodePath

use of alluxio.master.file.meta.MutableLockedInodePath in project alluxio by Alluxio.

the class PermissionCheckTest method getLockedInodePath.

private LockedInodePath getLockedInodePath(ArrayList<Triple<String, String, Mode>> permissions) throws Exception {
    List<Inode<?>> inodes = new ArrayList<>();
    inodes.add(getRootInode());
    if (permissions.size() == 0) {
        return new MutableLockedInodePath(new AlluxioURI("/"), inodes, null);
    }
    String uri = "";
    for (int i = 0; i < permissions.size(); i++) {
        Triple<String, String, Mode> permission = permissions.get(i);
        String owner = permission.getLeft();
        String group = permission.getMiddle();
        Mode mode = permission.getRight();
        uri += "/" + (i + 1);
        if (i == permissions.size() - 1) {
            Inode<?> inode = InodeFile.create(i + 1, i, (i + 1) + "", CommonUtils.getCurrentMs(), CreateFileOptions.defaults().setBlockSizeBytes(Constants.KB).setOwner(owner).setGroup(group).setMode(mode));
            inodes.add(inode);
        } else {
            Inode<?> inode = InodeDirectory.create(i + 1, i, (i + 1) + "", CreateDirectoryOptions.defaults().setOwner(owner).setGroup(group).setMode(mode));
            inodes.add(inode);
        }
    }
    return new MutableLockedInodePath(new AlluxioURI(uri), inodes, null);
}
Also used : Inode(alluxio.master.file.meta.Inode) Mode(alluxio.security.authorization.Mode) ArrayList(java.util.ArrayList) MutableLockedInodePath(alluxio.master.file.meta.MutableLockedInodePath) AlluxioURI(alluxio.AlluxioURI)

Aggregations

AlluxioURI (alluxio.AlluxioURI)1 Inode (alluxio.master.file.meta.Inode)1 MutableLockedInodePath (alluxio.master.file.meta.MutableLockedInodePath)1 Mode (alluxio.security.authorization.Mode)1 ArrayList (java.util.ArrayList)1