Class Quota
java.lang.Object
org.apache.hadoop.hdfs.server.federation.router.Quota
- Direct Known Subclasses:
AsyncQuota
Module that implements the quota relevant RPC calls
ClientProtocol.setQuota(String, long, long, StorageType)
and
ClientProtocol.getQuotaUsage(String)
in the RouterRpcServer.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.hadoop.fs.QuotaUsageaggregateQuota(String path, Map<RemoteLocation, org.apache.hadoop.fs.QuotaUsage> results) Aggregate quota that queried from sub-clusters.static booleanandByStorageType(Predicate<org.apache.hadoop.fs.StorageType> predicate) Invoke predicate by each storage type and bitwise AND the results.static voideachByStorageType(Consumer<org.apache.hadoop.fs.StorageType> consumer) Invoke consumer by each storage type.protected Map<RemoteLocation,org.apache.hadoop.fs.QuotaUsage> getEachQuotaUsage(String path) Get quota usage for the federation path.org.apache.hadoop.fs.QuotaUsagegetQuotaUsage(String path) Get aggregated quota usage for the federation path.protected List<RemoteLocation>getValidQuotaLocations(String path) Get valid quota remote locations used ingetQuotaUsage(String).static booleanorByStorageType(Predicate<org.apache.hadoop.fs.StorageType> predicate) Invoke predicate by each storage type and bitwise inclusive OR the results.voidsetQuota(String path, long namespaceQuota, long storagespaceQuota, org.apache.hadoop.fs.StorageType type, boolean checkMountEntry) Set quota for the federation path.
-
Constructor Details
-
Quota
-
-
Method Details
-
setQuota
public void setQuota(String path, long namespaceQuota, long storagespaceQuota, org.apache.hadoop.fs.StorageType type, boolean checkMountEntry) throws IOException Set quota for the federation path.- Parameters:
path- Federation path.namespaceQuota- Name space quota.storagespaceQuota- Storage space quota.type- StorageType that the space quota is intended to be set on.checkMountEntry- whether to check the path is a mount entry.- Throws:
IOException- If the quota system is disabled or if checkMountEntry is true and the path is a mount entry.
-
getQuotaUsage
Get aggregated quota usage for the federation path.- Parameters:
path- Federation path.- Returns:
- Aggregated quota.
- Throws:
IOException- If the quota system is disabled.
-
getEachQuotaUsage
protected Map<RemoteLocation,org.apache.hadoop.fs.QuotaUsage> getEachQuotaUsage(String path) throws IOException Get quota usage for the federation path.- Parameters:
path- Federation path.- Returns:
- quota usage for each remote location.
- Throws:
IOException- If the quota system is disabled.
-
getValidQuotaLocations
Get valid quota remote locations used ingetQuotaUsage(String). Differentiate the methodgetQuotaRemoteLocations(String), this method will do some additional filtering.- Parameters:
path- Federation path.- Returns:
- List of valid quota remote locations.
- Throws:
IOException- If the location for this path cannot be determined.
-
aggregateQuota
protected org.apache.hadoop.fs.QuotaUsage aggregateQuota(String path, Map<RemoteLocation, org.apache.hadoop.fs.QuotaUsage> results) throws IOExceptionAggregate quota that queried from sub-clusters.- Parameters:
path- Federation path of the results.results- Quota query result.- Returns:
- Aggregated Quota.
- Throws:
IOException- If the quota system is disabled.
-
eachByStorageType
Invoke consumer by each storage type.- Parameters:
consumer- the function consuming the storage type.
-
orByStorageType
Invoke predicate by each storage type and bitwise inclusive OR the results.- Parameters:
predicate- the function test the storage type.- Returns:
- true if bitwise OR by all storage type returns true, false otherwise.
-
andByStorageType
Invoke predicate by each storage type and bitwise AND the results.- Parameters:
predicate- the function test the storage type.- Returns:
- true if bitwise AND by all storage type returns true, false otherwise.
-