Move manifest package to schema1

As we begin our march towards multi-arch, we must prepare for the reality of
multiple manifest schemas. This is the beginning of a set of changes to
facilitate this. We are both moving this package into its target position where
it may live peacefully next to other manfiest versions.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day 2015-08-20 21:24:30 -07:00
parent 8c3fc2619c
commit 6712e602b0
22 changed files with 120 additions and 106 deletions

1
manifest/doc.go Normal file
View file

@ -0,0 +1 @@
package manifest

View file

@ -1,9 +1,10 @@
package manifest
package schema1
import (
"encoding/json"
"github.com/docker/distribution/digest"
"github.com/docker/distribution/manifest"
"github.com/docker/libtrust"
)
@ -17,18 +18,18 @@ const (
ManifestMediaType = "application/vnd.docker.distribution.manifest.v1+json"
)
// Versioned provides a struct with just the manifest schemaVersion. Incoming
// content with unknown schema version can be decoded against this struct to
// check the version.
type Versioned struct {
// SchemaVersion is the image manifest schema that this image follows
SchemaVersion int `json:"schemaVersion"`
}
var (
// SchemaVersion provides a pre-initialized version structure for this
// packages version of the manifest.
SchemaVersion = manifest.Versioned{
SchemaVersion: 1,
}
)
// Manifest provides the base accessible fields for working with V2 image
// format in the registry.
type Manifest struct {
Versioned
manifest.Versioned
// Name is the name of the image's repository
Name string `json:"name"`

View file

@ -1,4 +1,4 @@
package manifest
package schema1
import (
"bytes"
@ -80,11 +80,9 @@ func genEnv(t *testing.T) *testEnv {
name, tag := "foo/bar", "test"
m := Manifest{
Versioned: Versioned{
SchemaVersion: 1,
},
Name: name,
Tag: tag,
Versioned: SchemaVersion,
Name: name,
Tag: tag,
FSLayers: []FSLayer{
{
BlobSum: "asdf",

View file

@ -1,4 +1,4 @@
package manifest
package schema1
import (
"crypto/x509"

View file

@ -1,4 +1,4 @@
package manifest
package schema1
import (
"crypto/x509"

9
manifest/versioned.go Normal file
View file

@ -0,0 +1,9 @@
package manifest
// Versioned provides a struct with just the manifest schemaVersion. Incoming
// content with unknown schema version can be decoded against this struct to
// check the version.
type Versioned struct {
// SchemaVersion is the image manifest schema that this image follows
SchemaVersion int `json:"schemaVersion"`
}