github.com/verrazzano/verrazzano@v1.7.1/tools/psr/backend/workers/doc.go (about) 1 // Copyright (c) 2022, Oracle and/or its affiliates. 2 // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. 3 4 /* 5 Package workers contains a set of workers that implement PSR use cases. 6 7 # Worker 8 Each worker does a single task, such as generate logs. The Worker.Work function is called 9 repeatedly by the workmanager.Runner, which implements the loop. If the worker 10 has a dependency that doesn't exist, like OpenSearch, it should return an error. 11 12 ## Immutable 13 Each worker should use a value receiver so that the worker is immutable. Any mutable state should be keep in 14 a struct or structs pointed to by the worker. For example, see runner.go *runnerMetrics in the runner struct. 15 16 # Metrics 17 Each worker can and should generate metrics. The metrics much be thread safe since the collection will be 18 done from a go routine, see workmanager/runner.go for an example. The metrics collection is generically handled by the 19 metrics/collector.go code. 20 */ 21 package workers