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


Java Snapshot.getSnapshotPath方法代码示例

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


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

示例1: renameSnapshot

import org.apache.hadoop.hdfs.server.namenode.snapshot.Snapshot; //导入方法依赖的package包/类
/**
 * Rename a snapshot
 * @param path The directory path where the snapshot was taken
 * @param snapshotOldName Old snapshot name
 * @param snapshotNewName New snapshot name
 * @throws SafeModeException
 * @throws IOException 
 */
void renameSnapshot(
    String path, String snapshotOldName, String snapshotNewName,
    boolean logRetryCache) throws IOException {
  checkOperation(OperationCategory.WRITE);
  boolean success = false;
  writeLock();
  try {
    checkOperation(OperationCategory.WRITE);
    checkNameNodeSafeMode("Cannot rename snapshot for " + path);
    FSDirSnapshotOp.renameSnapshot(dir, snapshotManager, path,
        snapshotOldName, snapshotNewName, logRetryCache);
    success = true;
  } finally {
    writeUnlock();
  }
  getEditLog().logSync();
  String oldSnapshotRoot = Snapshot.getSnapshotPath(path, snapshotOldName);
  String newSnapshotRoot = Snapshot.getSnapshotPath(path, snapshotNewName);
  logAuditEvent(success, "renameSnapshot", oldSnapshotRoot,
      newSnapshotRoot, null);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:30,代码来源:FSNamesystem.java

示例2: renameSnapshot

import org.apache.hadoop.hdfs.server.namenode.snapshot.Snapshot; //导入方法依赖的package包/类
/**
 * Rename a snapshot
 * @param path The directory path where the snapshot was taken
 * @param snapshotOldName Old snapshot name
 * @param snapshotNewName New snapshot name
 * @throws SafeModeException
 * @throws IOException 
 */
void renameSnapshot(
    String path, String snapshotOldName, String snapshotNewName,
    boolean logRetryCache) throws IOException {
  boolean success = false;
  writeLock();
  try {
    checkOperation(OperationCategory.WRITE);
    checkNameNodeSafeMode("Cannot rename snapshot for " + path);
    FSDirSnapshotOp.renameSnapshot(dir, snapshotManager, path,
        snapshotOldName, snapshotNewName, logRetryCache);
    success = true;
  } finally {
    writeUnlock();
  }
  getEditLog().logSync();
  String oldSnapshotRoot = Snapshot.getSnapshotPath(path, snapshotOldName);
  String newSnapshotRoot = Snapshot.getSnapshotPath(path, snapshotNewName);
  logAuditEvent(success, "renameSnapshot", oldSnapshotRoot,
      newSnapshotRoot, null);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:29,代码来源:FSNamesystem.java

示例3: getSnapshotDiffReport

import org.apache.hadoop.hdfs.server.namenode.snapshot.Snapshot; //导入方法依赖的package包/类
/**
 * Get the difference between two snapshots (or between a snapshot and the
 * current status) of a snapshottable directory.
 * 
 * @param path The full path of the snapshottable directory.
 * @param fromSnapshot Name of the snapshot to calculate the diff from. Null
 *          or empty string indicates the current tree.
 * @param toSnapshot Name of the snapshot to calculated the diff to. Null or
 *          empty string indicates the current tree.
 * @return A report about the difference between {@code fromSnapshot} and 
 *         {@code toSnapshot}. Modified/deleted/created/renamed files and 
 *         directories belonging to the snapshottable directories are listed 
 *         and labeled as M/-/+/R respectively. 
 * @throws IOException
 */
SnapshotDiffReport getSnapshotDiffReport(String path,
    String fromSnapshot, String toSnapshot) throws IOException {
  SnapshotDiffReport diffs = null;
  checkOperation(OperationCategory.READ);
  readLock();
  try {
    checkOperation(OperationCategory.READ);
    diffs = FSDirSnapshotOp.getSnapshotDiffReport(dir, snapshotManager,
        path, fromSnapshot, toSnapshot);
  } finally {
    readUnlock();
  }
  String fromSnapshotRoot = (fromSnapshot == null || fromSnapshot.isEmpty()) ?
      path : Snapshot.getSnapshotPath(path, fromSnapshot);
  String toSnapshotRoot = (toSnapshot == null || toSnapshot.isEmpty()) ?
      path : Snapshot.getSnapshotPath(path, toSnapshot);
  logAuditEvent(diffs != null, "computeSnapshotDiff", fromSnapshotRoot,
      toSnapshotRoot, null);
  return diffs;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:36,代码来源:FSNamesystem.java

示例4: checkSubtreeReadPermission

import org.apache.hadoop.hdfs.server.namenode.snapshot.Snapshot; //导入方法依赖的package包/类
private static void checkSubtreeReadPermission(
    FSDirectory fsd, final FSPermissionChecker pc, String snapshottablePath,
    String snapshot) throws IOException {
  final String fromPath = snapshot == null ?
      snapshottablePath : Snapshot.getSnapshotPath(snapshottablePath,
      snapshot);
  INodesInPath iip = fsd.getINodesInPath(fromPath, true);
  fsd.checkPermission(pc, iip, false, null, null, FsAction.READ,
      FsAction.READ);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:FSDirSnapshotOp.java

示例5: deleteSnapshot

import org.apache.hadoop.hdfs.server.namenode.snapshot.Snapshot; //导入方法依赖的package包/类
/**
 * Delete a snapshot of a snapshottable directory
 * @param snapshotRoot The snapshottable directory
 * @param snapshotName The name of the to-be-deleted snapshot
 * @throws SafeModeException
 * @throws IOException
 */
void deleteSnapshot(String snapshotRoot, String snapshotName,
    boolean logRetryCache) throws IOException {
  checkOperation(OperationCategory.WRITE);
  boolean success = false;
  writeLock();
  BlocksMapUpdateInfo blocksToBeDeleted = null;
  try {
    checkOperation(OperationCategory.WRITE);
    checkNameNodeSafeMode("Cannot delete snapshot for " + snapshotRoot);

    blocksToBeDeleted = FSDirSnapshotOp.deleteSnapshot(dir, snapshotManager,
        snapshotRoot, snapshotName, logRetryCache);
    success = true;
  } finally {
    writeUnlock();
  }
  getEditLog().logSync();

  // Breaking the pattern as removing blocks have to happen outside of the
  // global lock
  if (blocksToBeDeleted != null) {
    removeBlocks(blocksToBeDeleted);
  }

  String rootPath = Snapshot.getSnapshotPath(snapshotRoot, snapshotName);
  logAuditEvent(success, "deleteSnapshot", rootPath, null, null);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:35,代码来源:FSNamesystem.java

示例6: deleteSnapshot

import org.apache.hadoop.hdfs.server.namenode.snapshot.Snapshot; //导入方法依赖的package包/类
/**
 * Delete a snapshot of a snapshottable directory
 * @param snapshotRoot The snapshottable directory
 * @param snapshotName The name of the to-be-deleted snapshot
 * @throws SafeModeException
 * @throws IOException
 */
void deleteSnapshot(String snapshotRoot, String snapshotName,
    boolean logRetryCache) throws IOException {
  boolean success = false;
  writeLock();
  BlocksMapUpdateInfo blocksToBeDeleted = null;
  try {
    checkOperation(OperationCategory.WRITE);
    checkNameNodeSafeMode("Cannot delete snapshot for " + snapshotRoot);

    blocksToBeDeleted = FSDirSnapshotOp.deleteSnapshot(dir, snapshotManager,
        snapshotRoot, snapshotName, logRetryCache);
    success = true;
  } finally {
    writeUnlock();
  }
  getEditLog().logSync();

  // Breaking the pattern as removing blocks have to happen outside of the
  // global lock
  if (blocksToBeDeleted != null) {
    removeBlocks(blocksToBeDeleted);
  }

  String rootPath = Snapshot.getSnapshotPath(snapshotRoot, snapshotName);
  logAuditEvent(success, "deleteSnapshot", rootPath, null, null);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:34,代码来源:FSNamesystem.java


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