From 8ea2a56d5b364c7e6bff35c849ecfcb15e52a5d7 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 5 Mar 2026 16:58:52 +0900 Subject: [PATCH] internal/pkg: expose status file This is useful for external tooling. Signed-off-by: Ophestra --- internal/pkg/pkg.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/internal/pkg/pkg.go b/internal/pkg/pkg.go index 59662b1..6080fd6 100644 --- a/internal/pkg/pkg.go +++ b/internal/pkg/pkg.go @@ -1790,6 +1790,18 @@ func (pending *pendingArtifactDep) cure(c *Cache) { pending.errsMu.Unlock() } +// OpenStatus attempts to open the status file associated to an [Artifact]. If +// err is nil, the caller must close the resulting reader. +func (c *Cache) OpenStatus(a Artifact) (r io.ReadSeekCloser, err error) { + c.identMu.RLock() + r, err = os.Open(c.base.Append( + dirStatus, + Encode(c.Ident(a).Value())).String(), + ) + c.identMu.RUnlock() + return +} + // Close cancels all pending cures and waits for them to clean up. func (c *Cache) Close() { c.closeOnce.Do(func() {