forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.go
58 lines (48 loc) · 1.39 KB
/
build.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
package test
import (
"sync"
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch"
buildapi "github.com/openshift/origin/pkg/build/api"
)
type BuildRegistry struct {
Err error
Builds *buildapi.BuildList
Build *buildapi.Build
DeletedBuildID string
sync.Mutex
}
func (r *BuildRegistry) ListBuilds(ctx kapi.Context, labels labels.Selector, field fields.Selector) (*buildapi.BuildList, error) {
r.Lock()
defer r.Unlock()
return r.Builds, r.Err
}
func (r *BuildRegistry) GetBuild(ctx kapi.Context, id string) (*buildapi.Build, error) {
r.Lock()
defer r.Unlock()
return r.Build, r.Err
}
func (r *BuildRegistry) CreateBuild(ctx kapi.Context, build *buildapi.Build) error {
r.Lock()
defer r.Unlock()
r.Build = build
return r.Err
}
func (r *BuildRegistry) UpdateBuild(ctx kapi.Context, build *buildapi.Build) error {
r.Lock()
defer r.Unlock()
r.Build = build
return r.Err
}
func (r *BuildRegistry) DeleteBuild(ctx kapi.Context, id string) error {
r.Lock()
defer r.Unlock()
r.DeletedBuildID = id
r.Build = nil
return r.Err
}
func (r *BuildRegistry) WatchBuilds(ctx kapi.Context, label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) {
return nil, r.Err
}