Package org.apache.hadoop.hbase.quotas
Class NamespaceQuotaSnapshotStore
java.lang.Object
org.apache.hadoop.hbase.quotas.NamespaceQuotaSnapshotStore
- All Implemented Interfaces:
QuotaSnapshotStore<String>
@Private
public class NamespaceQuotaSnapshotStore
extends Object
implements QuotaSnapshotStore<String>
QuotaSnapshotStore
implementation for namespaces.-
Field Summary
Modifier and TypeFieldDescriptionprivate final QuotaObserverChore
private final Connection
private final ReentrantReadWriteLock
private Map<RegionInfo,
Long> private final ReentrantReadWriteLock.ReadLock
private final ReentrantReadWriteLock.WriteLock
Fields inherited from interface org.apache.hadoop.hbase.quotas.QuotaSnapshotStore
NO_QUOTA
-
Constructor Summary
ConstructorDescriptionNamespaceQuotaSnapshotStore
(Connection conn, QuotaObserverChore chore, Map<RegionInfo, Long> regionUsage) -
Method Summary
Modifier and TypeMethodDescriptionfilterBySubject
(String namespace) Filters the providedregions
, returning those which match the givensubject
.getCurrentState
(String namespace) Returns the currentSpaceQuotaSnapshot
for the givensubject
.(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 givensubject
.getTargetState
(String subject, org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota spaceQuota) void
setCurrentState
(String namespace, SpaceQuotaSnapshot snapshot) Persists the currentSpaceQuotaSnapshot
for thesubject
.void
setRegionUsage
(Map<RegionInfo, Long> regionUsage) Updatesthis
with the latest snapshot of filesystem use by region.
-
Field Details
-
lock
-
rlock
-
wlock
-
conn
-
chore
-
regionUsage
-
-
Constructor Details
-
NamespaceQuotaSnapshotStore
public NamespaceQuotaSnapshotStore(Connection conn, QuotaObserverChore chore, Map<RegionInfo, Long> regionUsage)
-
-
Method Details
-
getSpaceQuota
public org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota getSpaceQuota(String namespace) throws IOException Description copied from interface:QuotaSnapshotStore
Fetch the Quota for the givensubject
. May be null.- Specified by:
getSpaceQuota
in interfaceQuotaSnapshotStore<String>
- Parameters:
namespace
- The object for which the quota should be fetched- Throws:
IOException
-
getQuotaForNamespace
org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas getQuotaForNamespace(String namespace) throws IOException Fetches the namespace quota. Visible for mocking/testing.- Throws:
IOException
-
getCurrentState
Description copied from interface:QuotaSnapshotStore
Returns the currentSpaceQuotaSnapshot
for the givensubject
.- Specified by:
getCurrentState
in interfaceQuotaSnapshotStore<String>
- Parameters:
namespace
- The object which the quota snapshot should be fetched
-
getTargetState
public SpaceQuotaSnapshot getTargetState(String subject, org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota spaceQuota) throws IOException Description copied from interface:QuotaSnapshotStore
- Specified by:
getTargetState
in interfaceQuotaSnapshotStore<String>
- Parameters:
subject
- The object which to determine the target SpaceQuotaSnapshot ofspaceQuota
- The quota "definition" for thesubject
- Throws:
IOException
-
filterBySubject
Description copied from interface:QuotaSnapshotStore
Filters the providedregions
, returning those which match the givensubject
.- Specified by:
filterBySubject
in interfaceQuotaSnapshotStore<String>
- Parameters:
namespace
- The filter criteria. Only regions belonging to this parameter will be returned
-
setCurrentState
Description copied from interface:QuotaSnapshotStore
Persists the currentSpaceQuotaSnapshot
for thesubject
.- Specified by:
setCurrentState
in interfaceQuotaSnapshotStore<String>
- Parameters:
namespace
- The object which theSpaceQuotaSnapshot
is being persisted forsnapshot
- The current state of thesubject
-
setRegionUsage
Description copied from interface:QuotaSnapshotStore
Updatesthis
with the latest snapshot of filesystem use by region.- Specified by:
setRegionUsage
in interfaceQuotaSnapshotStore<String>
- Parameters:
regionUsage
- A map ofRegionInfo
objects to their filesystem usage in bytes
-