2022-05-13 13:38:19 +00:00
|
|
|
package check
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"golang.org/x/sync/errgroup"
|
|
|
|
|
2022-08-02 18:45:09 +00:00
|
|
|
"code.1533b4dc0.de/prskr/nurse/config"
|
|
|
|
"code.1533b4dc0.de/prskr/nurse/grammar"
|
2022-05-13 13:38:19 +00:00
|
|
|
)
|
|
|
|
|
2022-06-09 20:40:32 +00:00
|
|
|
var _ SystemChecker = Collection(nil)
|
2022-05-13 13:38:19 +00:00
|
|
|
|
|
|
|
type Collection []SystemChecker
|
|
|
|
|
|
|
|
func (Collection) UnmarshalCheck(grammar.Check, config.ServerLookup) error {
|
|
|
|
panic("unmarshalling is not supported for a collection")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c Collection) Execute(ctx context.Context) error {
|
|
|
|
grp, grpCtx := errgroup.WithContext(ctx)
|
|
|
|
|
|
|
|
for i := range c {
|
|
|
|
chk := c[i]
|
|
|
|
grp.Go(func() error {
|
|
|
|
return chk.Execute(grpCtx)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
return grp.Wait()
|
|
|
|
}
|