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);
}
}
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)));
}
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);
}
}
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;
}
Aggregations