forked from vmware-archive/atc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.go
93 lines (70 loc) · 1.98 KB
/
client.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
package worker
import (
"context"
"time"
"code.cloudfoundry.org/garden"
"code.cloudfoundry.org/lager"
"github.com/concourse/atc"
"github.com/concourse/atc/creds"
"github.com/concourse/atc/db"
"github.com/concourse/baggageclaim"
)
//go:generate counterfeiter . Client
type Client interface {
FindOrCreateContainer(
context.Context,
lager.Logger,
ImageFetchingDelegate,
db.ContainerOwner,
db.ContainerMetadata,
ContainerSpec,
creds.VersionedResourceTypes,
) (Container, error)
FindContainerByHandle(lager.Logger, int, string) (Container, bool, error)
LookupVolume(lager.Logger, string) (Volume, bool, error)
FindResourceTypeByPath(path string) (atc.WorkerResourceType, bool)
Satisfying(lager.Logger, WorkerSpec, creds.VersionedResourceTypes) (Worker, error)
AllSatisfying(lager.Logger, WorkerSpec, creds.VersionedResourceTypes) ([]Worker, error)
RunningWorkers(lager.Logger) ([]Worker, error)
}
//go:generate counterfeiter . InputSource
type InputSource interface {
Source() ArtifactSource
DestinationPath() string
}
//go:generate counterfeiter . BindMountSource
type BindMountSource interface {
VolumeOn(Worker) (garden.BindMount, bool, error)
}
type VolumeSpec struct {
Strategy baggageclaim.Strategy
Properties VolumeProperties
Privileged bool
TTL time.Duration
}
func (spec VolumeSpec) baggageclaimVolumeSpec() baggageclaim.VolumeSpec {
return baggageclaim.VolumeSpec{
Strategy: spec.Strategy,
Privileged: spec.Privileged,
Properties: baggageclaim.VolumeProperties(spec.Properties),
}
}
type HostRootFSStrategy struct {
Path string
WorkerName string
Version *string
}
func (strategy HostRootFSStrategy) baggageclaimStrategy() baggageclaim.Strategy {
return baggageclaim.ImportStrategy{
Path: strategy.Path,
}
}
//go:generate counterfeiter . Container
type Container interface {
garden.Container
Destroy() error
VolumeMounts() []VolumeMount
WorkerName() string
MarkAsHijacked() error
}
type VolumeProperties map[string]string