Change runtime options to *Any

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-06-29 15:32:24 -07:00
parent 72831b6985
commit 96dbb08ec4
10 changed files with 156 additions and 354 deletions

View File

@@ -45,6 +45,7 @@ import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
import google_protobuf1 "github.com/gogo/protobuf/types"
import strings "strings"
import reflect "reflect"
@@ -74,8 +75,8 @@ func (*ContainerCreate) ProtoMessage() {}
func (*ContainerCreate) Descriptor() ([]byte, []int) { return fileDescriptorContainer, []int{0} }
type ContainerCreate_Runtime struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Options map[string]string `protobuf:"bytes,2,rep,name=options" json:"options,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Options *google_protobuf1.Any `protobuf:"bytes,2,opt,name=options" json:"options,omitempty"`
}
func (m *ContainerCreate_Runtime) Reset() { *m = ContainerCreate_Runtime{} }
@@ -170,22 +171,15 @@ func (m *ContainerCreate_Runtime) MarshalTo(dAtA []byte) (int, error) {
i = encodeVarintContainer(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
}
if len(m.Options) > 0 {
for k, _ := range m.Options {
dAtA[i] = 0x12
i++
v := m.Options[k]
mapSize := 1 + len(k) + sovContainer(uint64(len(k))) + 1 + len(v) + sovContainer(uint64(len(v)))
i = encodeVarintContainer(dAtA, i, uint64(mapSize))
dAtA[i] = 0xa
i++
i = encodeVarintContainer(dAtA, i, uint64(len(k)))
i += copy(dAtA[i:], k)
dAtA[i] = 0x12
i++
i = encodeVarintContainer(dAtA, i, uint64(len(v)))
i += copy(dAtA[i:], v)
if m.Options != nil {
dAtA[i] = 0x12
i++
i = encodeVarintContainer(dAtA, i, uint64(m.Options.Size()))
n2, err := m.Options.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n2
}
return i, nil
}
@@ -319,13 +313,9 @@ func (m *ContainerCreate_Runtime) Size() (n int) {
if l > 0 {
n += 1 + l + sovContainer(uint64(l))
}
if len(m.Options) > 0 {
for k, v := range m.Options {
_ = k
_ = v
mapEntrySize := 1 + len(k) + sovContainer(uint64(len(k))) + 1 + len(v) + sovContainer(uint64(len(v)))
n += mapEntrySize + 1 + sovContainer(uint64(mapEntrySize))
}
if m.Options != nil {
l = m.Options.Size()
n += 1 + l + sovContainer(uint64(l))
}
return n
}
@@ -395,19 +385,9 @@ func (this *ContainerCreate_Runtime) String() string {
if this == nil {
return "nil"
}
keysForOptions := make([]string, 0, len(this.Options))
for k, _ := range this.Options {
keysForOptions = append(keysForOptions, k)
}
github_com_gogo_protobuf_sortkeys.Strings(keysForOptions)
mapStringForOptions := "map[string]string{"
for _, k := range keysForOptions {
mapStringForOptions += fmt.Sprintf("%v: %v,", k, this.Options[k])
}
mapStringForOptions += "}"
s := strings.Join([]string{`&ContainerCreate_Runtime{`,
`Name:` + fmt.Sprintf("%v", this.Name) + `,`,
`Options:` + mapStringForOptions + `,`,
`Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Any", "google_protobuf1.Any", 1) + `,`,
`}`,
}, "")
return s
@@ -678,94 +658,11 @@ func (m *ContainerCreate_Runtime) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
var keykey uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowContainer
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
keykey |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
var stringLenmapkey uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowContainer
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLenmapkey |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLenmapkey := int(stringLenmapkey)
if intStringLenmapkey < 0 {
return ErrInvalidLengthContainer
}
postStringIndexmapkey := iNdEx + intStringLenmapkey
if postStringIndexmapkey > l {
return io.ErrUnexpectedEOF
}
mapkey := string(dAtA[iNdEx:postStringIndexmapkey])
iNdEx = postStringIndexmapkey
if m.Options == nil {
m.Options = make(map[string]string)
m.Options = &google_protobuf1.Any{}
}
if iNdEx < postIndex {
var valuekey uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowContainer
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
valuekey |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
var stringLenmapvalue uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowContainer
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLenmapvalue |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLenmapvalue := int(stringLenmapvalue)
if intStringLenmapvalue < 0 {
return ErrInvalidLengthContainer
}
postStringIndexmapvalue := iNdEx + intStringLenmapvalue
if postStringIndexmapvalue > l {
return io.ErrUnexpectedEOF
}
mapvalue := string(dAtA[iNdEx:postStringIndexmapvalue])
iNdEx = postStringIndexmapvalue
m.Options[mapkey] = mapvalue
} else {
var mapvalue string
m.Options[mapkey] = mapvalue
if err := m.Options.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
@@ -1231,31 +1128,31 @@ func init() {
}
var fileDescriptorContainer = []byte{
// 406 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0xcd, 0xaa, 0xd3, 0x40,
0x18, 0xed, 0x24, 0x35, 0xc5, 0x49, 0xa1, 0x32, 0x74, 0x11, 0x02, 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0x66, 0x84,
0x14, 0x0e, 0xa3, 0x03, 0x00, 0x00,
// 413 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0x4d, 0x8b, 0xd5, 0x30,
0x14, 0x9d, 0xbc, 0x8e, 0x7d, 0x98, 0x0a, 0x23, 0xe1, 0x2d, 0x6a, 0xc1, 0xce, 0xa3, 0xab, 0xb7,
0x4a, 0x99, 0x0a, 0xa2, 0x23, 0x08, 0xce, 0x87, 0x32, 0xa0, 0x20, 0x11, 0x41, 0xdc, 0x48, 0xfa,
0x9a, 0xa9, 0xc1, 0x36, 0x29, 0x6d, 0x5a, 0xe8, 0xce, 0x5f, 0xe0, 0xef, 0x9a, 0xa5, 0x4b, 0x57,
0x83, 0xd3, 0xdf, 0xe1, 0x42, 0x9a, 0xb4, 0x9d, 0xe2, 0x42, 0xe4, 0xe1, 0xee, 0xdc, 0xdc, 0x73,
0x6e, 0xce, 0xb9, 0x21, 0xf0, 0x55, 0xca, 0xd5, 0xe7, 0x3a, 0xc6, 0x5b, 0x99, 0x87, 0x5b, 0x29,
0x14, 0xe5, 0x82, 0x95, 0xc9, 0x1c, 0xd2, 0x82, 0x87, 0x15, 0x2b, 0x1b, 0xbe, 0x65, 0x55, 0xc8,
0x1a, 0x26, 0x54, 0x15, 0x36, 0x47, 0xb7, 0x0c, 0x5c, 0x94, 0x52, 0x49, 0xf4, 0xf0, 0x56, 0x82,
0x47, 0x3a, 0x36, 0x74, 0xdc, 0x1c, 0x79, 0xab, 0x54, 0xa6, 0x52, 0x33, 0xc3, 0x1e, 0x19, 0x91,
0xf7, 0x20, 0x95, 0x32, 0xcd, 0x58, 0xa8, 0xab, 0xb8, 0xbe, 0x0c, 0xa9, 0x68, 0x4d, 0x2b, 0xf8,
0x05, 0xe0, 0xc1, 0xe9, 0x38, 0xf2, 0xb4, 0x64, 0x54, 0x31, 0x14, 0xc1, 0x7b, 0xd3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, 0xb3, 0x7d, 0x9c, 0xb1, 0x8c, 0xed, 0xb6, 0x8f, 0x93, 0x0f, 0x57, 0x37,
0xfe, 0xde, 0x8f, 0x1b, 0x7f, 0xef, 0x6b, 0xe7, 0x83, 0xab, 0xce, 0x07, 0xdf, 0x3b, 0x1f, 0xfc,
0xec, 0x7c, 0xf0, 0xf1, 0xf9, 0x8e, 0x3f, 0xe1, 0x99, 0x41, 0xb1, 0xad, 0x1f, 0xf2, 0xd1, 0xef,
0x00, 0x00, 0x00, 0xff, 0xff, 0x1a, 0x0b, 0xcd, 0x09, 0x52, 0x03, 0x00, 0x00,
}

View File

@@ -3,6 +3,7 @@ syntax = "proto3";
package containerd.services.events.v1;
import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
option go_package = "github.com/containerd/containerd/api/services/events/v1;events";
@@ -11,7 +12,7 @@ message ContainerCreate {
string image = 2;
message Runtime {
string name = 1;
map<string, string> options = 2;
google.protobuf.Any options = 2;
}
Runtime runtime = 3;
}

View File

@@ -9,7 +9,7 @@ import fmt "fmt"
import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
import _ "github.com/gogo/protobuf/types"
import google_protobuf2 "github.com/gogo/protobuf/types"
import google_protobuf1 "github.com/gogo/protobuf/types"
import time "time"
@@ -41,7 +41,7 @@ func (*StreamEventsRequest) Descriptor() ([]byte, []int) { return fileDescriptor
type Envelope struct {
Timestamp time.Time `protobuf:"bytes,1,opt,name=timestamp,stdtime" json:"timestamp"`
Topic string `protobuf:"bytes,2,opt,name=topic,proto3" json:"topic,omitempty"`
Event *google_protobuf2.Any `protobuf:"bytes,3,opt,name=event" json:"event,omitempty"`
Event *google_protobuf1.Any `protobuf:"bytes,3,opt,name=event" json:"event,omitempty"`
}
func (m *Envelope) Reset() { *m = Envelope{} }
@@ -288,9 +288,9 @@ func (this *Envelope) String() string {
return "nil"
}
s := strings.Join([]string{`&Envelope{`,
`Timestamp:` + strings.Replace(strings.Replace(this.Timestamp.String(), "Timestamp", "google_protobuf1.Timestamp", 1), `&`, ``, 1) + `,`,
`Timestamp:` + strings.Replace(strings.Replace(this.Timestamp.String(), "Timestamp", "google_protobuf2.Timestamp", 1), `&`, ``, 1) + `,`,
`Topic:` + fmt.Sprintf("%v", this.Topic) + `,`,
`Event:` + strings.Replace(fmt.Sprintf("%v", this.Event), "Any", "google_protobuf2.Any", 1) + `,`,
`Event:` + strings.Replace(fmt.Sprintf("%v", this.Event), "Any", "google_protobuf1.Any", 1) + `,`,
`}`,
}, "")
return s
@@ -468,7 +468,7 @@ func (m *Envelope) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.Event == nil {
m.Event = &google_protobuf2.Any{}
m.Event = &google_protobuf1.Any{}
}
if err := m.Event.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err

View File

@@ -571,8 +571,8 @@ func (this *RuntimeEvent) String() string {
`Type:` + fmt.Sprintf("%v", this.Type) + `,`,
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
`ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`,
`ExitedAt:` + strings.Replace(strings.Replace(this.ExitedAt.String(), "Timestamp", "google_protobuf1.Timestamp", 1), `&`, ``, 1) + `,`,
`Timestamp:` + strings.Replace(strings.Replace(this.Timestamp.String(), "Timestamp", "google_protobuf1.Timestamp", 1), `&`, ``, 1) + `,`,
`ExitedAt:` + strings.Replace(strings.Replace(this.ExitedAt.String(), "Timestamp", "google_protobuf2.Timestamp", 1), `&`, ``, 1) + `,`,
`Timestamp:` + strings.Replace(strings.Replace(this.Timestamp.String(), "Timestamp", "google_protobuf2.Timestamp", 1), `&`, ``, 1) + `,`,
`}`,
}, "")
return s
@@ -585,7 +585,7 @@ func (this *RuntimeDelete) String() string {
`ID:` + fmt.Sprintf("%v", this.ID) + `,`,
`Runtime:` + fmt.Sprintf("%v", this.Runtime) + `,`,
`ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`,
`ExitedAt:` + strings.Replace(strings.Replace(this.ExitedAt.String(), "Timestamp", "google_protobuf1.Timestamp", 1), `&`, ``, 1) + `,`,
`ExitedAt:` + strings.Replace(strings.Replace(this.ExitedAt.String(), "Timestamp", "google_protobuf2.Timestamp", 1), `&`, ``, 1) + `,`,
`}`,
}, "")
return s