-
Notifications
You must be signed in to change notification settings - Fork 20
/
state.go
66 lines (60 loc) · 2.32 KB
/
state.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
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
package assets
// AssetState represents the state of an asset in the process of being pulled.
type AssetState string
// Constants defining various states of the asset pulling process.
const (
// SeedSelect select first candidate to pull seed asset
SeedSelect AssetState = "SeedSelect"
// SeedPulling Waiting for candidate nodes to pull seed asset
SeedPulling AssetState = "SeedPulling"
// UploadInit Initialize user upload preparation
UploadInit AssetState = "UploadInit"
// SeedUploading Waiting for user to upload asset to candidate node
SeedUploading AssetState = "SeedUploading"
// CandidatesSelect select candidates to pull asset
CandidatesSelect AssetState = "CandidatesSelect"
// CandidatesPulling candidate nodes pulling asset
CandidatesPulling AssetState = "CandidatesPulling"
// EdgesSelect select edges to pull asset
EdgesSelect AssetState = "EdgesSelect"
// EdgesPulling edge nodes pulling asset
EdgesPulling AssetState = "EdgesPulling"
// Servicing Asset cache completed and in service
Servicing AssetState = "Servicing"
// SeedFailed Unable to select candidate nodes or failed to pull seed asset
SeedFailed AssetState = "SeedFailed"
// CandidatesFailed Unable to select candidate nodes or failed to pull asset
CandidatesFailed AssetState = "CandidatesFailed"
// EdgesFailed Unable to select edge nodes or failed to pull asset
EdgesFailed AssetState = "EdgesFailed"
// UploadFailed User failed to upload assets
UploadFailed AssetState = "UploadFailed"
// Remove remove
Remove AssetState = "Remove"
)
// String returns the string representation of the AssetState.
func (s AssetState) String() string {
return string(s)
}
var (
// FailedStates contains a list of asset pull states that represent failures.
FailedStates = []string{
SeedFailed.String(),
CandidatesFailed.String(),
EdgesFailed.String(),
UploadFailed.String(),
}
// PullingStates contains a list of asset pull states that represent pulling.
PullingStates = []string{
SeedSelect.String(),
SeedPulling.String(),
UploadInit.String(),
SeedUploading.String(),
CandidatesSelect.String(),
CandidatesPulling.String(),
EdgesSelect.String(),
EdgesPulling.String(),
}
// ActiveStates contains a list of asset pull states that represent active.
ActiveStates = append(append([]string{Servicing.String()}, FailedStates...), PullingStates...)
)