• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java INodesInPath类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



INodesInPath类属于org.apache.hadoop.hdfs.server.namenode包,在下文中一共展示了INodesInPath类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setSnapshottable

import org.apache.hadoop.hdfs.server.namenode.INodesInPath; //导入依赖的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.INodesInPath; //导入依赖的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: createSnapshot

import org.apache.hadoop.hdfs.server.namenode.INodesInPath; //导入依赖的package包/类
/**
 * Create a snapshot of the given path.
 * It is assumed that the caller will perform synchronization.
 *
 * @param iip the INodes resolved from the snapshottable directory's path
 * @param snapshotName
 *          The name of the snapshot.
 * @throws IOException
 *           Throw IOException when 1) the given path does not lead to an
 *           existing snapshottable directory, and/or 2) there exists a
 *           snapshot with the given name for the directory, and/or 3)
 *           snapshot number exceeds quota
 */
public String createSnapshot(final INodesInPath iip, String snapshotRoot,
    String snapshotName) throws IOException {
  INodeDirectory srcRoot = getSnapshottableRoot(iip);

  if (snapshotCounter == getMaxSnapshotID()) {
    // We have reached the maximum allowable snapshot ID and since we don't
    // handle rollover we will fail all subsequent snapshot creation
    // requests.
    //
    throw new SnapshotException(
        "Failed to create the snapshot. The FileSystem has run out of " +
        "snapshot IDs and ID rollover is not supported.");
  }

  srcRoot.addSnapshot(snapshotCounter, snapshotName);
    
  //create success, update id
  snapshotCounter++;
  numSnapshots.getAndIncrement();
  return Snapshot.getSnapshotPath(snapshotRoot, snapshotName);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:35,代码来源:SnapshotManager.java


示例4: diff

import org.apache.hadoop.hdfs.server.namenode.INodesInPath; //导入依赖的package包/类
/**
 * Compute the difference between two snapshots of a directory, or between a
 * snapshot of the directory and its current tree.
 */
public SnapshotDiffReport diff(final INodesInPath iip,
    final String snapshotRootPath, final String from,
    final String to) throws IOException {
  // Find the source root directory path where the snapshots were taken.
  // All the check for path has been included in the valueOf method.
  final INodeDirectory snapshotRoot = getSnapshottableRoot(iip);

  if ((from == null || from.isEmpty())
      && (to == null || to.isEmpty())) {
    // both fromSnapshot and toSnapshot indicate the current tree
    return new SnapshotDiffReport(snapshotRootPath, from, to,
        Collections.<DiffReportEntry> emptyList());
  }
  final SnapshotDiffInfo diffs = snapshotRoot
      .getDirectorySnapshottableFeature().computeDiff(snapshotRoot, from, to);
  return diffs != null ? diffs.generateReport() : new SnapshotDiffReport(
      snapshotRootPath, from, to, Collections.<DiffReportEntry> emptyList());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:SnapshotManager.java


示例5: checkSnapshotFileReplication

import org.apache.hadoop.hdfs.server.namenode.INodesInPath; //导入依赖的package包/类
/**
 * Check the replication for both the current file and all its prior snapshots
 * 
 * @param currentFile
 *          the Path of the current file
 * @param snapshotRepMap
 *          A map maintaining all the snapshots of the current file, as well
 *          as their expected replication number stored in their corresponding
 *          INodes
 * @param expectedBlockRep
 *          The expected replication number
 * @throws Exception
 */
private void checkSnapshotFileReplication(Path currentFile,
    Map<Path, Short> snapshotRepMap, short expectedBlockRep) throws Exception {
  // First check the getBlockReplication for the INode of the currentFile
  final INodeFile inodeOfCurrentFile = getINodeFile(currentFile);
  assertEquals(expectedBlockRep, inodeOfCurrentFile.getBlockReplication());
  // Then check replication for every snapshot
  for (Path ss : snapshotRepMap.keySet()) {
    final INodesInPath iip = fsdir.getINodesInPath(ss.toString(), true);
    final INodeFile ssInode = iip.getLastINode().asFile();
    // The replication number derived from the
    // INodeFileWithLink#getBlockReplication should always == expectedBlockRep
    assertEquals(expectedBlockRep, ssInode.getBlockReplication());
    // Also check the number derived from INodeFile#getFileReplication
    assertEquals(snapshotRepMap.get(ss).shortValue(),
        ssInode.getFileReplication(iip.getPathSnapshotId()));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:TestSnapshotReplication.java


示例6: createSnapshot

import org.apache.hadoop.hdfs.server.namenode.INodesInPath; //导入依赖的package包/类
/**
 * Create a snapshot of the given path.
 * It is assumed that the caller will perform synchronization.
 *
 * @param iip the INodes resolved from the snapshottable directory's path
 * @param snapshotName
 *          The name of the snapshot.
 * @throws IOException
 *           Throw IOException when 1) the given path does not lead to an
 *           existing snapshottable directory, and/or 2) there exists a
 *           snapshot with the given name for the directory, and/or 3)
 *           snapshot number exceeds quota
 */
public String createSnapshot(final INodesInPath iip, String snapshotRoot,
    String snapshotName) throws IOException {
  INodeDirectory srcRoot = getSnapshottableRoot(iip);

  if (snapshotCounter == getMaxSnapshotID()) {
    // We have reached the maximum allowable snapshot ID and since we don't
    // handle rollover we will fail all subsequent snapshot creation
    // requests.
    throw new SnapshotException(
        "Failed to create the snapshot. The FileSystem has run out of " +
        "snapshot IDs and ID rollover is not supported.");
  }

  srcRoot.addSnapshot(snapshotCounter, snapshotName);
    
  //create success, update id
  snapshotCounter++;
  numSnapshots.getAndIncrement();
  return Snapshot.getSnapshotPath(snapshotRoot, snapshotName);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:34,代码来源:SnapshotManager.java


示例7: checkSnapshotFileReplication

import org.apache.hadoop.hdfs.server.namenode.INodesInPath; //导入依赖的package包/类
/**
 * Check the replication for both the current file and all its prior snapshots
 * 
 * @param currentFile
 *          the Path of the current file
 * @param snapshotRepMap
 *          A map maintaining all the snapshots of the current file, as well
 *          as their expected replication number stored in their corresponding
 *          INodes
 * @param expectedBlockRep
 *          The expected replication number that should be returned by
 *          {@link INodeFileWithSnapshot#getBlockReplication()} of all the INodes
 * @throws Exception
 */
private void checkSnapshotFileReplication(Path currentFile,
    Map<Path, Short> snapshotRepMap, short expectedBlockRep) throws Exception {
  // First check the getBlockReplication for the INode of the currentFile
  final INodeFile inodeOfCurrentFile = getINodeFile(currentFile);
  assertEquals(expectedBlockRep, inodeOfCurrentFile.getBlockReplication());
  // Then check replication for every snapshot
  for (Path ss : snapshotRepMap.keySet()) {
    final INodesInPath iip = fsdir.getLastINodeInPath(ss.toString());
    final INodeFile ssInode = (INodeFile)iip.getLastINode();
    // The replication number derived from the
    // INodeFileWithLink#getBlockReplication should always == expectedBlockRep
    assertEquals(expectedBlockRep, ssInode.getBlockReplication());
    // Also check the number derived from INodeFile#getFileReplication
    assertEquals(snapshotRepMap.get(ss).shortValue(),
        ssInode.getFileReplication(iip.getPathSnapshotId()));
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:32,代码来源:TestSnapshotReplication.java


示例8: setSnapshottable

import org.apache.hadoop.hdfs.server.namenode.INodesInPath; //导入依赖的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);
  }


  final INodeDirectorySnapshottable s;
  if (d.isSnapshottable()) {
    //The directory is already a snapshottable directory.
    s = (INodeDirectorySnapshottable)d; 
    s.setSnapshotQuota(INodeDirectorySnapshottable.SNAPSHOT_LIMIT);
  } else {
    s = d.replaceSelf4INodeDirectorySnapshottable(iip.getLatestSnapshot(),
        fsdir.getINodeMap());
  }
  addSnapshottable(s);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:25,代码来源:SnapshotManager.java


示例9: resetSnapshottable

import org.apache.hadoop.hdfs.server.namenode.INodesInPath; //导入依赖的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);
  if (!d.isSnapshottable()) {
    // the directory is already non-snapshottable
    return;
  }
  final INodeDirectorySnapshottable s = (INodeDirectorySnapshottable) d;
  if (s.getNumSnapshots() > 0) {
    throw new SnapshotException("The directory " + path + " has snapshot(s). "
        + "Please redo the operation after removing all the snapshots.");
  }

  if (s == fsdir.getRoot()) {
    s.setSnapshotQuota(0); 
  } else {
    s.replaceSelf(iip.getLatestSnapshot(), fsdir.getINodeMap());
  }
  removeSnapshottable(s);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:26,代码来源:SnapshotManager.java


示例10: diff

import org.apache.hadoop.hdfs.server.namenode.INodesInPath; //导入依赖的package包/类
/**
 * Compute the difference between two snapshots of a directory, or between a
 * snapshot of the directory and its current tree.
 */
public SnapshotDiffInfo diff(final String path, final String from,
    final String to) throws IOException {
  if ((from == null || from.isEmpty())
      && (to == null || to.isEmpty())) {
    // both fromSnapshot and toSnapshot indicate the current tree
    return null;
  }

  // Find the source root directory path where the snapshots were taken.
  // All the check for path has been included in the valueOf method.
  INodesInPath inodesInPath = fsdir.getINodesInPath4Write(path.toString());
  final INodeDirectorySnapshottable snapshotRoot = INodeDirectorySnapshottable
      .valueOf(inodesInPath.getLastINode(), path);
  
  return snapshotRoot.computeDiff(from, to);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:21,代码来源:SnapshotManager.java


示例11: checkSnapshotFileReplication

import org.apache.hadoop.hdfs.server.namenode.INodesInPath; //导入依赖的package包/类
/**
 * Check the replication for both the current file and all its prior snapshots
 * 
 * @param currentFile
 *          the Path of the current file
 * @param snapshotRepMap
 *          A map maintaining all the snapshots of the current file, as well
 *          as their expected replication number stored in their corresponding
 *          INodes
 * @param expectedBlockRep
 *          The expected replication number that should be returned by
 *          {@link INodeFileWithSnapshot#getBlockReplication()} of all the INodes
 * @throws Exception
 */
private void checkSnapshotFileReplication(Path currentFile,
    Map<Path, Short> snapshotRepMap, short expectedBlockRep) throws Exception {
  // First check the getBlockReplication for the INode of the currentFile
  final INodeFile inodeOfCurrentFile = getINodeFile(currentFile);
  assertEquals(expectedBlockRep, inodeOfCurrentFile.getBlockReplication());
  // Then check replication for every snapshot
  for (Path ss : snapshotRepMap.keySet()) {
    final INodesInPath iip = fsdir.getLastINodeInPath(ss.toString());
    final INodeFile ssInode = (INodeFile)iip.getLastINode();
    // The replication number derived from the
    // INodeFileWithLink#getBlockReplication should always == expectedBlockRep
    assertEquals(expectedBlockRep, ssInode.getBlockReplication());
    // Also check the number derived from INodeFile#getFileReplication
    assertEquals(snapshotRepMap.get(ss).shortValue(),
        ssInode.getFileReplication(iip.getPathSnapshot()));
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:32,代码来源:TestSnapshotReplication.java


示例12: setSnapshottable

import org.apache.hadoop.hdfs.server.namenode.INodesInPath; //导入依赖的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);
  }


  final INodeDirectorySnapshottable s;
  if (d.isSnapshottable()) {
    //The directory is already a snapshottable directory.
    s = (INodeDirectorySnapshottable)d; 
    s.setSnapshotQuota(INodeDirectorySnapshottable.SNAPSHOT_LIMIT);
  } else {
    s = d.replaceSelf4INodeDirectorySnapshottable(iip.getLatestSnapshotId(),
        fsdir.getINodeMap());
  }
  addSnapshottable(s);
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:25,代码来源:SnapshotManager.java


示例13: resetSnapshottable

import org.apache.hadoop.hdfs.server.namenode.INodesInPath; //导入依赖的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);
  if (!d.isSnapshottable()) {
    // the directory is already non-snapshottable
    return;
  }
  final INodeDirectorySnapshottable s = (INodeDirectorySnapshottable) d;
  if (s.getNumSnapshots() > 0) {
    throw new SnapshotException("The directory " + path + " has snapshot(s). "
        + "Please redo the operation after removing all the snapshots.");
  }

  if (s == fsdir.getRoot()) {
    s.setSnapshotQuota(0); 
  } else {
    s.replaceSelf(iip.getLatestSnapshotId(), fsdir.getINodeMap());
  }
  removeSnapshottable(s);
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:26,代码来源:SnapshotManager.java


示例14: getSnapshottableRoot

import org.apache.hadoop.hdfs.server.namenode.INodesInPath; //导入依赖的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


示例15: deleteSnapshot

import org.apache.hadoop.hdfs.server.namenode.INodesInPath; //导入依赖的package包/类
/**
 * Delete a snapshot for a snapshottable directory
 * @param snapshotName Name of the snapshot to be deleted
 * @param collectedBlocks Used to collect information to update blocksMap 
 * @throws IOException
 */
public void deleteSnapshot(final INodesInPath iip, final String snapshotName,
    BlocksMapUpdateInfo collectedBlocks, final List<INode> removedINodes)
    throws IOException {
  INodeDirectory srcRoot = getSnapshottableRoot(iip);
  srcRoot.removeSnapshot(fsdir.getBlockStoragePolicySuite(), snapshotName,
      collectedBlocks, removedINodes);
  numSnapshots.getAndDecrement();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:SnapshotManager.java


示例16: deleteSnapshot

import org.apache.hadoop.hdfs.server.namenode.INodesInPath; //导入依赖的package包/类
/**
 * Delete a snapshot for a snapshottable directory
 * @param snapshotName Name of the snapshot to be deleted
 * @param reclaimContext Used to collect information to reclaim blocks
 *                       and inodes
 */
public void deleteSnapshot(final INodesInPath iip, final String snapshotName,
    INode.ReclaimContext reclaimContext) throws IOException {
  INodeDirectory srcRoot = getSnapshottableRoot(iip);
  srcRoot.removeSnapshot(reclaimContext, snapshotName);
  numSnapshots.getAndDecrement();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:13,代码来源:SnapshotManager.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OrderedHealthAggregator类代码示例发布时间:2022-05-22
下一篇:
Java LocalizerAction类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap