go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/lucicfg/graph/doc.go (about) 1 // Copyright 2018 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 graph implements a DAG used internally to represent config objects. 16 // 17 // All entities in the LUCI config are represented by nodes in a graph. Nodes 18 // are linked with directional edges. Cycles are forbidden. Each edge is 19 // annotated with a name of the relation that added it (e.g. "triggered_by"). 20 // There can be multiple edges between a given pair of nodes, e.g. 21 // "triggered_by" and "triggers" edges between a builder(...) and a 22 // trigger(...). When detecting cycles or traversing the graph, edge annotations 23 // are not considered. They are used only to improve error messages when 24 // reporting dangling edges (e.g. Builder X references undefined trigger T via 25 // "triggered_by"). 26 // 27 // Each node: 28 // - Has a unique identifier, called key. A key is a list of 29 // (string kind, string id) pairs. Examples of keys: 30 // [luci.bucket("ci")] 31 // [luci.bucket("ci"), luci.builder("infra-builder")] 32 // - Has a props dict of arbitrary properties (all keys are strings, values 33 // are arbitrary). 34 // - Has a captured stack trace of where in Starlark it was defined (for error 35 // messages). 36 // - Is immutable. 37 // 38 // Key kinds support special syntax to express special sorts of kinds: 39 // - '_...' kinds are "private". When printing nodes names, (kind, id) pairs 40 // where the kind is private are silently skipped. 41 // - '@...' kinds are "namespace kinds". There may be at most one namespace 42 // kind in a key, and it must come first. When printing node names, the 43 // namespace ID is conveyed by "<id>:" prefix (instead of "<id>/"). If <id> 44 // is empty, the namespace qualifier is completely omitted. 45 // 46 // Structs exposed by this package are not safe for concurrent use without 47 // external locking. 48 package graph