-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrattle.go
More file actions
82 lines (67 loc) · 1.3 KB
/
Copy pathrattle.go
File metadata and controls
82 lines (67 loc) · 1.3 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package rattle
import (
"context"
"time"
)
type Fault interface {
Name() string
Apply(ctx context.Context, env Environment, p Params) (Rollback, error)
}
type Rollback func(ctx context.Context) error
type Probe interface {
Name() string
Check(ctx context.Context, env Environment, p Params) error
}
type Environment interface {
Name() string
Exec(ctx context.Context, cmd string, args ...string) ([]byte, error)
Close() error
}
type FailureAction string
const (
FailureAbort FailureAction = "abort"
FailureContinue FailureAction = "continue"
)
type Scenario struct {
Name string
Description string
Env Environment
Hypothesis []ProbeStep
Faults []FaultStep
Monitors []MonitorStep
Recovery []ProbeStep
Schedule Schedule
OnFailure FailureAction
}
type ProbeStep struct {
Name string
Probe Probe
Params Params
Retry RetryConfig
Env Environment
}
type FaultStep struct {
Name string
Fault Fault
Params Params
Duration time.Duration
Env Environment
}
type MonitorStep struct {
ProbeStep
Interval time.Duration
}
type Schedule struct {
Mode ScheduleMode
Delay time.Duration
}
type ScheduleMode uint8
const (
Sequential ScheduleMode = iota
Parallel
Staggered
)
type RetryConfig struct {
Attempts int
Delay time.Duration
}