Search in sources :

Example 1 with GetQuotaStatesResponse

use of org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.GetQuotaStatesResponse in project hbase by apache.

the class MasterRpcServices method getQuotaStates.

@Override
public GetQuotaStatesResponse getQuotaStates(RpcController controller, GetQuotaStatesRequest request) throws ServiceException {
    try {
        server.checkInitialized();
        QuotaObserverChore quotaChore = this.server.getQuotaObserverChore();
        GetQuotaStatesResponse.Builder builder = GetQuotaStatesResponse.newBuilder();
        if (quotaChore != null) {
            // The "current" view of all tables with quotas
            Map<TableName, SpaceQuotaSnapshot> tableSnapshots = quotaChore.getTableQuotaSnapshots();
            for (Entry<TableName, SpaceQuotaSnapshot> entry : tableSnapshots.entrySet()) {
                builder.addTableSnapshots(TableQuotaSnapshot.newBuilder().setTableName(ProtobufUtil.toProtoTableName(entry.getKey())).setSnapshot(SpaceQuotaSnapshot.toProtoSnapshot(entry.getValue())).build());
            }
            // The "current" view of all namespaces with quotas
            Map<String, SpaceQuotaSnapshot> nsSnapshots = quotaChore.getNamespaceQuotaSnapshots();
            for (Entry<String, SpaceQuotaSnapshot> entry : nsSnapshots.entrySet()) {
                builder.addNsSnapshots(NamespaceQuotaSnapshot.newBuilder().setNamespace(entry.getKey()).setSnapshot(SpaceQuotaSnapshot.toProtoSnapshot(entry.getValue())).build());
            }
            return builder.build();
        }
        return builder.build();
    } catch (Exception e) {
        throw new ServiceException(e);
    }
}
Also used : SpaceQuotaSnapshot(org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshot) TableName(org.apache.hadoop.hbase.TableName) ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) QuotaObserverChore(org.apache.hadoop.hbase.quotas.QuotaObserverChore) GetQuotaStatesResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.GetQuotaStatesResponse) ByteString(org.apache.hbase.thirdparty.com.google.protobuf.ByteString) ReplicationException(org.apache.hadoop.hbase.replication.ReplicationException) ServerNotRunningYetException(org.apache.hadoop.hbase.ipc.ServerNotRunningYetException) UnknownProtocolException(org.apache.hadoop.hbase.exceptions.UnknownProtocolException) ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) ForeignException(org.apache.hadoop.hbase.errorhandling.ForeignException) IOException(java.io.IOException) RemoteProcedureException(org.apache.hadoop.hbase.procedure2.RemoteProcedureException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) UnknownRegionException(org.apache.hadoop.hbase.UnknownRegionException) KeeperException(org.apache.zookeeper.KeeperException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)1 TableName (org.apache.hadoop.hbase.TableName)1 UnknownRegionException (org.apache.hadoop.hbase.UnknownRegionException)1 ForeignException (org.apache.hadoop.hbase.errorhandling.ForeignException)1 UnknownProtocolException (org.apache.hadoop.hbase.exceptions.UnknownProtocolException)1 ServerNotRunningYetException (org.apache.hadoop.hbase.ipc.ServerNotRunningYetException)1 RemoteProcedureException (org.apache.hadoop.hbase.procedure2.RemoteProcedureException)1 QuotaObserverChore (org.apache.hadoop.hbase.quotas.QuotaObserverChore)1 SpaceQuotaSnapshot (org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshot)1 ReplicationException (org.apache.hadoop.hbase.replication.ReplicationException)1 GetQuotaStatesResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.GetQuotaStatesResponse)1 ByteString (org.apache.hbase.thirdparty.com.google.protobuf.ByteString)1 ServiceException (org.apache.hbase.thirdparty.com.google.protobuf.ServiceException)1 KeeperException (org.apache.zookeeper.KeeperException)1