forked from vmware-archive/atc
/
resource.go
64 lines (49 loc) · 1.22 KB
/
resource.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
package resource
import (
"io"
"os"
"path/filepath"
"github.com/concourse/atc"
"github.com/concourse/atc/dbng"
"github.com/concourse/atc/worker"
)
//go:generate counterfeiter . Resource
type Resource interface {
Get(worker.Volume, IOConfig, atc.Source, atc.Params, atc.Version, <-chan os.Signal, chan<- struct{}) (VersionedSource, error)
Put(IOConfig, atc.Source, atc.Params, <-chan os.Signal, chan<- struct{}) (VersionedSource, error)
Check(atc.Source, atc.Version) ([]atc.Version, error)
Container() worker.Container
}
type ResourceType string
type Session struct {
Metadata dbng.ContainerMetadata
}
//go:generate counterfeiter . Cache
type Cache interface {
IsInitialized() (bool, error)
Initialize() error
Volume() worker.Volume
}
type Metadata interface {
Env() []string
}
type IOConfig struct {
Stdout io.Writer
Stderr io.Writer
}
// TODO: check if we need it
func ResourcesDir(suffix string) string {
return filepath.Join("/tmp", "build", suffix)
}
type resource struct {
container worker.Container
ScriptFailure bool
}
func NewResourceForContainer(container worker.Container) Resource {
return &resource{
container: container,
}
}
func (r *resource) Container() worker.Container {
return r.container
}