github.com/zorawar87/trillian@v1.2.1/quota/etcd/storagepb/storagepb.proto (about)

     1  // Copyright 2017 Google Inc. All Rights Reserved.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  syntax = "proto3";
    16  
    17  // Package storagepb contains definitions for quota storage protos, which are recorded in etcd.
    18  package storagepb;
    19  
    20  // Data contained in a quota bucket.
    21  // Stored at each each quota's zero bucket. For example,
    22  // quotas/global/read/0 or quotas/trees/$id/read/0.
    23  message Bucket {
    24  
    25    // Number of tokens left in the bucket.
    26    int64 tokens = 1;
    27  
    28    // Timestamp of the last time the bucket got replenished.
    29    int64 last_replenish_millis_since_epoch = 2;
    30  }
    31  
    32  // Configuration for all quotas.
    33  // Stored at quotas/configs.
    34  message Configs {
    35  
    36    // Known quota configurations.
    37    repeated Config configs = 1;
    38  }
    39  
    40  // Configuration of a quota.
    41  message Config {
    42  
    43    // Possible states of a quota configuration.
    44    enum State {
    45      // Unknown quota state. Invalid.
    46      UNKNOWN_CONFIG_STATE = 0;
    47  
    48      // Quota is enabled.
    49      ENABLED = 1;
    50  
    51      // Quota is disabled (considered infinite).
    52      DISABLED = 2;
    53    }
    54  
    55    // Name of the config, eg, “quotas/trees/1234/read/config”.
    56    string name = 1;
    57  
    58    // State of the config.
    59    State state = 2;
    60  
    61    // Max number of tokens available for the config.
    62    int64 max_tokens = 3;
    63  
    64    // Replenishment strategy used by the config.
    65    oneof replenishment_strategy {
    66  
    67      // Sequencing-based replenishment settings.
    68      SequencingBasedStrategy sequencing_based = 4;
    69  
    70      // Time-based replenishment settings.
    71      TimeBasedStrategy time_based = 5;
    72    }
    73  }
    74  
    75  // Sequencing-based replenishment strategy settings.
    76  message SequencingBasedStrategy {}
    77  
    78  // Time-based replenishment strategy settings.
    79  message TimeBasedStrategy {
    80  
    81    // Number of tokens to replenish at every replenish_interval_seconds.
    82    int64 tokens_to_replenish = 1;
    83  
    84    // Interval at which tokens_to_replenish get replenished.
    85    int64 replenish_interval_seconds = 2;
    86  }