From 280a736ce39009f025fae418e9f208a37b6a8d03 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Fri, 31 Jul 2026 13:58:32 +0900 Subject: [PATCH] internal/pkg: cure entry/exit notification This enables cure status display without inspecting internal state. Signed-off-by: Ophestra --- internal/pkg/pkg.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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