use of alluxio.master.file.meta.MutableInodeDirectory in project alluxio by Alluxio.
the class CachingInodeStoreMockedBackingStoreTest method createInodeDir.
private MutableInodeDirectory createInodeDir(long id, long parentId) {
MutableInodeDirectory dir = MutableInodeDirectory.create(id, parentId, Long.toString(id), CreateDirectoryContext.defaults());
mStore.writeNewInode(dir);
return dir;
}
use of alluxio.master.file.meta.MutableInodeDirectory in project alluxio by Alluxio.
the class InodeStoreTest method updateInode.
@Test
public void updateInode() {
writeInode(mRoot);
MutableInodeDirectory mutableRoot = mStore.getMutable(mRoot.getId()).get().asDirectory();
mutableRoot.setLastModificationTimeMs(163, true);
writeInode(mutableRoot);
assertEquals(163, mStore.get(mRoot.getId()).get().getLastModificationTimeMs());
}
use of alluxio.master.file.meta.MutableInodeDirectory in project alluxio by Alluxio.
the class InodeStoreTest method repeatedAddRemoveAndList.
@Test
public void repeatedAddRemoveAndList() {
MutableInodeFile child = inodeFile(1, 0, "child");
writeInode(mRoot);
writeInode(child);
writeEdge(mRoot, child);
for (int i = 0; i < 3; i++) {
removeParentEdge(child);
writeEdge(mRoot, child);
}
List<MutableInodeDirectory> dirs = new ArrayList<>();
for (int i = 5; i < 5 + CACHE_SIZE; i++) {
String childName = "child" + i;
MutableInodeDirectory dir = inodeDir(i, 0, childName);
dirs.add(dir);
writeInode(dir);
writeEdge(mRoot, dir);
mStore.getChild(mRoot, childName);
}
for (MutableInodeDirectory dir : dirs) {
removeParentEdge(dir);
}
assertEquals(1, Iterables.size(mStore.getChildren(mRoot)));
}
use of alluxio.master.file.meta.MutableInodeDirectory in project alluxio by Alluxio.
the class InodeStoreBench method writeInode.
private static void writeInode() {
int id = NEXT_INODE_ID.getAndIncrement();
CreateDirectoryContext createContext = CreateDirectoryContext.defaults();
MutableInodeDirectory dir = MutableInodeDirectory.create(id, 0, CommonUtils.randomAlphaNumString(30), createContext);
sStore.writeInode(dir);
}
use of alluxio.master.file.meta.MutableInodeDirectory in project alluxio by Alluxio.
the class CachingInodeStoreMockedBackingStoreTest method backupRestore.
@Test
public void backupRestore() throws Exception {
MutableInodeDirectory child = createInodeDir(10, 0);
mStore.writeNewInode(child);
mStore.addChild(0, child);
mStore.writeInode(MutableInodeDirectory.create(1, 1, "blah", CreateDirectoryContext.defaults()));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
mStore.writeToCheckpoint(baos);
mStore.restoreFromCheckpoint(new CheckpointInputStream(new ByteArrayInputStream(baos.toByteArray())));
assertEquals(child.getName(), mStore.get(child.getId()).get().getName());
assertEquals(child.getId(), mStore.getChild(0L, child.getName()).get().getId());
}
Aggregations