Skip to content

Commit 7e2dad4

Browse files
committed
image: Rename 'descriptor' -> 'Descriptor' to make public
I'll need access to this type from the coming refs sub-package. Pulling it out into its own subpackage avoids an: image -(need refs.Engine)-> refs -(need Descriptor)-> image import cycle. I've left the descriptor validation in the image package, because it's high-level stuff that will depend on refs. Signed-off-by: W. Trevor King <[email protected]>
1 parent 20e71cb commit 7e2dad4

File tree

3 files changed

+40
-5
lines changed

3 files changed

+40
-5
lines changed

image/descriptor.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,11 @@ import (
2323
"os"
2424
"path/filepath"
2525

26+
"github.com/opencontainers/image-spec/image/structure"
2627
"github.com/pkg/errors"
2728
)
2829

29-
type descriptor struct {
30-
MediaType string `json:"mediaType"`
31-
Digest string `json:"digest"`
32-
Size int64 `json:"size"`
33-
}
30+
type descriptor structure.Descriptor
3431

3532
func findDescriptor(w walker, name string) (*descriptor, error) {
3633
var d descriptor

image/structure/descriptor.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2016 The Linux Foundation
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package structure
16+
17+
// Descriptor represents application/vnd.oci.descriptor.v1.
18+
type Descriptor struct {
19+
MediaType string `json:"mediaType"`
20+
Digest string `json:"digest"`
21+
Size int64 `json:"size"`
22+
}

image/structure/doc.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2016 The Linux Foundation
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Package structure defines stucts for image-spec content.
16+
package structure

0 commit comments

Comments
 (0)