github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/worker/fortress/doc.go (about) 1 // Copyright 2022 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 /* 5 Package fortress implements a convenient metaphor for an RWLock. 6 7 A "fortress" is constructed via a manifold's Start func, and accessed via its 8 Output func as either a Guard or a Guest. To begin with, it's considered to be 9 locked, and inaccessible to Guests; when the Guard Unlocks it, the Guests can 10 Visit it until the Guard calls Lockdown. At that point, new Visits are blocked, 11 and existing Visits are allowed to complete; the Lockdown returns once all 12 Guests' Visits have completed. 13 14 The original motivating use case was for a component to mediate charm directory 15 access between the uniter and the metrics collector. The metrics collector must 16 be free to run its own independent hooks while the uniter is active; but metrics 17 hooks and charm upgrades cannot be allowed to tread on one another's toes. 18 */ 19 package fortress