@InterfaceAudience.Private public class INodeFileUnderConstructionWithSnapshot extends INodeFileUnderConstruction implements FileWithSnapshot
INodeFileUnderConstruction
that is snapshotted.INode.BlocksMapUpdateInfo
FileWithSnapshot.FileDiff, FileWithSnapshot.FileDiffList, FileWithSnapshot.Util
INodeFileAttributes.SnapshotCopy
Constructor and Description |
---|
INodeFileUnderConstructionWithSnapshot(INodeFileUnderConstruction f,
FileWithSnapshot.FileDiffList diffs)
Construct an
INodeFileUnderConstructionWithSnapshot based on an
INodeFileUnderConstruction . |
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?
|
INodeFileUnderConstructionWithSnapshot |
recordModification(Snapshot latest,
INodeMap inodeMap)
This inode is being modified.
|
String |
toDetailString() |
protected INodeFileWithSnapshot |
toINodeFile(long mtime)
Converts an INodeFileUnderConstruction to an INodeFile.
|
assertAllBlocksComplete, getClientMachine, getClientName, getClientNode, isUnderConstruction, setLastBlock, valueOf
asFile, computeContentSummary, computeFileSize, computeFileSize, computeFileSize, computeFileSizeNotIncludingLastUcBlock, computeQuotaUsage, destroyAndCollectBlocks, diskspaceConsumed, diskspaceConsumed, dumpTreeRecursively, getBlockReplication, getBlocks, getFileReplication, getFileReplication, getHeaderLong, getLastBlock, getName, getPreferredBlockSize, isFile, numBlocks, setBlock, setBlocks, setFileReplication, setFileReplication, toUnderConstruction, valueOf
getFsPermissionShort, getId, getLocalNameBytes, getNext, getPermissionLong, setAccessTime, setLocalName, setModificationTime, setNext, updateModificationTime
addSpaceConsumed, 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, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
setBlock
computeContentSummary, getBlockReplication, getBlocks, getLastBlock, getName, getPreferredBlockSize, numBlocks
getAccessTime, getFsPermission, getFsPermissionShort, getGroupName, getLocalNameBytes, getModificationTime, getPermissionLong, getUserName
public INodeFileUnderConstructionWithSnapshot(INodeFileUnderConstruction f, FileWithSnapshot.FileDiffList diffs)
INodeFileUnderConstructionWithSnapshot
based on an
INodeFileUnderConstruction
.f
- The given INodeFileUnderConstruction
instanceprotected INodeFileWithSnapshot toINodeFile(long mtime)
INodeFileUnderConstruction
toINodeFile
in class INodeFileUnderConstruction
public boolean isCurrentFileDeleted()
FileWithSnapshot
isCurrentFileDeleted
in interface FileWithSnapshot
public void deleteCurrentFile()
FileWithSnapshot
deleteCurrentFile
in interface FileWithSnapshot
public INodeFileAttributes getSnapshotINode(Snapshot snapshot)
getSnapshotINode
in class INodeFile
public INodeFileUnderConstructionWithSnapshot recordModification(Snapshot latest, INodeMap inodeMap) throws QuotaExceededException
INode
recordModification
in class INodeFileUnderConstruction
latest
- 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.QuotaExceededException
public INodeFile asINodeFile()
asINodeFile
in interface FileWithSnapshot
INodeFile
view of this object.public FileWithSnapshot.FileDiffList getDiffs()
getDiffs
in interface FileWithSnapshot
public Quota.Counts cleanSubtree(Snapshot snapshot, Snapshot prior, INode.BlocksMapUpdateInfo collectedBlocks, List<INode> removedINodes, boolean countDiffChange) throws QuotaExceededException
INode
In 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 Ifprior
is 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 Ifprior
is 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 INodeFile
snapshot
- 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
inodeMapQuotaExceededException
public String toDetailString()
toDetailString
in class INode
Copyright © 2013 Apache Software Foundation. All rights reserved.