api/types: consolidate types package

To simplify use of types, we have consolidate the packages for the mount
and descriptor protobuf types into a single Go package. We also drop the
versioning from the type packages, as these types will remain the same
between versions.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day
2017-06-22 19:51:26 -07:00
parent 40f2627ce1
commit 12c0daa9c9
26 changed files with 496 additions and 507 deletions

View File

@@ -22,8 +22,8 @@ import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
import _ "github.com/golang/protobuf/ptypes/empty"
import _ "github.com/gogo/protobuf/types"
import containerd_v1_types "github.com/containerd/containerd/api/types/mount"
import containerd_v1_types1 "github.com/containerd/containerd/api/types/descriptor"
import containerd_types "github.com/containerd/containerd/api/types"
import containerd_types1 "github.com/containerd/containerd/api/types"
import (
context "golang.org/x/net/context"
@@ -48,8 +48,8 @@ const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
type ApplyRequest struct {
// Diff is the descriptor of the diff to be extracted
Diff *containerd_v1_types1.Descriptor `protobuf:"bytes,1,opt,name=diff" json:"diff,omitempty"`
Mounts []*containerd_v1_types.Mount `protobuf:"bytes,2,rep,name=mounts" json:"mounts,omitempty"`
Diff *containerd_types1.Descriptor `protobuf:"bytes,1,opt,name=diff" json:"diff,omitempty"`
Mounts []*containerd_types.Mount `protobuf:"bytes,2,rep,name=mounts" json:"mounts,omitempty"`
}
func (m *ApplyRequest) Reset() { *m = ApplyRequest{} }
@@ -60,7 +60,7 @@ type ApplyResponse struct {
// Applied is the descriptor for the object which was applied.
// If the input was a compressed blob then the result will be
// the descriptor for the uncompressed blob.
Applied *containerd_v1_types1.Descriptor `protobuf:"bytes,1,opt,name=applied" json:"applied,omitempty"`
Applied *containerd_types1.Descriptor `protobuf:"bytes,1,opt,name=applied" json:"applied,omitempty"`
}
func (m *ApplyResponse) Reset() { *m = ApplyResponse{} }
@@ -70,10 +70,10 @@ func (*ApplyResponse) Descriptor() ([]byte, []int) { return fileDescriptorDiff,
type DiffRequest struct {
// Left are the mounts which represent the older copy
// in which is the base of the computed changes.
Left []*containerd_v1_types.Mount `protobuf:"bytes,1,rep,name=left" json:"left,omitempty"`
Left []*containerd_types.Mount `protobuf:"bytes,1,rep,name=left" json:"left,omitempty"`
// Right are the mounts which represents the newer copy
// in which changes from the left were made into.
Right []*containerd_v1_types.Mount `protobuf:"bytes,2,rep,name=right" json:"right,omitempty"`
Right []*containerd_types.Mount `protobuf:"bytes,2,rep,name=right" json:"right,omitempty"`
// MediaType is the media type descriptor for the created diff
// object
MediaType string `protobuf:"bytes,3,opt,name=media_type,json=mediaType,proto3" json:"media_type,omitempty"`
@@ -88,7 +88,7 @@ func (*DiffRequest) Descriptor() ([]byte, []int) { return fileDescriptorDiff, []
type DiffResponse struct {
// Diff is the descriptor of the diff which can be applied
Diff *containerd_v1_types1.Descriptor `protobuf:"bytes,3,opt,name=diff" json:"diff,omitempty"`
Diff *containerd_types1.Descriptor `protobuf:"bytes,3,opt,name=diff" json:"diff,omitempty"`
}
func (m *DiffResponse) Reset() { *m = DiffResponse{} }
@@ -474,8 +474,8 @@ func (this *ApplyRequest) String() string {
return "nil"
}
s := strings.Join([]string{`&ApplyRequest{`,
`Diff:` + strings.Replace(fmt.Sprintf("%v", this.Diff), "Descriptor", "containerd_v1_types1.Descriptor", 1) + `,`,
`Mounts:` + strings.Replace(fmt.Sprintf("%v", this.Mounts), "Mount", "containerd_v1_types.Mount", 1) + `,`,
`Diff:` + strings.Replace(fmt.Sprintf("%v", this.Diff), "Descriptor", "containerd_types1.Descriptor", 1) + `,`,
`Mounts:` + strings.Replace(fmt.Sprintf("%v", this.Mounts), "Mount", "containerd_types.Mount", 1) + `,`,
`}`,
}, "")
return s
@@ -485,7 +485,7 @@ func (this *ApplyResponse) String() string {
return "nil"
}
s := strings.Join([]string{`&ApplyResponse{`,
`Applied:` + strings.Replace(fmt.Sprintf("%v", this.Applied), "Descriptor", "containerd_v1_types1.Descriptor", 1) + `,`,
`Applied:` + strings.Replace(fmt.Sprintf("%v", this.Applied), "Descriptor", "containerd_types1.Descriptor", 1) + `,`,
`}`,
}, "")
return s
@@ -495,8 +495,8 @@ func (this *DiffRequest) String() string {
return "nil"
}
s := strings.Join([]string{`&DiffRequest{`,
`Left:` + strings.Replace(fmt.Sprintf("%v", this.Left), "Mount", "containerd_v1_types.Mount", 1) + `,`,
`Right:` + strings.Replace(fmt.Sprintf("%v", this.Right), "Mount", "containerd_v1_types.Mount", 1) + `,`,
`Left:` + strings.Replace(fmt.Sprintf("%v", this.Left), "Mount", "containerd_types.Mount", 1) + `,`,
`Right:` + strings.Replace(fmt.Sprintf("%v", this.Right), "Mount", "containerd_types.Mount", 1) + `,`,
`MediaType:` + fmt.Sprintf("%v", this.MediaType) + `,`,
`Ref:` + fmt.Sprintf("%v", this.Ref) + `,`,
`}`,
@@ -508,7 +508,7 @@ func (this *DiffResponse) String() string {
return "nil"
}
s := strings.Join([]string{`&DiffResponse{`,
`Diff:` + strings.Replace(fmt.Sprintf("%v", this.Diff), "Descriptor", "containerd_v1_types1.Descriptor", 1) + `,`,
`Diff:` + strings.Replace(fmt.Sprintf("%v", this.Diff), "Descriptor", "containerd_types1.Descriptor", 1) + `,`,
`}`,
}, "")
return s
@@ -577,7 +577,7 @@ func (m *ApplyRequest) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.Diff == nil {
m.Diff = &containerd_v1_types1.Descriptor{}
m.Diff = &containerd_types1.Descriptor{}
}
if err := m.Diff.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
@@ -609,7 +609,7 @@ func (m *ApplyRequest) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Mounts = append(m.Mounts, &containerd_v1_types.Mount{})
m.Mounts = append(m.Mounts, &containerd_types.Mount{})
if err := m.Mounts[len(m.Mounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
@@ -691,7 +691,7 @@ func (m *ApplyResponse) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.Applied == nil {
m.Applied = &containerd_v1_types1.Descriptor{}
m.Applied = &containerd_types1.Descriptor{}
}
if err := m.Applied.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
@@ -773,7 +773,7 @@ func (m *DiffRequest) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Left = append(m.Left, &containerd_v1_types.Mount{})
m.Left = append(m.Left, &containerd_types.Mount{})
if err := m.Left[len(m.Left)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
@@ -804,7 +804,7 @@ func (m *DiffRequest) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Right = append(m.Right, &containerd_v1_types.Mount{})
m.Right = append(m.Right, &containerd_types.Mount{})
if err := m.Right[len(m.Right)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
@@ -944,7 +944,7 @@ func (m *DiffResponse) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.Diff == nil {
m.Diff = &containerd_v1_types1.Descriptor{}
m.Diff = &containerd_types1.Descriptor{}
}
if err := m.Diff.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
@@ -1081,33 +1081,32 @@ func init() {
}
var fileDescriptorDiff = []byte{
// 434 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xbf, 0x6f, 0xd4, 0x30,
0x14, 0xc7, 0x6b, 0xee, 0xae, 0xa8, 0xbe, 0x22, 0x21, 0x8b, 0x21, 0x4a, 0x45, 0x7a, 0xba, 0xe9,
0xca, 0x60, 0x73, 0xe9, 0xc4, 0x8f, 0x81, 0x1f, 0x15, 0x03, 0x12, 0x4b, 0xd4, 0x09, 0x24, 0x50,
0x2e, 0x79, 0x49, 0x2d, 0x25, 0xb1, 0x89, 0x9d, 0xa0, 0x6c, 0xfc, 0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f, 0x69, 0x0a, 0x04,
0x00, 0x00,
// 427 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0x31, 0x6f, 0xd4, 0x30,
0x14, 0xc7, 0x6b, 0xee, 0xae, 0xa8, 0xbe, 0x22, 0x21, 0x0b, 0x89, 0xe8, 0x0a, 0xe1, 0x94, 0x29,
0x05, 0x61, 0xd3, 0x43, 0xea, 0x40, 0x97, 0x82, 0x2a, 0x31, 0xb1, 0x44, 0x9d, 0x40, 0x02, 0xe5,
0x92, 0x97, 0xd4, 0x52, 0x12, 0xbb, 0xb1, 0x73, 0x52, 0x36, 0x3e, 0x07, 0x5f, 0x87, 0xa5, 0x23,
0x23, 0x23, 0x97, 0x4f, 0x82, 0xe2, 0x38, 0x10, 0x81, 0x74, 0x84, 0x4e, 0x7e, 0xf1, 0xfb, 0xfd,
0xdf, 0xfb, 0xfb, 0xc5, 0xc6, 0xe7, 0x29, 0xd7, 0x57, 0xd5, 0x9a, 0x46, 0x22, 0x67, 0x91, 0x28,
0x74, 0xc8, 0x0b, 0x28, 0xe3, 0x61, 0x18, 0x4a, 0xce, 0x14, 0x94, 0x1b, 0x1e, 0x81, 0x62, 0x31,
0x4f, 0x12, 0xb6, 0x39, 0x31, 0x2b, 0x95, 0xa5, 0xd0, 0x82, 0x1c, 0xfd, 0x66, 0x69, 0xcf, 0x51,
0x93, 0xdf, 0x9c, 0x2c, 0x1e, 0xa4, 0x22, 0x15, 0x86, 0x63, 0x6d, 0xd4, 0x49, 0x16, 0x47, 0xa9,
0x10, 0x69, 0x06, 0xcc, 0x7c, 0xad, 0xab, 0x84, 0x41, 0x2e, 0x75, 0x6d, 0x93, 0x4f, 0xfe, 0x4c,
0x6a, 0x9e, 0x83, 0xd2, 0x61, 0x2e, 0x2d, 0x70, 0x3a, 0xca, 0xb2, 0xae, 0x25, 0x28, 0x96, 0x8b,
0xaa, 0xd0, 0x56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 0x7d, 0xb0, 0x7d, 0xfc,
0x9d, 0x9a, 0xc1, 0xa4, 0x17, 0xc7, 0x23, 0xc8, 0xae, 0xf8, 0x9b, 0xcb, 0x9b, 0xad, 0xbb, 0xf7,
0x7d, 0xeb, 0xee, 0x7d, 0x6e, 0x5c, 0x74, 0xd3, 0xb8, 0xe8, 0x5b, 0xe3, 0xa2, 0x1f, 0x8d, 0x8b,
0xde, 0xbf, 0xba, 0xd5, 0x13, 0x3d, 0x6b, 0xd7, 0xf5, 0xbe, 0xb9, 0xbd, 0x2f, 0x7f, 0x06, 0x00,
0x00, 0xff, 0xff, 0x66, 0x5a, 0xdb, 0x23, 0xe7, 0x03, 0x00, 0x00,
}

View File

@@ -5,8 +5,8 @@ package containerd.services.diff.v1;
import "gogoproto/gogo.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "github.com/containerd/containerd/api/types/mount/mount.proto";
import "github.com/containerd/containerd/api/types/descriptor/descriptor.proto";
import "github.com/containerd/containerd/api/types/mount.proto";
import "github.com/containerd/containerd/api/types/descriptor.proto";
option go_package = "github.com/containerd/containerd/api/services/diff/v1;diff";
@@ -24,26 +24,26 @@ service Diff {
message ApplyRequest {
// Diff is the descriptor of the diff to be extracted
containerd.v1.types.Descriptor diff = 1;
containerd.types.Descriptor diff = 1;
repeated containerd.v1.types.Mount mounts = 2;
repeated containerd.types.Mount mounts = 2;
}
message ApplyResponse {
// Applied is the descriptor for the object which was applied.
// If the input was a compressed blob then the result will be
// the descriptor for the uncompressed blob.
containerd.v1.types.Descriptor applied = 1;
containerd.types.Descriptor applied = 1;
}
message DiffRequest {
// Left are the mounts which represent the older copy
// in which is the base of the computed changes.
repeated containerd.v1.types.Mount left = 1;
repeated containerd.types.Mount left = 1;
// Right are the mounts which represents the newer copy
// in which changes from the left were made into.
repeated containerd.v1.types.Mount right = 2;
repeated containerd.types.Mount right = 2;
// MediaType is the media type descriptor for the created diff
// object
@@ -56,5 +56,5 @@ message DiffRequest {
message DiffResponse {
// Diff is the descriptor of the diff which can be applied
containerd.v1.types.Descriptor diff = 3;
containerd.types.Descriptor diff = 3;
}