go.chromium.org/luci@v0.0.0-20250314024836-d9a61d0730e6/tokenserver/appengine/impl/utils/policy/doc.go (about) 1 // Copyright 2017 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 policy contains implementation of Policy parsing and querying. 16 // 17 // Policies are configs fetched from LUCI Config and used from Token Server RPCs 18 // for various decisions. Each policy is defined by one or more config files, 19 // all fetched at a single revision (for consistency) and cached in single 20 // datastore entity (for faster fetches). 21 // 22 // The defining properties of policy configs are: 23 // - They are global (i.e they are service configs, not per-project ones). 24 // - The content is mostly static. 25 // - They are queried from performance critical RPC handlers. 26 // 27 // This suggests to heavily cache policies in local instance memory in a form 28 // most suitable for querying. 29 // 30 // Thus policies have 3 representations: 31 // - Text protos: that's how they are stored in LUCI Config. 32 // - Binary protos: that's how Token Server stores them in the datastore. 33 // - Queryable state: that's how Token Server keeps them in the local memory. 34 package policy