This repository has been archived by the owner on Mar 24, 2022. It is now read-only.
forked from cloudfoundry/bosh-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
interfaces.go
111 lines (78 loc) · 2.75 KB
/
interfaces.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package releasedir
import (
"io"
semver "github.com/cppforlife/go-semi-semantic/version"
boshrel "github.com/cloudfoundry/bosh-cli/release"
boshrelman "github.com/cloudfoundry/bosh-cli/release/manifest"
)
//go:generate counterfeiter . ReleaseDir
type ReleaseDir interface {
Init(bool) error
Reset() error
GenerateJob(string) error
GeneratePackage(string) error
// DefaultName returns a string for the release.
DefaultName() (string, error)
// NextDevVersion and NextFinalVersion returns a next version for the that name.
// It does not account for gaps and just plainly increments.
NextDevVersion(name string, timestamp bool) (semver.Version, error)
NextFinalVersion(name string) (semver.Version, error)
// FindRelease returns last dev or final release version if it's empty;
// otherwise it finds a release by given name and version.
FindRelease(name string, version semver.Version) (boshrel.Release, error)
// BuildRelease builds a new version of the Release
// from the release directory by looking at jobs, packages, etc. directories.
BuildRelease(name string, version semver.Version, force bool) (boshrel.Release, error)
// FinalizeRelease adds the Release to the final list so that it's consumable by others.
FinalizeRelease(release boshrel.Release, force bool) error
}
//go:generate counterfeiter . Config
type Config interface {
Name() (string, error)
SaveName(string) error
Blobstore() (string, map[string]interface{}, error)
}
//go:generate counterfeiter . Generator
type Generator interface {
GenerateJob(string) error
GeneratePackage(string) error
}
//go:generate counterfeiter . GitRepo
type GitRepo interface {
Init() error
LastCommitSHA() (string, error)
MustNotBeDirty(force bool) (dirty bool, err error)
}
//go:generate counterfeiter . BlobsDir
type BlobsDir interface {
Init() error
Blobs() ([]Blob, error)
DownloadBlobs(numOfParallelWorkers int) error
UploadBlobs() error
TrackBlob(string, io.ReadCloser) (Blob, error)
UntrackBlob(string) error
}
//go:generate counterfeiter . BlobsDirReporter
type BlobsDirReporter interface {
BlobDownloadStarted(path string, size int64, blobID, sha1 string)
BlobDownloadFinished(path, blobID string, err error)
BlobUploadStarted(path string, size int64, sha1 string)
BlobUploadFinished(path, blobID string, err error)
}
type Blob struct {
Path string
Size int64
BlobstoreID string
SHA1 string
}
//go:generate counterfeiter . ReleaseIndex
type ReleaseIndex interface {
LastVersion(name string) (*semver.Version, error)
Contains(boshrel.Release) (bool, error)
Add(boshrelman.Manifest) error
ManifestPath(name, version string) string
}
//go:generate counterfeiter . ReleaseIndexReporter
type ReleaseIndexReporter interface {
ReleaseIndexAdded(name, desc string, err error)
}