Search in sources :

Example 1 with MutableInode

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

the class AccessTimeUpdaterTest method createInode.

private void createInode(String path, CreateFileContext context) throws Exception {
    try (LockedInodePath inodePath = mInodeTree.lockInodePath(new AlluxioURI(path), InodeTree.LockPattern.WRITE_EDGE)) {
        List<Inode> result = mInodeTree.createPath(RpcContext.NOOP, inodePath, context);
        MutableInode<?> inode = mInodeStore.getMutable(result.get(result.size() - 1).getId()).get();
        mInodeStore.writeInode(inode);
    }
}
Also used : LockedInodePath(alluxio.master.file.meta.LockedInodePath) MutableInode(alluxio.master.file.meta.MutableInode) Inode(alluxio.master.file.meta.Inode) AlluxioURI(alluxio.AlluxioURI)

Example 2 with MutableInode

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

the class InodeStoreTest method addRemoveAddList.

@Test
public void addRemoveAddList() {
    writeInode(mRoot);
    for (int i = 1; i < 10; i++) {
        MutableInodeFile file = inodeFile(i, 0, "file" + i);
        writeInode(file);
        writeEdge(mRoot, file);
    }
    assertEquals(9, Iterables.size(mStore.getChildren(mRoot)));
    for (Inode child : mStore.getChildren(mRoot)) {
        MutableInode<?> childMut = mStore.getMutable(child.getId()).get();
        removeParentEdge(childMut);
        removeInode(childMut);
    }
    for (int i = 1; i < 10; i++) {
        MutableInodeFile file = inodeFile(i, 0, "file" + i);
        writeInode(file);
        writeEdge(mRoot, file);
    }
    assertEquals(9, Iterables.size(mStore.getChildren(mRoot)));
}
Also used : MutableInodeFile(alluxio.master.file.meta.MutableInodeFile) MutableInode(alluxio.master.file.meta.MutableInode) Inode(alluxio.master.file.meta.Inode) Test(org.junit.Test)

Example 3 with MutableInode

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

the class PermissionCheckerTest method createAndSetPermission.

/**
 * Helper function to create a path and set the permission to what specified in option.
 *
 * @param path path to construct the {@link AlluxioURI} from
 * @param context method context for creating a file
 */
private static void createAndSetPermission(String path, CreateFileContext context) throws Exception {
    try (LockedInodePath inodePath = sTree.lockInodePath(new AlluxioURI(path), LockPattern.WRITE_EDGE)) {
        List<Inode> result = sTree.createPath(RpcContext.NOOP, inodePath, context);
        MutableInode<?> inode = sInodeStore.getMutable(result.get(result.size() - 1).getId()).get();
        inode.setOwner(context.getOwner()).setGroup(context.getGroup()).setMode(context.getMode().toShort());
        sInodeStore.writeInode(inode);
    }
}
Also used : LockedInodePath(alluxio.master.file.meta.LockedInodePath) MutableInode(alluxio.master.file.meta.MutableInode) Inode(alluxio.master.file.meta.Inode) AlluxioURI(alluxio.AlluxioURI)

Example 4 with MutableInode

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

the class RocksInodeStore method allInodes.

@Override
public Set<MutableInode<?>> allInodes() {
    Set<MutableInode<?>> inodes = new HashSet<>();
    try (RocksIterator iter = db().newIterator(mInodesColumn.get())) {
        iter.seekToFirst();
        while (iter.isValid()) {
            inodes.add(getMutable(Longs.fromByteArray(iter.key()), ReadOption.defaults()).get());
            iter.next();
        }
    }
    return inodes;
}
Also used : MutableInode(alluxio.master.file.meta.MutableInode) RocksIterator(org.rocksdb.RocksIterator) HashSet(java.util.HashSet)

Aggregations

MutableInode (alluxio.master.file.meta.MutableInode)4 Inode (alluxio.master.file.meta.Inode)3 AlluxioURI (alluxio.AlluxioURI)2 LockedInodePath (alluxio.master.file.meta.LockedInodePath)2 MutableInodeFile (alluxio.master.file.meta.MutableInodeFile)1 HashSet (java.util.HashSet)1 Test (org.junit.Test)1 RocksIterator (org.rocksdb.RocksIterator)1