diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-03-05 16:58:52 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-03-05 16:58:52 +0900 |
| commit | 8ea2a56d5b364c7e6bff35c849ecfcb15e52a5d7 (patch) | |
| tree | 0e47ebfb697dedbf1aa4da45fc61e302f968bcc7 | |
| parent | 159a45c027094d4c92bc89fda99703bccaca57c2 (diff) | |
internal/pkg: expose status file
This is useful for external tooling.
Signed-off-by: Ophestra <cat@gensokyo.uk>
| -rw-r--r-- | internal/pkg/pkg.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/pkg/pkg.go b/internal/pkg/pkg.go index 59662b1e..6080fd68 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() { |
