internal/pkg: consolidate cache attributes
Test / Create distribution (push) Successful in 54s
Test / Sandbox (push) Successful in 2m58s
Test / ShareFS (push) Successful in 3m56s
Test / Hakurei (push) Successful in 3m59s
Test / Sandbox (race detector) (push) Successful in 5m31s
Test / Hakurei (race detector) (push) Successful in 6m38s
Test / Flake checks (push) Successful in 1m5s
Test / Create distribution (push) Successful in 54s
Test / Sandbox (push) Successful in 2m58s
Test / ShareFS (push) Successful in 3m56s
Test / Hakurei (push) Successful in 3m59s
Test / Sandbox (race detector) (push) Successful in 5m31s
Test / Hakurei (race detector) (push) Successful in 6m38s
Test / Flake checks (push) Successful in 1m5s
This makes the interface stable. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
+6
-9
@@ -21,7 +21,7 @@ type cache struct {
|
||||
// Should generally not be used directly.
|
||||
c *pkg.Cache
|
||||
|
||||
cures, jobs int
|
||||
attr pkg.CacheAttr
|
||||
// Primarily to work around missing landlock LSM.
|
||||
hostAbstract bool
|
||||
// Set SCHED_IDLE.
|
||||
@@ -49,18 +49,17 @@ func (cache *cache) open() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
var flags int
|
||||
if cache.idle {
|
||||
flags |= pkg.CSchedIdle
|
||||
cache.attr.Flags |= pkg.CSchedIdle
|
||||
}
|
||||
if cache.hostAbstract {
|
||||
flags |= pkg.CHostAbstract
|
||||
cache.attr.Flags |= pkg.CHostAbstract
|
||||
}
|
||||
if !cache.verboseInit {
|
||||
flags |= pkg.CSuppressInit
|
||||
cache.attr.Flags |= pkg.CSuppressInit
|
||||
}
|
||||
if !cache.deep {
|
||||
flags |= pkg.CExternShallow
|
||||
cache.attr.Flags |= pkg.CExternShallow
|
||||
}
|
||||
|
||||
done := make(chan struct{})
|
||||
@@ -82,10 +81,8 @@ func (cache *cache) open() (err error) {
|
||||
cache.c, err = pkg.Open(
|
||||
cache.ctx,
|
||||
cache.msg,
|
||||
flags,
|
||||
cache.cures,
|
||||
cache.jobs,
|
||||
base,
|
||||
&cache.attr,
|
||||
)
|
||||
if err != nil {
|
||||
return
|
||||
|
||||
@@ -28,8 +28,8 @@ func TestNoReply(t *testing.T) {
|
||||
c, err := pkg.Open(
|
||||
t.Context(),
|
||||
message.New(log.New(os.Stderr, "cir: ", 0)),
|
||||
0, 0, 0,
|
||||
check.MustAbs(t.TempDir()),
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Open: error = %v", err)
|
||||
|
||||
+4
-4
@@ -203,11 +203,11 @@ func main() {
|
||||
"v", command.BoolFlag(false),
|
||||
"Do not suppress verbose output from init",
|
||||
).Flag(
|
||||
&cm.cures,
|
||||
&cm.attr.Cures,
|
||||
"cures", command.IntFlag(0),
|
||||
"Maximum number of dependencies to cure at any given time",
|
||||
).Flag(
|
||||
&cm.jobs,
|
||||
&cm.attr.Jobs,
|
||||
"jobs", command.IntFlag(0),
|
||||
"Preferred number of jobs to run, when applicable",
|
||||
).Flag(
|
||||
@@ -934,8 +934,8 @@ func main() {
|
||||
return fmt.Errorf("unknown artifact %q", args[1])
|
||||
}
|
||||
|
||||
if !a.IsExclusive() && cm.jobs < 1 {
|
||||
cm.jobs = runtime.NumCPU()/n + 1
|
||||
if !a.IsExclusive() && cm.attr.Jobs < 1 {
|
||||
cm.attr.Jobs = runtime.NumCPU()/n + 1
|
||||
}
|
||||
|
||||
res := make([]unique.Handle[pkg.Checksum], n)
|
||||
|
||||
Reference in New Issue
Block a user