From 4f570cc5c96192a40f210db6ea5f3210813095ad Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sun, 15 Feb 2026 00:45:37 +0900 Subject: [PATCH] internal/pkg: expose extra methods to file This is useful for FileArtifact processing another stream. Signed-off-by: Ophestra --- internal/pkg/pkg.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/internal/pkg/pkg.go b/internal/pkg/pkg.go index 54ac571..5f6f15d 100644 --- a/internal/pkg/pkg.go +++ b/internal/pkg/pkg.go @@ -196,14 +196,7 @@ func (f *FContext) GetArtifact(a Artifact) ( // // Methods of RContext are safe for concurrent use. RContext is valid // until [FileArtifact.Cure] returns. -type RContext struct { - // Address of underlying [Cache], should be zeroed or made unusable after - // [FileArtifact.Cure] returns and must not be exposed directly. - cache *Cache -} - -// Unwrap returns the underlying [context.Context]. -func (r *RContext) Unwrap() context.Context { return r.cache.ctx } +type RContext struct{ common } // An Artifact is a read-only reference to a piece of data that may be created // deterministically but might not currently be available in memory or on the @@ -959,7 +952,7 @@ func (c *Cache) openFile(f FileArtifact) (r io.ReadCloser, err error) { } }() } - return f.Cure(&RContext{c}) + return f.Cure(&RContext{common{c}}) } return } @@ -1455,7 +1448,7 @@ func (c *Cache) cure(a Artifact, curesExempt bool) ( if err = c.enterCure(a, curesExempt); err != nil { return } - r, err = f.Cure(&RContext{c}) + r, err = f.Cure(&RContext{common{c}}) if err == nil { if checksumPathname == nil || c.IsStrict() { h := sha512.New384()