aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-02-15 00:45:37 +0900
committerOphestra <cat@gensokyo.uk>2026-02-15 00:45:37 +0900
commit4f570cc5c96192a40f210db6ea5f3210813095ad (patch)
treed70495658708a7cb0d3595b5111601d1d29dd8e6
parent5828631e79dc9ee788c8dc148de18d14994591ee (diff)
internal/pkg: expose extra methods to file
This is useful for FileArtifact processing another stream. Signed-off-by: Ophestra <cat@gensokyo.uk>
-rw-r--r--internal/pkg/pkg.go13
1 files changed, 3 insertions, 10 deletions
diff --git a/internal/pkg/pkg.go b/internal/pkg/pkg.go
index 54ac571d..5f6f15d2 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()