forked from vmware-archive/atc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
volume.go
92 lines (68 loc) · 1.97 KB
/
volume.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
package worker
import (
"io"
"github.com/concourse/atc/dbng"
"github.com/concourse/baggageclaim"
)
//go:generate counterfeiter . Volume
type Volume interface {
Handle() string
Path() string
SetProperty(key string, value string) error
Properties() (baggageclaim.VolumeProperties, error)
StreamIn(path string, tarStream io.Reader) error
StreamOut(path string) (io.ReadCloser, error)
COWStrategy() baggageclaim.COWStrategy
IsInitialized() (bool, error)
Initialize() error
CreateChildForContainer(dbng.CreatingContainer, string) (dbng.CreatingVolume, error)
Destroy() error
}
type VolumeMount struct {
Volume Volume
MountPath string
}
type volume struct {
bcVolume baggageclaim.Volume
dbVolume dbng.CreatedVolume
}
func NewVolume(
bcVolume baggageclaim.Volume,
dbVolume dbng.CreatedVolume,
) Volume {
return &volume{
bcVolume: bcVolume,
dbVolume: dbVolume,
}
}
func (v *volume) Handle() string { return v.bcVolume.Handle() }
func (v *volume) Path() string { return v.bcVolume.Path() }
func (v *volume) SetProperty(key string, value string) error {
return v.bcVolume.SetProperty(key, value)
}
func (v *volume) StreamIn(path string, tarStream io.Reader) error {
return v.bcVolume.StreamIn(path, tarStream)
}
func (v *volume) StreamOut(path string) (io.ReadCloser, error) {
return v.bcVolume.StreamOut(path)
}
func (v *volume) Properties() (baggageclaim.VolumeProperties, error) {
return v.bcVolume.Properties()
}
func (v *volume) Destroy() error {
return v.bcVolume.Destroy()
}
func (v *volume) COWStrategy() baggageclaim.COWStrategy {
return baggageclaim.COWStrategy{
Parent: v.bcVolume,
}
}
func (v *volume) IsInitialized() (bool, error) {
return v.dbVolume.IsInitialized()
}
func (v *volume) Initialize() error {
return v.dbVolume.Initialize()
}
func (v *volume) CreateChildForContainer(creatingContainer dbng.CreatingContainer, mountPath string) (dbng.CreatingVolume, error) {
return v.dbVolume.CreateChildForContainer(creatingContainer, mountPath)
}