INode.Feature@Private public class DirectorySnapshottableFeature extends DirectoryWithSnapshotFeature
DirectoryWithSnapshotFeature, and
maintains extra information about all the snapshots taken on this directory.DirectoryWithSnapshotFeature.DirectoryDiff, DirectoryWithSnapshotFeature.DirectoryDiffList| Constructor | Description |
|---|---|
DirectorySnapshottableFeature(DirectoryWithSnapshotFeature feature) |
| Modifier and Type | Method | Description |
|---|---|---|
Snapshot |
addSnapshot(INodeDirectory snapshotRoot,
SnapshotManager snapshotManager,
java.lang.String name,
LeaseManager leaseManager,
long now) |
Add a snapshot.
|
void |
computeContentSummary4Snapshot(BlockStoragePolicySuite bsps,
ContentCounts counts) |
|
void |
dumpTreeRecursively(INodeDirectory snapshotRoot,
java.io.PrintWriter out,
java.lang.StringBuilder prefix,
int snapshot) |
|
byte[][] |
findRenameTargetPath(INodeDirectory snapshotRoot,
INodeReference.WithName wn,
int snapshotId) |
We just found a deleted WithName node as the source of a rename operation.
|
int |
getNumSnapshots() |
|
Snapshot |
getSnapshot(byte[] snapshotName) |
|
Snapshot |
getSnapshotById(int sid) |
|
Snapshot |
getSnapshotByName(INodeDirectory snapshotRoot,
java.lang.String snapshotName) |
Find the snapshot matching the given name.
|
ReadOnlyList<Snapshot> |
getSnapshotList() |
|
int |
getSnapshotQuota() |
|
Snapshot |
removeSnapshot(INode.ReclaimContext reclaimContext,
INodeDirectory snapshotRoot,
java.lang.String snapshotName,
long now,
SnapshotManager snapshotManager) |
Remove the snapshot with the given name from
snapshotsByNames,
and delete all the corresponding DirectoryDiff. |
void |
renameSnapshot(java.lang.String path,
java.lang.String oldName,
java.lang.String newName,
long mtime) |
Rename a snapshot
|
void |
setSnapshotQuota(int snapshotQuota) |
|
java.lang.String |
toString() |
addChild, cleanDirectory, clear, computeQuotaUsage4CurrentDirectory, destroyDstSubtree, getChild, getChildrenList, getDiffs, getLastSnapshotId, getSnapshotDirectory, removeChild, saveChild2Snapshotpublic DirectorySnapshottableFeature(DirectoryWithSnapshotFeature feature)
public int getNumSnapshots()
public Snapshot getSnapshot(byte[] snapshotName)
public Snapshot getSnapshotById(int sid)
public ReadOnlyList<Snapshot> getSnapshotList()
snapshotsByNames as a ReadOnlyListpublic void renameSnapshot(java.lang.String path,
java.lang.String oldName,
java.lang.String newName,
long mtime)
throws SnapshotException
path - The directory path where the snapshot was taken. Used for
generating exception message.oldName - Old name of the snapshotnewName - New name the snapshot will be renamed tomtime - The snapshot modification time set by Time.now().SnapshotException - Throw SnapshotException when either the snapshot with the old
name does not exist or a snapshot with the new name already
existspublic int getSnapshotQuota()
public void setSnapshotQuota(int snapshotQuota)
public Snapshot addSnapshot(INodeDirectory snapshotRoot, SnapshotManager snapshotManager, java.lang.String name, LeaseManager leaseManager, long now) throws SnapshotException
snapshotRoot - Root of the snapshot.snapshotManager - SnapshotManager Instance.name - Name of the snapshot.leaseManager - SnapshotException - Throw SnapshotException when there is a snapshot
with the same name already exists or snapshot quota exceedspublic Snapshot removeSnapshot(INode.ReclaimContext reclaimContext, INodeDirectory snapshotRoot, java.lang.String snapshotName, long now, SnapshotManager snapshotManager) throws SnapshotException
snapshotsByNames,
and delete all the corresponding DirectoryDiff.reclaimContext - records blocks and inodes that need to be reclaimedsnapshotRoot - The directory where we take snapshotssnapshotName - The name of the snapshot to be removednow - The snapshot deletion time set by Time.now().SnapshotExceptionpublic void computeContentSummary4Snapshot(BlockStoragePolicySuite bsps, ContentCounts counts) throws org.apache.hadoop.security.AccessControlException
computeContentSummary4Snapshot in class DirectoryWithSnapshotFeatureorg.apache.hadoop.security.AccessControlExceptionpublic Snapshot getSnapshotByName(INodeDirectory snapshotRoot, java.lang.String snapshotName) throws SnapshotException
snapshotRoot - The directory where snapshots were taken.snapshotName - The name of the snapshot.SnapshotException - If snapshotName is not null or empty, but there
is no snapshot matching the name.public byte[][] findRenameTargetPath(INodeDirectory snapshotRoot, INodeReference.WithName wn, int snapshotId)
public java.lang.String toString()
toString in class DirectoryWithSnapshotFeature@VisibleForTesting public void dumpTreeRecursively(INodeDirectory snapshotRoot, java.io.PrintWriter out, java.lang.StringBuilder prefix, int snapshot)
Copyright © 2008–2025 Apache Software Foundation. All rights reserved.