43 lines
1.5 KiB
Go
43 lines
1.5 KiB
Go
|
|
package entity
|
||
|
|
|
||
|
|
import "go.mongodb.org/mongo-driver/bson/primitive"
|
||
|
|
|
||
|
|
const TemplateCollectionName = "job_templates"
|
||
|
|
|
||
|
|
type CancelPolicy struct {
|
||
|
|
Supported bool `bson:"supported"`
|
||
|
|
Mode string `bson:"mode"`
|
||
|
|
GraceSeconds int `bson:"grace_seconds"`
|
||
|
|
}
|
||
|
|
|
||
|
|
type RetryPolicy struct {
|
||
|
|
MaxAttempts int `bson:"max_attempts"`
|
||
|
|
BackoffSeconds []int `bson:"backoff_seconds"`
|
||
|
|
}
|
||
|
|
|
||
|
|
type TemplateStep struct {
|
||
|
|
ID string `bson:"id"`
|
||
|
|
Name string `bson:"name"`
|
||
|
|
WorkerType string `bson:"worker_type"`
|
||
|
|
TimeoutSeconds int `bson:"timeout_seconds"`
|
||
|
|
Cancelable bool `bson:"cancelable"`
|
||
|
|
}
|
||
|
|
|
||
|
|
type Template struct {
|
||
|
|
ID primitive.ObjectID `bson:"_id,omitempty"`
|
||
|
|
Type string `bson:"type"`
|
||
|
|
Version int `bson:"version"`
|
||
|
|
Name string `bson:"name"`
|
||
|
|
Description string `bson:"description"`
|
||
|
|
Enabled bool `bson:"enabled"`
|
||
|
|
Repeatable bool `bson:"repeatable"`
|
||
|
|
ConcurrencyPolicy string `bson:"concurrency_policy"`
|
||
|
|
DedupeKeys []string `bson:"dedupe_keys"`
|
||
|
|
TimeoutSeconds int `bson:"timeout_seconds"`
|
||
|
|
CancelPolicy CancelPolicy `bson:"cancel_policy"`
|
||
|
|
RetryPolicy RetryPolicy `bson:"retry_policy"`
|
||
|
|
Steps []TemplateStep `bson:"steps"`
|
||
|
|
CreateAt int64 `bson:"create_at"`
|
||
|
|
UpdateAt int64 `bson:"update_at"`
|
||
|
|
}
|