go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/server/quota/keys.go (about)

     1  // Copyright 2022 The LUCI Authors.
     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
    16  
    17  import "go.chromium.org/luci/server/quota/internal/quotakeys"
    18  
    19  // AssembleASI will return an Application-Specified-Identifier (ASI) with the
    20  // given sections.
    21  //
    22  // Sections are assembled with a "|" separator verbatim, unless the section
    23  // contains a "|", "~" or begins with "{". In this case the section will be
    24  // encoded with ascii85 and inserted to the final string with a "{" prefix
    25  // character.
    26  var AssembleASI = quotakeys.AssembleASI
    27  
    28  // DecodeASI will return the sections within an Application-Specified-Identifier
    29  // (ASI), decoding any which appear to be ascii85-encoded (i.e. those prefixed
    30  // with a "{").
    31  //
    32  // If a section has the "{" prefix, but doesn't correctly decode, it's
    33  // returned verbatim.
    34  var DecodeASI = quotakeys.DecodeASI