@InterfaceAudience.Private public class NamespaceQuotaSnapshotStore extends Object implements QuotaSnapshotStore<String>
QuotaSnapshotStore
implementation for namespaces.Modifier and Type | Field and Description |
---|---|
private QuotaObserverChore |
chore |
private Connection |
conn |
private ReentrantReadWriteLock |
lock |
private Map<RegionInfo,Long> |
regionUsage |
private ReentrantReadWriteLock.ReadLock |
rlock |
private ReentrantReadWriteLock.WriteLock |
wlock |
NO_QUOTA
Constructor and Description |
---|
NamespaceQuotaSnapshotStore(Connection conn,
QuotaObserverChore chore,
Map<RegionInfo,Long> regionUsage) |
Modifier and Type | Method and Description |
---|---|
Iterable<Map.Entry<RegionInfo,Long>> |
filterBySubject(String namespace)
Filters the provided
regions , returning those which match the given
subject . |
SpaceQuotaSnapshot |
getCurrentState(String namespace)
Returns the current
SpaceQuotaSnapshot for the given subject . |
(package private) org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas |
getQuotaForNamespace(String namespace)
Fetches the namespace quota.
|
org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota |
getSpaceQuota(String namespace)
Fetch the Quota for the given
subject . |
SpaceQuotaSnapshot |
getTargetState(String subject,
org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota spaceQuota)
|
void |
setCurrentState(String namespace,
SpaceQuotaSnapshot snapshot)
Persists the current
SpaceQuotaSnapshot for the subject . |
void |
setRegionUsage(Map<RegionInfo,Long> regionUsage)
Updates
this with the latest snapshot of filesystem use by region. |
private final ReentrantReadWriteLock lock
private final ReentrantReadWriteLock.ReadLock rlock
private final ReentrantReadWriteLock.WriteLock wlock
private final Connection conn
private final QuotaObserverChore chore
private Map<RegionInfo,Long> regionUsage
public NamespaceQuotaSnapshotStore(Connection conn, QuotaObserverChore chore, Map<RegionInfo,Long> regionUsage)
public org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota getSpaceQuota(String namespace) throws IOException
QuotaSnapshotStore
subject
. May be null.getSpaceQuota
in interface QuotaSnapshotStore<String>
namespace
- The object for which the quota should be fetchedIOException
org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas getQuotaForNamespace(String namespace) throws IOException
IOException
public SpaceQuotaSnapshot getCurrentState(String namespace)
QuotaSnapshotStore
SpaceQuotaSnapshot
for the given subject
.getCurrentState
in interface QuotaSnapshotStore<String>
namespace
- The object which the quota snapshot should be fetchedpublic SpaceQuotaSnapshot getTargetState(String subject, org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota spaceQuota) throws IOException
QuotaSnapshotStore
getTargetState
in interface QuotaSnapshotStore<String>
subject
- The object which to determine the target SpaceQuotaSnapshot ofspaceQuota
- The quota "definition" for the subject
IOException
public Iterable<Map.Entry<RegionInfo,Long>> filterBySubject(String namespace)
QuotaSnapshotStore
regions
, returning those which match the given
subject
.filterBySubject
in interface QuotaSnapshotStore<String>
namespace
- The filter criteria. Only regions belonging to this parameter will be returnedpublic void setCurrentState(String namespace, SpaceQuotaSnapshot snapshot)
QuotaSnapshotStore
SpaceQuotaSnapshot
for the subject
.setCurrentState
in interface QuotaSnapshotStore<String>
namespace
- The object which the SpaceQuotaSnapshot
is being persisted forsnapshot
- The current state of the subject
public void setRegionUsage(Map<RegionInfo,Long> regionUsage)
QuotaSnapshotStore
this
with the latest snapshot of filesystem use by region.setRegionUsage
in interface QuotaSnapshotStore<String>
regionUsage
- A map of RegionInfo
objects to their filesystem usage in bytesCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.