forked from security/hakurei
internal/pkg: expose status file
This is useful for external tooling. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user