forked from evergreen-ci/evergreen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config_repotracker.go
33 lines (26 loc) · 1.11 KB
/
config_repotracker.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 evergreen
import (
"context"
"github.com/pkg/errors"
"go.mongodb.org/mongo-driver/bson"
)
// RepoTrackerConfig holds settings for polling project repositories.
type RepoTrackerConfig struct {
NumNewRepoRevisionsToFetch int `bson:"revs_to_fetch" json:"revs_to_fetch" yaml:"revs_to_fetch"`
MaxRepoRevisionsToSearch int `bson:"max_revs_to_search" json:"max_revs_to_search" yaml:"max_revs_to_search"`
MaxConcurrentRequests int `bson:"max_con_requests" json:"max_con_requests" yaml:"max_concurrent_requests"`
}
func (c *RepoTrackerConfig) SectionId() string { return "repotracker" }
func (c *RepoTrackerConfig) Get(ctx context.Context) error {
return getConfigSection(ctx, c)
}
func (c *RepoTrackerConfig) Set(ctx context.Context) error {
return errors.Wrapf(setConfigSection(ctx, c.SectionId(), bson.M{
"$set": bson.M{
"revs_to_fetch": c.NumNewRepoRevisionsToFetch,
"max_revs_to_search": c.MaxRepoRevisionsToSearch,
"max_con_requests": c.MaxConcurrentRequests,
}}), "updating config section '%s'", c.SectionId(),
)
}
func (c *RepoTrackerConfig) ValidateAndDefault() error { return nil }