RFC: Remove unused transport name constants from libpod
They are not used anywhere in the packagee. Two of the values still have users in the CLI, but used only once. So, use the .Transport.Name() calls in there directly, that is likely to be cheaper (and makes the files depend directly on the transports instead of referring to them indirectly through libpod). RFC: Should not change behavior in _this_ repo, but it is an externally-observable API change. Is there any user that could notice? Signed-off-by: Miloslav Trmač <mitr@redhat.com> Closes: #1176 Approved by: rhatdan
This commit is contained in:
parent
5507f15ba5
commit
0d4a5549d6
|
@ -6,11 +6,11 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
dockerarchive "github.com/containers/image/docker/archive"
|
||||||
"github.com/containers/image/transports/alltransports"
|
"github.com/containers/image/transports/alltransports"
|
||||||
"github.com/containers/image/types"
|
"github.com/containers/image/types"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/projectatomic/libpod/cmd/podman/libpodruntime"
|
"github.com/projectatomic/libpod/cmd/podman/libpodruntime"
|
||||||
"github.com/projectatomic/libpod/libpod"
|
|
||||||
image2 "github.com/projectatomic/libpod/libpod/image"
|
image2 "github.com/projectatomic/libpod/libpod/image"
|
||||||
"github.com/projectatomic/libpod/pkg/util"
|
"github.com/projectatomic/libpod/pkg/util"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
@ -112,7 +112,7 @@ func pullCmd(c *cli.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Possible for docker-archive to have multiple tags, so use LoadFromArchiveReference instead
|
// Possible for docker-archive to have multiple tags, so use LoadFromArchiveReference instead
|
||||||
if strings.HasPrefix(image, libpod.DockerArchive+":") {
|
if strings.HasPrefix(image, dockerarchive.Transport.Name()+":") {
|
||||||
srcRef, err := alltransports.ParseImageName(image)
|
srcRef, err := alltransports.ParseImageName(image)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error parsing %q", image)
|
return errors.Wrapf(err, "error parsing %q", image)
|
||||||
|
|
|
@ -6,12 +6,12 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/containers/image/directory"
|
||||||
"github.com/containers/image/manifest"
|
"github.com/containers/image/manifest"
|
||||||
"github.com/containers/image/types"
|
"github.com/containers/image/types"
|
||||||
imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1"
|
imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/projectatomic/libpod/cmd/podman/libpodruntime"
|
"github.com/projectatomic/libpod/cmd/podman/libpodruntime"
|
||||||
"github.com/projectatomic/libpod/libpod"
|
|
||||||
"github.com/projectatomic/libpod/libpod/image"
|
"github.com/projectatomic/libpod/libpod/image"
|
||||||
"github.com/projectatomic/libpod/pkg/util"
|
"github.com/projectatomic/libpod/pkg/util"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
@ -101,7 +101,7 @@ func pushCmd(c *cli.Context) error {
|
||||||
// --compress and --format can only be used for the "dir" transport
|
// --compress and --format can only be used for the "dir" transport
|
||||||
splitArg := strings.SplitN(destName, ":", 2)
|
splitArg := strings.SplitN(destName, ":", 2)
|
||||||
if c.IsSet("compress") || c.IsSet("format") {
|
if c.IsSet("compress") || c.IsSet("format") {
|
||||||
if splitArg[0] != libpod.DirTransport {
|
if splitArg[0] != directory.Transport.Name() {
|
||||||
return errors.Errorf("--compress and --format can be set only when pushing to a directory using the 'dir' transport")
|
return errors.Errorf("--compress and --format can be set only when pushing to a directory using the 'dir' transport")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/containers/image/directory"
|
|
||||||
"github.com/containers/image/docker"
|
|
||||||
dockerarchive "github.com/containers/image/docker/archive"
|
|
||||||
ociarchive "github.com/containers/image/oci/archive"
|
|
||||||
"github.com/containers/image/tarball"
|
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
"github.com/containers/storage/pkg/archive"
|
"github.com/containers/storage/pkg/archive"
|
||||||
ociv1 "github.com/opencontainers/image-spec/specs-go/v1"
|
ociv1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
|
@ -21,25 +16,6 @@ import (
|
||||||
|
|
||||||
// Runtime API
|
// Runtime API
|
||||||
|
|
||||||
var (
|
|
||||||
// DockerArchive is the transport we prepend to an image name
|
|
||||||
// when saving to docker-archive
|
|
||||||
DockerArchive = dockerarchive.Transport.Name()
|
|
||||||
// OCIArchive is the transport we prepend to an image name
|
|
||||||
// when saving to oci-archive
|
|
||||||
OCIArchive = ociarchive.Transport.Name()
|
|
||||||
// DirTransport is the transport for pushing and pulling
|
|
||||||
// images to and from a directory
|
|
||||||
DirTransport = directory.Transport.Name()
|
|
||||||
// TarballTransport is the transport for importing a tar archive
|
|
||||||
// and creating a filesystem image
|
|
||||||
TarballTransport = tarball.Transport.Name()
|
|
||||||
// Docker is the transport for docker registries
|
|
||||||
Docker = docker.Transport.Name()
|
|
||||||
// Atomic is the transport for atomic registries
|
|
||||||
Atomic = "atomic"
|
|
||||||
)
|
|
||||||
|
|
||||||
// CopyOptions contains the options given when pushing or pulling images
|
// CopyOptions contains the options given when pushing or pulling images
|
||||||
type CopyOptions struct {
|
type CopyOptions struct {
|
||||||
// Compression specifies the type of compression which is applied to
|
// Compression specifies the type of compression which is applied to
|
||||||
|
|
Loading…
Reference in New Issue