当前位置: 首页>>代码示例>>Java>>正文


Java INodeDirectory.valueOf方法代码示例

本文整理汇总了Java中org.apache.hadoop.hdfs.server.namenode.INodeDirectory.valueOf方法的典型用法代码示例。如果您正苦于以下问题:Java INodeDirectory.valueOf方法的具体用法?Java INodeDirectory.valueOf怎么用?Java INodeDirectory.valueOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hdfs.server.namenode.INodeDirectory的用法示例。


在下文中一共展示了INodeDirectory.valueOf方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setSnapshottable

import org.apache.hadoop.hdfs.server.namenode.INodeDirectory; //导入方法依赖的package包/类
/**
 * Set the given directory as a snapshottable directory.
 * If the path is already a snapshottable directory, update the quota.
 */
public void setSnapshottable(final String path, boolean checkNestedSnapshottable)
    throws IOException {
  final INodesInPath iip = fsdir.getINodesInPath4Write(path);
  final INodeDirectory d = INodeDirectory.valueOf(iip.getLastINode(), path);
  if (checkNestedSnapshottable) {
    checkNestedSnapshottable(d, path);
  }

  if (d.isSnapshottable()) {
    //The directory is already a snapshottable directory.
    d.setSnapshotQuota(DirectorySnapshottableFeature.SNAPSHOT_LIMIT);
  } else {
    d.addSnapshottableFeature();
  }
  addSnapshottable(d);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:SnapshotManager.java

示例2: resetSnapshottable

import org.apache.hadoop.hdfs.server.namenode.INodeDirectory; //导入方法依赖的package包/类
/**
 * Set the given snapshottable directory to non-snapshottable.
 * 
 * @throws SnapshotException if there are snapshots in the directory.
 */
public void resetSnapshottable(final String path) throws IOException {
  final INodesInPath iip = fsdir.getINodesInPath4Write(path);
  final INodeDirectory d = INodeDirectory.valueOf(iip.getLastINode(), path);
  DirectorySnapshottableFeature sf = d.getDirectorySnapshottableFeature();
  if (sf == null) {
    // the directory is already non-snapshottable
    return;
  }
  if (sf.getNumSnapshots() > 0) {
    throw new SnapshotException("The directory " + path + " has snapshot(s). "
        + "Please redo the operation after removing all the snapshots.");
  }

  if (d == fsdir.getRoot()) {
    d.setSnapshotQuota(0);
  } else {
    d.removeSnapshottableFeature();
  }
  removeSnapshottable(d);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:SnapshotManager.java

示例3: testSetQuota

import org.apache.hadoop.hdfs.server.namenode.INodeDirectory; //导入方法依赖的package包/类
@Test (timeout=60000)
public void testSetQuota() throws Exception {
  final Path dir = new Path("/TestSnapshot");
  hdfs.mkdirs(dir);
  // allow snapshot on dir and create snapshot s1
  SnapshotTestHelper.createSnapshot(hdfs, dir, "s1");
  
  Path sub = new Path(dir, "sub");
  hdfs.mkdirs(sub);
  Path fileInSub = new Path(sub, "file");
  DFSTestUtil.createFile(hdfs, fileInSub, BLOCKSIZE, REPLICATION, seed);
  INodeDirectory subNode = INodeDirectory.valueOf(
      fsdir.getINode(sub.toString()), sub);
  // subNode should be a INodeDirectory, but not an INodeDirectoryWithSnapshot
  assertFalse(subNode.isWithSnapshot());
  
  hdfs.setQuota(sub, Long.MAX_VALUE - 1, Long.MAX_VALUE - 1);
  subNode = INodeDirectory.valueOf(fsdir.getINode(sub.toString()), sub);
  assertTrue(subNode.isQuotaSet());
  assertFalse(subNode.isWithSnapshot());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestSetQuotaWithSnapshot.java

示例4: getSnapshottableRoot

import org.apache.hadoop.hdfs.server.namenode.INodeDirectory; //导入方法依赖的package包/类
/**
* Find the source root directory where the snapshot will be taken
* for a given path.
*
* @return Snapshottable directory.
* @throws IOException
*           Throw IOException when the given path does not lead to an
*           existing snapshottable directory.
*/
public INodeDirectory getSnapshottableRoot(final INodesInPath iip)
    throws IOException {
  final String path = iip.getPath();
  final INodeDirectory dir = INodeDirectory.valueOf(iip.getLastINode(), path);
  if (!dir.isSnapshottable()) {
    throw new SnapshotException(
        "Directory is not a snapshottable directory: " + path);
  }
  return dir;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:SnapshotManager.java

示例5: getDir

import org.apache.hadoop.hdfs.server.namenode.INodeDirectory; //导入方法依赖的package包/类
private static INodeDirectory getDir(final FSDirectory fsdir, final Path dir)
    throws IOException {
  final String dirStr = dir.toString();
  return INodeDirectory.valueOf(fsdir.getINode(dirStr), dirStr);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:6,代码来源:TestSnapshotDeletion.java


注:本文中的org.apache.hadoop.hdfs.server.namenode.INodeDirectory.valueOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。