001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.hbase.quotas;
019
020import java.util.List;
021import org.apache.hadoop.hbase.client.Mutation;
022import org.apache.hadoop.hbase.client.Result;
023import org.apache.yetus.audience.InterfaceAudience;
024import org.apache.yetus.audience.InterfaceStability;
025
026import org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos;
027
028/**
029 * Noop operation quota returned when no quota is associated to the user/table
030 */
031@InterfaceAudience.Private
032@InterfaceStability.Evolving
033class NoopOperationQuota implements OperationQuota {
034  private static OperationQuota instance = new NoopOperationQuota();
035
036  private NoopOperationQuota() {
037    // no-op
038  }
039
040  public static OperationQuota get() {
041    return instance;
042  }
043
044  @Override
045  public void checkBatchQuota(int numWrites, int numReads) throws RpcThrottlingException {
046    // no-op
047  }
048
049  @Override
050  public void checkScanQuota(ClientProtos.ScanRequest scanRequest, long maxScannerResultSize,
051    long maxBlockBytesScanned, long prevBlockBytesScannedDifference) throws RpcThrottlingException {
052    // no-op
053  }
054
055  @Override
056  public void close() {
057    // no-op
058  }
059
060  @Override
061  public void addGetResult(final Result result) {
062    // no-op
063  }
064
065  @Override
066  public void addScanResult(final List<Result> results) {
067    // no-op
068  }
069
070  @Override
071  public void addMutation(final Mutation mutation) {
072    // no-op
073  }
074
075  @Override
076  public long getReadAvailable() {
077    return Long.MAX_VALUE;
078  }
079
080  @Override
081  public long getReadConsumed() {
082    return 0L;
083  }
084}