forked from buildpacks/pack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterfaces.go
53 lines (44 loc) · 2.16 KB
/
interfaces.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
package pack
import (
"context"
"io"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/network"
"github.com/google/go-containerregistry/pkg/v1"
"github.com/buildpack/pack/image"
)
//go:generate mockgen -package mocks -destination mocks/docker.go github.com/buildpack/pack Docker
type Docker interface {
PullImage(ref string) error
RunContainer(ctx context.Context, id string, stdout io.Writer, stderr io.Writer) error
VolumeRemove(ctx context.Context, volumeID string, force bool) error
ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error)
ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error
CopyToContainer(ctx context.Context, containerID, dstPath string, content io.Reader, options types.CopyToContainerOptions) error
CopyFromContainer(ctx context.Context, containerID, srcPath string) (io.ReadCloser, types.ContainerPathStat, error)
ImageBuild(ctx context.Context, buildContext io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
ImageInspectWithRaw(ctx context.Context, imageID string) (types.ImageInspect, []byte, error)
}
//go:generate mockgen -package mocks -destination mocks/images.go github.com/buildpack/pack Images
type Images interface {
ReadImage(repoName string, useDaemon bool) (v1.Image, error)
}
//go:generate mockgen -package mocks -destination mocks/task.go github.com/buildpack/pack Task
type Task interface {
Run() error
}
//go:generate mockgen -package mocks -destination mocks/fs.go github.com/buildpack/pack FS
type FS interface {
CreateTarFile(tarFile, srcDir, tarDir string, uid, gid int) error
CreateTarReader(srcDir, tarDir string, uid, gid int) (io.Reader, chan error)
Untar(r io.Reader, dest string) error
CreateSingleFileTar(path, txt string) (io.Reader, error)
}
type WritableStore interface {
Write(image v1.Image) error
}
type ImageFactory interface {
NewLocal(string, bool) (image.Image, error)
NewRemote(string) (image.Image, error)
}