-
Notifications
You must be signed in to change notification settings - Fork 85
/
deal.go
33 lines (28 loc) · 876 Bytes
/
deal.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package cliflags
import (
"github.com/spf13/pflag"
"github.com/bacalhau-project/bacalhau/cmd/util/flags"
"github.com/bacalhau-project/bacalhau/pkg/model"
)
func NewDefaultDealFlagSettings() *DealFlagSettings {
return &DealFlagSettings{
Concurrency: 1,
TargetingMode: model.TargetAny,
}
}
type DealFlagSettings struct {
TargetingMode model.TargetingMode
Concurrency int // Number of concurrent jobs to run
}
func DealFlags(settings *DealFlagSettings) *pflag.FlagSet {
flagset := pflag.NewFlagSet("Deal settings", pflag.ContinueOnError)
flagset.IntVar(
&settings.Concurrency,
"concurrency",
settings.Concurrency,
`How many nodes should run the job`,
)
flagset.Var(flags.TargetingFlag(&settings.TargetingMode), "target",
`Whether to target the minimum number of matching nodes ("any") (default) or all matching nodes ("all")`)
return flagset
}