-
Notifications
You must be signed in to change notification settings - Fork 246
/
storage.go
63 lines (58 loc) · 2.73 KB
/
storage.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
package storage
import (
"io"
"github.com/brigadecore/brigade/pkg/brigade"
)
// DeleteBuildOptions represents options for a build deletion
type DeleteBuildOptions struct {
SkipRunningBuilds bool
}
// ProjectStore represents storage for projects.
type ProjectStore interface {
// GetProjects retrieves all projects from storage.
GetProjects() ([]*brigade.Project, error)
// GetProject retrieves the project from storage.
GetProject(id string) (*brigade.Project, error)
// GetProjectBuilds retrieves the project's builds from storage.
GetProjectBuilds(proj *brigade.Project) ([]*brigade.Build, error)
// CreateProject creates a new project record in storage.
CreateProject(proj *brigade.Project) error
// ReplaceProject replaces a project record in storage.
ReplaceProject(proj *brigade.Project) error
// DeleteProject deletes a project from storage.
DeleteProject(id string) error
}
// Store represents a storage engine for a brigade projects, builds, and jobs.
type Store interface {
ProjectStore
// GetBuilds retrieves all active builds from storage.
GetBuilds() ([]*brigade.Build, error)
// GetBuild retrieves the build from storage.
GetBuild(id string) (*brigade.Build, error)
// DeleteBuild deletes the build from storage.
DeleteBuild(id string, options DeleteBuildOptions) error
// CreateBuild creates a new job for the work queue.
CreateBuild(build *brigade.Build) error
// GetBuildJobs retrieves all build jobs (pods) from storage.
GetBuildJobs(build *brigade.Build) ([]*brigade.Job, error)
// GetWorker returns the worker for a given build.
GetWorker(buildID string) (*brigade.Worker, error)
// GetJob retrieves the job from storage.
GetJob(id string) (*brigade.Job, error)
// GetJobLog retrieves all logs for a job from storage.
GetJobLog(job *brigade.Job) (string, error)
// GetJobLogStream retrieve a stream of all logs for a job from storage.
GetJobLogStream(job *brigade.Job) (io.ReadCloser, error)
// GetJobLogStreamFollow retrieve a follow stream of all logs for a job from storage.
GetJobLogStreamFollow(job *brigade.Job) (io.ReadCloser, error)
// GetWorkerInitLog retrieves all logs for a worker's init container from storage.
GetWorkerInitLog(job *brigade.Worker) (string, error)
// GetWorkerLog retrieves all logs for a worker from storage.
GetWorkerLog(job *brigade.Worker) (string, error)
// GetWorkerLogStream retrieve a stream of all logs for a worker from storage.
GetWorkerLogStream(job *brigade.Worker) (io.ReadCloser, error)
// GetWorkerLogStreamFollow retrieve a followed stream of all logs for a worker from storage.
GetWorkerLogStreamFollow(job *brigade.Worker) (io.ReadCloser, error)
// GetStorageClassNames returns the names of the StorageClass instances in the cluster
GetStorageClassNames() ([]string, error)
}