Rename types.Image.Layers to LayersCommand

The .Layers() method name is too nice to contain this layering
violation; make it more explicit in the naming.
This commit is contained in:
Miloslav Trmač 2016-06-11 09:08:29 +02:00
parent 206a8e3eed
commit c81541de0a
4 changed files with 8 additions and 5 deletions

View File

@ -13,7 +13,7 @@ var layersCmd = cli.Command{
if err != nil {
return err
}
if err := img.Layers(c.Args().Tail()...); err != nil {
if err := img.LayersCommand(c.Args().Tail()...); err != nil {
return err
}
return nil

View File

@ -172,7 +172,7 @@ func (i *genericImage) getSchema1Manifest() (genericManifest, error) {
return mschema1, nil
}
func (i *genericImage) Layers(layers ...string) error {
func (i *genericImage) LayersCommand(layers ...string) error {
m, err := i.getSchema1Manifest()
if err != nil {
return err

View File

@ -55,7 +55,7 @@ func (ref refImageMock) ManifestMatchesDigest(expectedDigest string) (bool, erro
func (ref refImageMock) Signatures() ([][]byte, error) {
panic("unexpected call to a mock function")
}
func (ref refImageMock) Layers(layers ...string) error {
func (ref refImageMock) LayersCommand(layers ...string) error {
panic("unexpected call to a mock function")
}
func (ref refImageMock) Inspect() (*types.ImageInspectInfo, error) {
@ -168,7 +168,7 @@ func (ref forbiddenImageMock) ManifestMatchesDigest(expectedDigest string) (bool
func (ref forbiddenImageMock) Signatures() ([][]byte, error) {
panic("unexpected call to a mock function")
}
func (ref forbiddenImageMock) Layers(layers ...string) error {
func (ref forbiddenImageMock) LayersCommand(layers ...string) error {
panic("unexpected call to a mock function")
}
func (ref forbiddenImageMock) Inspect() (*types.ImageInspectInfo, error) {

View File

@ -60,7 +60,10 @@ type Image interface {
Manifest() ([]byte, error)
// Signatures is like ImageSource.GetSignatures, but the result is cached; it is OK to call this however often you need.
Signatures() ([][]byte, error)
Layers(layers ...string) error // configure download directory? Call it DownloadLayers?
// LayersCommand implements (skopeo layers). Do not use for any other purpose.
// Longer-term we would like to move the command-specific code up to the command handler,
// but the command has functionality specific to util.DockerV2Schema1MIMEType manifests.
LayersCommand(layers ...string) error // configure download directory?
// Inspect returns various information for (skopeo inspect) parsed from the manifest and configuration.
Inspect() (*ImageInspectInfo, error)
DockerTar() ([]byte, error) // ??? also, configure output directory