-
Notifications
You must be signed in to change notification settings - Fork 0
/
staging-models.go
47 lines (41 loc) · 1.98 KB
/
staging-models.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
package forklift
import (
"github.com/PlanktoScope/forklift/pkg/core"
)
// Stage Store
const (
StageStoreManifestFile = "forklift-stage-store.yml"
StageStoreManifestSwapFile = "forklift-stage-store-swap.yml"
)
// FSStageStore is a source of bundles rooted at a single path, with bundles stored as
// incrementally-numbered directories within a [core.PathedFS] filesystem.
type FSStageStore struct {
// Manifest is the Forklift stage store's manifest.
Manifest StageStoreManifest
// FS is the filesystem which corresponds to the store of staged pallets.
FS core.PathedFS
}
// A StageStoreManifest holds the state of the stage store.
type StageStoreManifest struct {
// ForkliftVersion indicates that the stage store manifest was written assuming the semantics of
// a given version of Forklift. The version must be a valid Forklift version, and it sets the
// minimum version of Forklift required to use the stage store. The Forklift tool refuses to use
// stage stores declaring newer Forklift versions for any operations beyond printing information.
ForkliftVersion string `yaml:"forklift-version"`
// Stages keeps track of special stages
Stages StagesSpec `yaml:"staged"`
}
// StagesSpec describes the state of a stage store.
type StagesSpec struct {
// Next is the index of the next staged pallet bundle which should be applied. Once it's applied
// successfully, it'll be pushed onto the History stack.
Next int `yaml:"next,omitempty"`
// NextFailed records whether the next staged pallet bundle had failed to be applied.
NextFailed bool `yaml:"next-failed,omitempty"`
// History is the stack of staged pallet bundles which have been applied successfully, with the
// most-recently-applied bundle last. The most-recently-applied bundle can be used as a fallback
// If the next staged pallet bundle (if it exists) is not applied successfully.
History []int `yaml:"history,omitempty"`
// Names is a list of aliases for staged pallet bundles.
Names map[string]int `yaml:"names,omitempty"`
}