 /**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package pb;

option java_package = "org.apache.hadoop.hbase.protobuf.generated";
option java_outer_classname = "QuotaProtos";
option java_generic_services = true;
option java_generate_equals_and_hash = true;
option optimize_for = SPEED;

import "HBase.proto";

enum QuotaScope {
  CLUSTER = 1;
  MACHINE = 2;
}

message TimedQuota {
  required TimeUnit time_unit = 1;
  optional uint64 soft_limit  = 2;
  optional float share = 3;
  optional QuotaScope scope  = 4 [default = MACHINE];
}

enum ThrottleType {
  REQUEST_NUMBER = 1;
  REQUEST_SIZE   = 2;
  WRITE_NUMBER   = 3;
  WRITE_SIZE     = 4;
  READ_NUMBER    = 5;
  READ_SIZE      = 6;
}

message Throttle {
  optional TimedQuota req_num  = 1;
  optional TimedQuota req_size = 2;

  optional TimedQuota write_num  = 3;
  optional TimedQuota write_size = 4;

  optional TimedQuota read_num  = 5;
  optional TimedQuota read_size = 6;
}

message ThrottleRequest {
  optional ThrottleType type = 1;
  optional TimedQuota timed_quota = 2;
}

enum QuotaType {
  THROTTLE = 1;
}

message Quotas {
  optional bool bypass_globals = 1 [default = false];
  optional Throttle throttle = 2;
}

message QuotaUsage {
}
