From: Nico Cesar Date: Tue, 16 Mar 2021 18:25:25 +0000 (-0400) Subject: restructuring docker as separate file X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/22bae2c9a45c7fa2f3e75c32733c10fcdf133c2f restructuring docker as separate file Arvados-DCO-1.1-Signed-off-by: Nico Cesar --- diff --git a/lib/crunchrun/crunchrun.go b/lib/crunchrun/crunchrun.go index 8c989d533b..c8ac9ec8be 100644 --- a/lib/crunchrun/crunchrun.go +++ b/lib/crunchrun/crunchrun.go @@ -35,9 +35,6 @@ import ( "git.arvados.org/arvados.git/sdk/go/manifest" "golang.org/x/net/context" - dockertypes "github.com/docker/docker/api/types" - dockercontainer "github.com/docker/docker/api/types/container" - dockernetwork "github.com/docker/docker/api/types/network" dockerclient "github.com/docker/docker/client" ) @@ -74,20 +71,6 @@ type RunArvMount func(args []string, tok string) (*exec.Cmd, error) type MkTempDir func(string, string) (string, error) -// ThinDockerClient is the minimal Docker client interface used by crunch-run. -type ThinDockerClient interface { - ContainerAttach(ctx context.Context, container string, options dockertypes.ContainerAttachOptions) (dockertypes.HijackedResponse, error) - ContainerCreate(ctx context.Context, config *dockercontainer.Config, hostConfig *dockercontainer.HostConfig, - networkingConfig *dockernetwork.NetworkingConfig, containerName string) (dockercontainer.ContainerCreateCreatedBody, error) - ContainerStart(ctx context.Context, container string, options dockertypes.ContainerStartOptions) error - ContainerRemove(ctx context.Context, container string, options dockertypes.ContainerRemoveOptions) error - ContainerWait(ctx context.Context, container string, condition dockercontainer.WaitCondition) (<-chan dockercontainer.ContainerWaitOKBody, <-chan error) - ContainerInspect(ctx context.Context, id string) (dockertypes.ContainerJSON, error) - ImageInspectWithRaw(ctx context.Context, image string) (dockertypes.ImageInspect, []byte, error) - ImageLoad(ctx context.Context, input io.Reader, quiet bool) (dockertypes.ImageLoadResponse, error) - ImageRemove(ctx context.Context, image string, options dockertypes.ImageRemoveOptions) ([]dockertypes.ImageDeleteResponseItem, error) -} - type PsProcess interface { CmdlineSlice() ([]string, error) } diff --git a/lib/crunchrun/docker.go b/lib/crunchrun/docker.go new file mode 100644 index 0000000000..a7e0c3468a --- /dev/null +++ b/lib/crunchrun/docker.go @@ -0,0 +1,28 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + +package crunchrun + +import ( + "io" + + dockertypes "github.com/docker/docker/api/types" + dockercontainer "github.com/docker/docker/api/types/container" + dockernetwork "github.com/docker/docker/api/types/network" + "golang.org/x/net/context" +) + +// ThinDockerClient is the minimal Docker client interface used by crunch-run. +type ThinDockerClient interface { + ContainerAttach(ctx context.Context, container string, options dockertypes.ContainerAttachOptions) (dockertypes.HijackedResponse, error) + ContainerCreate(ctx context.Context, config *dockercontainer.Config, hostConfig *dockercontainer.HostConfig, + networkingConfig *dockernetwork.NetworkingConfig, containerName string) (dockercontainer.ContainerCreateCreatedBody, error) + ContainerStart(ctx context.Context, container string, options dockertypes.ContainerStartOptions) error + ContainerRemove(ctx context.Context, container string, options dockertypes.ContainerRemoveOptions) error + ContainerWait(ctx context.Context, container string, condition dockercontainer.WaitCondition) (<-chan dockercontainer.ContainerWaitOKBody, <-chan error) + ContainerInspect(ctx context.Context, id string) (dockertypes.ContainerJSON, error) + ImageInspectWithRaw(ctx context.Context, image string) (dockertypes.ImageInspect, []byte, error) + ImageLoad(ctx context.Context, input io.Reader, quiet bool) (dockertypes.ImageLoadResponse, error) + ImageRemove(ctx context.Context, image string, options dockertypes.ImageRemoveOptions) ([]dockertypes.ImageDeleteResponseItem, error) +}