diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-07-02 22:59:40 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-07-02 23:21:31 +0900 |
| commit | dde69dde61e57fa929596294f6b4e8f798f5598e (patch) | |
| tree | da95820f75371a14da57d934cfd5c0ce1f105bef /internal/pkg/pkg.go | |
| parent | 3ba6609444978907fe047007f5218271ba97a153 (diff) | |
internal/pkg: rename inputs method
Inputs is more correct than dependencies in the current terminology.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pkg/pkg.go')
| -rw-r--r-- | internal/pkg/pkg.go | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/internal/pkg/pkg.go b/internal/pkg/pkg.go index 6bf34b2a..d3816f08 100644 --- a/internal/pkg/pkg.go +++ b/internal/pkg/pkg.go @@ -330,8 +330,8 @@ func (c *common) Open(a Artifact) (r io.ReadCloser, err error) { type FContext struct { TContext - // Cured top-level dependencies looked up by Pathname. - deps map[Artifact]cureRes + // Cured top-level inputs looked up by Pathname. + inputs map[Artifact]cureRes } // linkSubstitute links status for substitute if populated. @@ -373,7 +373,7 @@ func (f *FContext) GetArtifact(a Artifact) ( pathname *check.Absolute, checksum unique.Handle[Checksum], ) { - if res, ok := f.deps[a]; ok { + if res, ok := f.inputs[a]; ok { return res.pathname, res.checksum } panic(InvalidLookupError(f.cache.Ident(a).Value())) @@ -405,13 +405,13 @@ type Artifact interface { // Result must remain identical across multiple invocations. Params(ctx *IContext) - // Dependencies returns a slice of [Artifact] that the current instance - // depends on to produce its contents. + // Inputs returns a slice of [Artifact] the current instance has access to + // while producing its output. // // Callers must not modify the retuned slice. // // Result must remain identical across multiple invocations. - Dependencies() []Artifact + Inputs() []Artifact // IsExclusive returns whether the [Artifact] is exclusive. Exclusive // artifacts might not run in parallel with each other, and are still @@ -2180,15 +2180,15 @@ func (c *Cache) cure(a Artifact, curesExempt bool) ( break case FloodArtifact: - deps := a.Dependencies() - f := FContext{t, make(map[Artifact]cureRes, len(deps))} + inputs := a.Inputs() + f := FContext{t, make(map[Artifact]cureRes, len(inputs))} var wg sync.WaitGroup - wg.Add(len(deps)) - res := make([]cureRes, len(deps)) - errs := make(DependencyCureError, 0, len(deps)) + wg.Add(len(inputs)) + res := make([]cureRes, len(inputs)) + errs := make(DependencyCureError, 0, len(inputs)) var errsMu sync.Mutex - for i, d := range deps { + for i, d := range inputs { pending := pendingArtifactDep{d, &res[i], &errs, &errsMu, &wg} go pending.cure(c) } @@ -2199,11 +2199,11 @@ func (c *Cache) cure(a Artifact, curesExempt bool) ( return } for i, p := range res { - f.deps[deps[i]] = p + f.inputs[inputs[i]] = p } sh := sha512.New384() - err = c.encode(sh, a, f.deps) + err = c.encode(sh, a, f.inputs) if err != nil { return } @@ -2697,6 +2697,8 @@ func IsCollected(err error) bool { return errors.As(err, new(Collected)) } // [pkg.Artifact]. It returns [Collected]. type Collect []Artifact +var _ Artifact = new(Collect) + // Cure returns [Collected]. func (*Collect) Cure(*FContext) error { return Collected{} } @@ -2706,8 +2708,8 @@ func (*Collect) Kind() Kind { return kindCollection } // Params is a noop: dependencies are already represented in the header. func (*Collect) Params(*IContext) {} -// Dependencies returns [Collect] as is. -func (c *Collect) Dependencies() []Artifact { return *c } +// Inputs returns [Collect] as is. +func (c *Collect) Inputs() []Artifact { return *c } // IsExclusive returns false: Cure is a noop. func (*Collect) IsExclusive() bool { return false } |
