Skip to content

Commit 133d950

Browse files
committed
feat: add scope for preheating job
Signed-off-by: Gaius <gaius.qi@gmail.com>
1 parent f2fac17 commit 133d950

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

internal/job/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ type PreheatRequest struct {
2727
Headers map[string]string `json:"headers" validate:"omitempty"`
2828
Application string `json:"application" validate:"omitempty"`
2929
Priority int32 `json:"priority" validate:"omitempty"`
30+
Scope string `json:"scope" validate:"omitempty"`
3031
}
3132

3233
// PreheatResponse defines the response parameters for preheating.

manager/types/job.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@
1616

1717
package types
1818

19+
// Scope is the scope for preheating.
20+
type Scope string
21+
22+
const (
23+
// SingleSeedPeerScope represents the scope that only single seed peer will be preheated.
24+
SingleSeedPeerScope Scope = "single_seed_peer"
25+
26+
// AllPeersScope represents the scope that all peers will be preheated.
27+
ALLPeersScope Scope = "all_peers"
28+
)
29+
1930
type CreateJobRequest struct {
2031
BIO string `json:"bio" binding:"omitempty"`
2132
Type string `json:"type" binding:"required"`
@@ -76,6 +87,9 @@ type PreheatArgs struct {
7687

7788
// The image type preheating task can specify the image architecture type. eg: linux/amd64.
7889
Platform string `json:"platform" binding:"omitempty"`
90+
91+
// Scope is the scope for preheating.
92+
Scope string `json:"scope" binding:"omitempty,oneof=single_seed_peer all_peers"`
7993
}
8094

8195
type CreateGetTaskJobRequest struct {

0 commit comments

Comments
 (0)