diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-07-31 13:58:32 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-07-31 13:58:32 +0900 |
| commit | 280a736ce39009f025fae418e9f208a37b6a8d03 (patch) | |
| tree | 797933e6747c24e0ab91e32a5473c3ce8bd900b0 /internal | |
| parent | 4e41b9bc99c6e03228e570f614b792316514b9e0 (diff) | |
internal/pkg: cure entry/exit notification
This enables cure status display without inspecting internal state.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/pkg/pkg.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/pkg/pkg.go b/internal/pkg/pkg.go index f1a677b1..8dd6abcc 100644 --- a/internal/pkg/pkg.go +++ b/internal/pkg/pkg.go @@ -1826,6 +1826,10 @@ func (e *DependencyCureError) Error() string { // enterCure must be called before entering an [Artifact] implementation. func (c *Cache) enterCure(a Artifact, curesExempt bool) error { + if c.attr.Notify != nil { + c.attr.Notify <- true + } + if a.IsExclusive() { c.exclMu.Lock() } @@ -1848,6 +1852,10 @@ func (c *Cache) enterCure(a Artifact, curesExempt bool) error { // exitCure must be called after exiting an [Artifact] implementation. func (c *Cache) exitCure(a Artifact, curesExempt bool) { + if c.attr.Notify != nil { + c.attr.Notify <- false + } + if a.IsExclusive() { c.exclMu.Unlock() } @@ -2741,6 +2749,10 @@ func (c *Cache) Close() { c.wg.Wait() close(c.cures) c.unlock() + + if c.attr.Notify != nil { + close(c.attr.Notify) + } } // UnsupportedVariantError describes an on-disk cache with an extension variant @@ -2768,6 +2780,8 @@ type CacheAttr struct { Jobs int // Preferred loadavg target, when applicable. Load int + // Optional cure entry and exit notification. + Notify chan<- bool // Omit the [lockedfile] lock. skipLock bool |
