github.com/letsencrypt/trillian@v1.1.2-0.20180615153820-ae375a99d36a/quota/doc.go (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  // Package quota defines Trillian's Quota Management service.
    16  //
    17  // The objective of the quota service is to protect Trillian from traffic peaks, rejecting requests
    18  // that may put servers out of capacity or indirectly cause MMDs (maximum merge delays) to be
    19  // missed.
    20  //
    21  // Each Trillian request, be it either a read or write request, requires certain tokens to be
    22  // allowed to continue. Tokens exist at multiple layers: per-user, per-tree and global tokens.
    23  // For example, a TrillianLog.QueueLeaves request consumes a Write token from User, Tree and Global
    24  // quotas. If any of those quotas is out of tokens, the request is denied with a ResourceExhausted
    25  // error code.
    26  //
    27  // Tokens are replenished according to each implementation. For example, User tokens may replenish
    28  // over time, whereas {Write, Tree} tokens may replenish as sequencing happens. Implementations are
    29  // free to ignore (effectively whitelisting) certain specs of tokens (e.g., only support Global and
    30  // ignore User and Tree tokens).
    31  //
    32  // Quota users are defined according to each implementation. Note that quota users don't need to
    33  // match authentication/authorization users; implementations are allowed their own representation of
    34  // users.
    35  package quota