go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/logdog/server/collector/coordinator/doc.go (about) 1 // Copyright 2016 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 coordinator implements a minimal interface to the Coordinator service 16 // that is sufficient for Collector usage. 17 // 18 // The interface also serves as an API abstraction boundary between the current 19 // Coordinator service definition and the Collector's logic. 20 // 21 // # Cache 22 // 23 // Coordinator methods are called very heavily during Collector operation. In 24 // production, the Coordinator instance should be wrapped in a Cache structure 25 // to locally cache Coordinator's known state. 26 // 27 // The cache is responsible for two things: Firstly, it coalesces multiple 28 // pending requests for the same stream state into a single Coordinator request. 29 // Secondly, it maintains a cache of completed responses to short-circuit the 30 // Coordinator. 31 // 32 // Stream state is stored internally as a Promise. This Promise is evaluated by 33 // querying the Coordinator. This interface is hidden to callers. 34 package coordinator