diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-01-27 01:16:21 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-01-27 01:23:50 +0900 |
| commit | eb67e5e0a8821058fed782bf9c90b45c793036a5 (patch) | |
| tree | 7c115251881b0832309967404206a417cfb332c7 /internal/pkg/exec.go | |
| parent | 948afe33e5006f7e37e24bbc69be2e527a07ddb3 (diff) | |
internal/pkg: exclusive artifacts
This alleviates scheduler overhead when curing many artifacts.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pkg/exec.go')
| -rw-r--r-- | internal/pkg/exec.go | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/internal/pkg/exec.go b/internal/pkg/exec.go index 3d3f0b65..0c43cff0 100644 --- a/internal/pkg/exec.go +++ b/internal/pkg/exec.go @@ -105,6 +105,9 @@ type execArtifact struct { // equivalent to execTimeoutDefault. This value is never encoded in Params // because it cannot affect outcome. timeout time.Duration + + // Caller-supplied exclusivity value, returned as is by IsExclusive. + exclusive bool } var _ fmt.Stringer = new(execArtifact) @@ -123,7 +126,7 @@ var _ KnownChecksum = new(execNetArtifact) func (a *execNetArtifact) Checksum() Checksum { return a.checksum } // Kind returns the hardcoded [Kind] constant. -func (a *execNetArtifact) Kind() Kind { return KindExecNet } +func (*execNetArtifact) Kind() Kind { return KindExecNet } // Params is [Checksum] concatenated with [KindExec] params. func (a *execNetArtifact) Params(ctx *IContext) { @@ -157,13 +160,14 @@ func (a *execNetArtifact) Cure(f *FContext) error { // negative timeout value is equivalent tp [ExecTimeoutDefault], a timeout value // greater than [ExecTimeoutMax] is equivalent to [ExecTimeoutMax]. // -// The user-facing name is not accessible from the container and does not -// affect curing outcome. Because of this, it is omitted from parameter data -// for computing identifier. +// The user-facing name and exclusivity value are not accessible from the +// container and does not affect curing outcome. Because of this, it is omitted +// from parameter data for computing identifier. func NewExec( name string, checksum *Checksum, timeout time.Duration, + exclusive bool, dir *check.Absolute, env []string, @@ -181,7 +185,7 @@ func NewExec( if timeout > ExecTimeoutMax { timeout = ExecTimeoutMax } - a := execArtifact{name, paths, dir, env, pathname, args, timeout} + a := execArtifact{name, paths, dir, env, pathname, args, timeout, exclusive} if checksum == nil { return &a } @@ -189,7 +193,7 @@ func NewExec( } // Kind returns the hardcoded [Kind] constant. -func (a *execArtifact) Kind() Kind { return KindExec } +func (*execArtifact) Kind() Kind { return KindExec } // Params writes paths, executable pathname and args. func (a *execArtifact) Params(ctx *IContext) { @@ -237,6 +241,9 @@ func (a *execArtifact) Dependencies() []Artifact { return slices.Concat(artifacts...) } +// IsExclusive returns the caller-supplied exclusivity value. +func (a *execArtifact) IsExclusive() bool { return a.exclusive } + // String returns the caller-supplied reporting name. func (a *execArtifact) String() string { return a.name } |
