@InterfaceAudience.Private public class INodeFileWithSnapshot extends INodeFile implements FileWithSnapshot
INodeFile that is snapshotted.INode.BlocksMapUpdateInfoFileWithSnapshot.FileDiff, FileWithSnapshot.FileDiffList, FileWithSnapshot.UtilINodeFileAttributes.SnapshotCopy| Constructor and Description |
|---|
INodeFileWithSnapshot(INodeFile f) |
INodeFileWithSnapshot(INodeFile f,
FileWithSnapshot.FileDiffList diffs) |
| Modifier and Type | Method and Description |
|---|---|
INodeFile |
asINodeFile() |
Quota.Counts |
cleanSubtree(Snapshot snapshot,
Snapshot prior,
INode.BlocksMapUpdateInfo collectedBlocks,
List<INode> removedINodes,
boolean countDiffChange)
Clean the subtree under this inode and collect the blocks from the descents
for further block deletion/update.
|
void |
deleteCurrentFile()
Delete the file from the current tree
|
FileWithSnapshot.FileDiffList |
getDiffs() |
INodeFileAttributes |
getSnapshotINode(Snapshot snapshot) |
boolean |
isCurrentFileDeleted()
Is the current file deleted?
|
INodeFileWithSnapshot |
recordModification(Snapshot latest,
INodeMap inodeMap)
This inode is being modified.
|
String |
toDetailString() |
INodeFileUnderConstructionWithSnapshot |
toUnderConstruction(String clientName,
String clientMachine,
DatanodeDescriptor clientNode)
Convert this file to an
INodeFileUnderConstruction. |
asFile, computeContentSummary, computeFileSize, computeFileSize, computeFileSize, computeFileSizeNotIncludingLastUcBlock, computeQuotaUsage, destroyAndCollectBlocks, diskspaceConsumed, diskspaceConsumed, dumpTreeRecursively, getBlockReplication, getBlocks, getFileReplication, getFileReplication, getHeaderLong, getLastBlock, getName, getPreferredBlockSize, isFile, isUnderConstruction, numBlocks, setBlock, setBlocks, setFileReplication, setFileReplication, valueOf, valueOfgetFsPermissionShort, getId, getLocalNameBytes, getNext, getPermissionLong, setAccessTime, setLocalName, setModificationTime, setNext, updateModificationTimeaddSpaceConsumed, asDirectory, asReference, asSymlink, clear, compareTo, computeContentSummary, computeQuotaUsage, computeQuotaUsage, dumpTreeRecursively, dumpTreeRecursively, equals, getAccessTime, getDsQuota, getFsPermission, getFullPathName, getGroupName, getKey, getLocalName, getModificationTime, getNsQuota, getObjectString, getParent, getParentReference, getParentString, getUserName, hashCode, isAncestorDirectory, isDirectory, isInLatestSnapshot, isQuotaSet, isReference, isSymlink, setAccessTime, setModificationTime, setParent, setParentReference, shouldRecordInSrcSnapshot, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetAccessTime, getFsPermission, getFsPermissionShort, getGroupName, getLocalNameBytes, getModificationTime, getPermissionLong, getUserNamecomputeContentSummarypublic INodeFileWithSnapshot(INodeFile f)
public INodeFileWithSnapshot(INodeFile f, FileWithSnapshot.FileDiffList diffs)
public INodeFileUnderConstructionWithSnapshot toUnderConstruction(String clientName, String clientMachine, DatanodeDescriptor clientNode)
INodeFileINodeFileUnderConstruction.toUnderConstruction in class INodeFilepublic boolean isCurrentFileDeleted()
FileWithSnapshotisCurrentFileDeleted in interface FileWithSnapshotpublic void deleteCurrentFile()
FileWithSnapshotdeleteCurrentFile in interface FileWithSnapshotpublic INodeFileAttributes getSnapshotINode(Snapshot snapshot)
getSnapshotINode in class INodeFilepublic INodeFileWithSnapshot recordModification(Snapshot latest, INodeMap inodeMap) throws QuotaExceededException
INoderecordModification in class INodeFilelatest - the latest snapshot that has been taken.
Note that it is null if no snapshots have been taken.inodeMap - while recording modification, the inode or its parent may
get replaced, and the inodeMap needs to be updated.QuotaExceededExceptionpublic INodeFile asINodeFile()
asINodeFile in interface FileWithSnapshotINodeFile view of this object.public FileWithSnapshot.FileDiffList getDiffs()
getDiffs in interface FileWithSnapshotpublic Quota.Counts cleanSubtree(Snapshot snapshot, Snapshot prior, INode.BlocksMapUpdateInfo collectedBlocks, List<INode> removedINodes, boolean countDiffChange) throws QuotaExceededException
INodeIn general, we have the following rules. 1. When deleting a file/directory in the current tree, we have different actions according to the type of the node to delete. 1.1 The current inode (this) is anINodeFile. 1.1.1 Ifprioris null, there is no snapshot taken on ancestors before. Thus we simply destroy (i.e., to delete completely, no need to save snapshot copy) the current INode and collect its blocks for further cleansing. 1.1.2 Else do nothing since the current INode will be stored as a snapshot copy. 1.2 The current inode is anINodeDirectory. 1.2.1 Ifprioris null, there is no snapshot taken on ancestors before. Similarly, we destroy the whole subtree and collect blocks. 1.2.2 Else do nothing with the current INode. Recursively clean its children. 1.3 The current inode is aFileWithSnapshot. Call recordModification(..) to capture the current states. Mark the INode as deleted. 1.4 The current inode is aINodeDirectoryWithSnapshot. Call recordModification(..) to capture the current states. Destroy files/directories created after the latest snapshot (i.e., the inodes stored in the created list of the latest snapshot). Recursively clean remaining children. 2. When deleting a snapshot. 2.1 To cleanINodeFile: do nothing. 2.2 To cleanINodeDirectory: recursively clean its children. 2.3 To cleanFileWithSnapshot: delete the corresponding snapshot in its diff list. 2.4 To cleanINodeDirectoryWithSnapshot: delete the corresponding snapshot in its diff list. Recursively clean its children.
cleanSubtree in class INodeFilesnapshot - The snapshot to delete. Null means to delete the current
file/directory.prior - The latest snapshot before the to-be-deleted snapshot. When
deleting a current inode, this parameter captures the latest
snapshot.collectedBlocks - blocks collected from the descents for further block
deletion/update will be added to the given map.removedINodes - INodes collected from the descents for further cleaning up of
inodeMapQuotaExceededExceptionpublic String toDetailString()
toDetailString in class INodeCopyright © 2013 Apache Software Foundation. All rights reserved.