public class INodeDirectoryWithQuota extends INodeDirectory
INodeDirectory.SnapshotAndINode
INode.BlocksMapUpdateInfo
INodeDirectoryAttributes.CopyWithQuota, INodeDirectoryAttributes.SnapshotCopy
DEFAULT_FILES_PER_DIRECTORY
Constructor and Description |
---|
INodeDirectoryWithQuota(INodeDirectory other,
boolean adopt,
long nsQuota,
long dsQuota)
Convert an existing directory inode to one with the given quota
|
Modifier and Type | Method and Description |
---|---|
void |
addSpaceConsumed(long nsDelta,
long dsDelta,
boolean verify)
Check and add namespace/diskspace consumed to itself and the ancestors.
|
protected void |
addSpaceConsumed2Cache(long nsDelta,
long dsDelta)
Update the size of the tree
|
Content.Counts |
computeContentSummary(Content.Counts counts)
Count subtree content summary with a
Content.Counts . |
Quota.Counts |
computeQuotaUsage(Quota.Counts counts,
boolean useCache,
int lastSnapshotId)
Count subtree
Quota.NAMESPACE and Quota.DISKSPACE usages. |
long |
getDiskspace() |
long |
getDsQuota()
Get this directory's diskspace quota
|
long |
getNamespace() |
long |
getNsQuota()
Get this directory's namespace quota
|
void |
setQuota(long nsQuota,
long dsQuota)
Set this directory's quota
|
addChild, addChild, asDirectory, cleanSubtree, cleanSubtreeRecursively, clear, clearChildren, computeQuotaUsage4CurrentDirectory, destroyAndCollectBlocks, dumpTreeRecursively, dumpTreeRecursively, getChild, getChildrenList, getChildrenNum, isDirectory, isSnapshottable, metadataEquals, recordModification, removeChild, removeChild, replaceChild, replaceSelf4INodeDirectory, replaceSelf4INodeDirectorySnapshottable, replaceSelf4INodeDirectoryWithSnapshot, saveChild2Snapshot, valueOf
getFsPermissionShort, getId, getLocalNameBytes, getNext, getPermissionLong, setAccessTime, setLocalName, setModificationTime, setNext, updateModificationTime
asFile, asReference, asSymlink, compareTo, computeContentSummary, computeQuotaUsage, computeQuotaUsage, dumpTreeRecursively, dumpTreeRecursively, equals, getAccessTime, getFsPermission, getFullPathName, getGroupName, getKey, getLocalName, getModificationTime, getObjectString, getParent, getParentReference, getParentString, getSnapshotINode, getUserName, hashCode, isAncestorDirectory, isFile, isInLatestSnapshot, isQuotaSet, isReference, isSymlink, setAccessTime, setModificationTime, setParent, setParentReference, shouldRecordInSrcSnapshot, toDetailString, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getAccessTime, getFsPermission, getFsPermissionShort, getGroupName, getLocalNameBytes, getModificationTime, getPermissionLong, getUserName
public INodeDirectoryWithQuota(INodeDirectory other, boolean adopt, long nsQuota, long dsQuota)
nsQuota
- Namespace quota to be assigned to this inodedsQuota
- Diskspace quota to be assigned to this indoeother
- The other inode from which all other properties are copiedpublic long getNsQuota()
getNsQuota
in interface INodeDirectoryAttributes
getNsQuota
in class INode
public long getDsQuota()
getDsQuota
in interface INodeDirectoryAttributes
getDsQuota
in class INode
public void setQuota(long nsQuota, long dsQuota)
nsQuota
- Namespace quota to be setdsQuota
- diskspace quota to be setpublic Quota.Counts computeQuotaUsage(Quota.Counts counts, boolean useCache, int lastSnapshotId)
INode
Quota.NAMESPACE
and Quota.DISKSPACE
usages.
With the existence of INodeReference
, the same inode and its
subtree may be referred by multiple INodeReference.WithName
nodes and a
INodeReference.DstReference
node. To avoid circles while quota usage computation,
we have the following rules:
1. For aINodeReference.DstReference
node, since the node must be in the current tree (or has been deleted as the end point of a series of rename operations), we compute the quota usage of the referred node (and its subtree) in the regular manner, i.e., including every inode in the current tree and in snapshot copies, as well as the size of diff list. 2. For aINodeReference.WithName
node, since the node must be in a snapshot, we only count the quota usage for those nodes that still existed at the creation time of the snapshot associated with theINodeReference.WithName
node. We do not count in the size of the diff list.
computeQuotaUsage
in class INodeDirectory
counts
- The subtree counts for returning.useCache
- Whether to use cached quota usage. Note that
INodeReference.WithName
node never uses cache for its subtree.lastSnapshotId
- Snapshot.INVALID_ID
indicates the computation
is in the current tree. Otherwise the id indicates
the computation range for a INodeReference.WithName
node.public Content.Counts computeContentSummary(Content.Counts counts)
INode
Content.Counts
.computeContentSummary
in class INodeDirectory
counts
- The subtree counts for returning.public final void addSpaceConsumed(long nsDelta, long dsDelta, boolean verify) throws QuotaExceededException
INode
addSpaceConsumed
in class INode
QuotaExceededException
- if quote is violated.protected void addSpaceConsumed2Cache(long nsDelta, long dsDelta)
nsDelta
- the change of the tree sizedsDelta
- change to disk space occupiedpublic long getNamespace()
public long getDiskspace()
Copyright © 2013 Apache Software Foundation. All rights reserved.