/** * 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(); }
/** * Rename the given snapshot * @param oldSnapshotName * Old name of the snapshot * @param newSnapshotName * New name of the snapshot * @throws IOException * Throw IOException when 1) the given path does not lead to an * existing snapshottable directory, and/or 2) the snapshot with the * old name does not exist for the directory, and/or 3) there exists * a snapshot with the new name for the directory */ public void renameSnapshot(final INodesInPath iip, final String snapshotRoot, final String oldSnapshotName, final String newSnapshotName) throws IOException { final INodeDirectory srcRoot = getSnapshottableRoot(iip); srcRoot.renameSnapshot(snapshotRoot, oldSnapshotName, newSnapshotName); }
/** * 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 snapshotPath, 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. INodeDirectory snapshotRootDir; if (this.snapshotDiffAllowSnapRootDescendant) { snapshotRootDir = getSnapshottableAncestorDir(iip); } else { snapshotRootDir = getSnapshottableRoot(iip); } Preconditions.checkNotNull(snapshotRootDir); INodeDirectory snapshotDescendantDir = INodeDirectory.valueOf( iip.getLastINode(), snapshotPath); if ((from == null || from.isEmpty()) && (to == null || to.isEmpty())) { // both fromSnapshot and toSnapshot indicate the current tree return new SnapshotDiffReport(snapshotPath, from, to, Collections.<DiffReportEntry> emptyList()); } final SnapshotDiffInfo diffs = snapshotRootDir .getDirectorySnapshottableFeature().computeDiff( snapshotRootDir, snapshotDescendantDir, from, to); return diffs != null ? diffs.generateReport() : new SnapshotDiffReport( snapshotPath, from, to, Collections.<DiffReportEntry> emptyList()); }
final INodesInPath iip, String snapshotRoot, String snapshotName) throws IOException { INodeDirectory srcRoot = getSnapshottableRoot(iip);
/** * Compute the partial difference between two snapshots of a directory, * or between a snapshot of the directory and its current tree. */ public SnapshotDiffReportListing diff(final INodesInPath iip, final String snapshotPath, final String from, final String to, byte[] startPath, int index, int snapshotDiffReportLimit) 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. INodeDirectory snapshotRootDir; if (this.snapshotDiffAllowSnapRootDescendant) { snapshotRootDir = getSnapshottableAncestorDir(iip); } else { snapshotRootDir = getSnapshottableRoot(iip); } Preconditions.checkNotNull(snapshotRootDir); INodeDirectory snapshotDescendantDir = INodeDirectory.valueOf( iip.getLastINode(), snapshotPath); final SnapshotDiffListingInfo diffs = snapshotRootDir.getDirectorySnapshottableFeature() .computeDiff(snapshotRootDir, snapshotDescendantDir, from, to, startPath, index, snapshotDiffReportLimit); return diffs != null ? diffs.generateReport() : new SnapshotDiffReportListing(); }
/** * Rename the given snapshot * @param oldSnapshotName * Old name of the snapshot * @param newSnapshotName * New name of the snapshot * @throws IOException * Throw IOException when 1) the given path does not lead to an * existing snapshottable directory, and/or 2) the snapshot with the * old name does not exist for the directory, and/or 3) there exists * a snapshot with the new name for the directory */ public void renameSnapshot(final INodesInPath iip, final String snapshotRoot, final String oldSnapshotName, final String newSnapshotName) throws IOException { final INodeDirectory srcRoot = getSnapshottableRoot(iip); srcRoot.renameSnapshot(snapshotRoot, oldSnapshotName, newSnapshotName); }
/** * Rename the given snapshot * @param oldSnapshotName * Old name of the snapshot * @param newSnapshotName * New name of the snapshot * @throws IOException * Throw IOException when 1) the given path does not lead to an * existing snapshottable directory, and/or 2) the snapshot with the * old name does not exist for the directory, and/or 3) there exists * a snapshot with the new name for the directory */ public void renameSnapshot(final INodesInPath iip, final String snapshotRoot, final String oldSnapshotName, final String newSnapshotName) throws IOException { final INodeDirectory srcRoot = getSnapshottableRoot(iip); srcRoot.renameSnapshot(snapshotRoot, oldSnapshotName, newSnapshotName); }
/** * 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(); }
/** * 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(); }
/** * 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()); }
/** * 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()); }
INodeDirectory srcRoot = getSnapshottableRoot(iip);
INodeDirectory srcRoot = getSnapshottableRoot(iip);
doReturn(ids).when(sm).getSnapshottableRoot((INodesInPath) anyObject()); doReturn(testMaxSnapshotLimit).when(sm).getMaxSnapshotID();