internal/pkg: expose cure through cure context
All checks were successful
Test / Create distribution (push) Successful in 45s
Test / Sandbox (push) Successful in 2m44s
Test / ShareFS (push) Successful in 3m45s
Test / Hpkg (push) Successful in 4m39s
Test / Sandbox (race detector) (push) Successful in 4m52s
Test / Hakurei (race detector) (push) Successful in 5m48s
Test / Hakurei (push) Successful in 2m30s
Test / Flake checks (push) Successful in 1m42s

This allows a curing Artifact to cure Artifact it depends on.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-01-06 01:04:06 +09:00
parent e91049c3c5
commit 86ad8b72aa

View File

@@ -78,6 +78,15 @@ func (c *CureContext) GetWorkDir() *check.Absolute { return c.work }
// create it if they wish to use it, using [os.MkdirAll].
func (c *CureContext) GetTempDir() *check.Absolute { return c.temp }
// Cure cures the [Artifact] and returns its pathname and [Checksum].
func (c *CureContext) Cure(a Artifact) (
pathname *check.Absolute,
checksum Checksum,
err error,
) {
return c.cache.Cure(a)
}
// LoadData tries to load [File] from [Cache], and if that fails, obtains it via
// [File.Data] instead. Notably, it does not cure [File].
func (c *CureContext) LoadData(f File) (data []byte, err error) {