api: use weak imports for plugin protobufs

Because of a side-effect import, we have the possibility of pulling in
several unnecessary packages that are used by the plugin and not at
runtime to implement protobuf structures. Setting these imports to
`weak` prevents this from happening, reducing the total import set,
reducing memory usage and binary size.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day
2017-11-16 20:18:15 -08:00
parent 5c6e789dde
commit 50532f231a
54 changed files with 851 additions and 792 deletions

View File

@@ -43,9 +43,10 @@ package events
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 _ "github.com/containerd/containerd/protobuf/plugin"
import google_protobuf "github.com/gogo/protobuf/types"
// skipping weak import gogoproto "github.com/gogo/protobuf/gogoproto"
// skipping weak import containerd_plugin "github.com/containerd/containerd/protobuf/plugin"
import github_com_containerd_typeurl "github.com/containerd/typeurl"
@@ -77,8 +78,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 *google_protobuf1.Any `protobuf:"bytes,2,opt,name=options" json:"options,omitempty"`
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Options *google_protobuf.Any `protobuf:"bytes,2,opt,name=options" json:"options,omitempty"`
}
func (m *ContainerCreate_Runtime) Reset() { *m = ContainerCreate_Runtime{} }
@@ -466,7 +467,7 @@ func (this *ContainerCreate_Runtime) String() string {
}
s := strings.Join([]string{`&ContainerCreate_Runtime{`,
`Name:` + fmt.Sprintf("%v", this.Name) + `,`,
`Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Any", "google_protobuf1.Any", 1) + `,`,
`Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Any", "google_protobuf.Any", 1) + `,`,
`}`,
}, "")
return s
@@ -738,7 +739,7 @@ func (m *ContainerCreate_Runtime) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.Options == nil {
m.Options = &google_protobuf1.Any{}
m.Options = &google_protobuf.Any{}
}
if err := m.Options.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
@@ -1209,31 +1210,31 @@ func init() {
}
var fileDescriptorContainer = []byte{
// 411 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xcf, 0xaa, 0xd3, 0x40,
0x14, 0xc6, 0x3b, 0x49, 0x6d, 0x71, 0x22, 0xa8, 0x43, 0x91, 0x98, 0x45, 0xac, 0x5d, 0x55, 0x17,
0x13, 0x88, 0x1b, 0xb5, 0x1b, 0x6d, 0xab, 0x20, 0x2a, 0x48, 0xc0, 0x8d, 0x1b, 0x99, 0x34, 0xd3,
0x74, 0x30, 0x99, 0x09, 0xc9, 0xa4, 0x90, 0x9d, 0x8f, 0xe2, 0xe3, 0x74, 0xe9, 0xc2, 0x85, 0x2b,
0xb1, 0x01, 0xdf, 0xc0, 0x07, 0x90, 0xcc, 0x34, 0x6d, 0xf0, 0x72, 0xef, 0xa5, 0xab, 0x9c, 0x3f,
0xdf, 0x97, 0x73, 0x7e, 0x87, 0x81, 0xb3, 0x98, 0xc9, 0x4d, 0x19, 0xe2, 0x95, 0x48, 0xbd, 0x95,
0xe0, 0x92, 0x30, 0x4e, 0xf3, 0xa8, 0x1b, 0x92, 0x8c, 0x79, 0x74, 0x4b, 0xb9, 0x2c, 0x4e, 0x55,
0x9c, 0xe5, 0x42, 0x0a, 0x74, 0xf7, 0x24, 0xc3, 0x5a, 0xe2, 0x8c, 0x62, 0x11, 0x0b, 0xd5, 0xf5,
0x9a, 0x48, 0x0b, 0x9d, 0xfb, 0xb1, 0x10, 0x71, 0x42, 0x3d, 0x95, 0x85, 0xe5, 0xda, 0x23, 0xbc,
0x3a, 0xb4, 0x5e, 0x5c, 0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d, 0x46, 0xa8,
0xf1, 0x9b, 0xb0, 0xd9, 0x70, 0x4b, 0x92, 0xf2, 0xb8, 0xa1, 0x4a, 0x9e, 0x1b, 0x4f, 0xc1, 0xe4,
0x51, 0x07, 0x73, 0x49, 0x13, 0x7a, 0x39, 0xe6, 0xfc, 0xc3, 0x6e, 0xef, 0xf6, 0x7e, 0xee, 0xdd,
0xde, 0xd7, 0xda, 0x05, 0xbb, 0xda, 0x05, 0xdf, 0x6b, 0x17, 0xfc, 0xae, 0x5d, 0xf0, 0xed, 0xaf,
0x0b, 0x3e, 0xf9, 0x67, 0x3c, 0xe5, 0x99, 0xfe, 0x84, 0x03, 0x75, 0xfb, 0x27, 0xff, 0x02, 0x00,
0x00, 0xff, 0xff, 0xc4, 0x03, 0x7d, 0xc8, 0x07, 0x03, 0x00, 0x00,
// 413 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xc1, 0x0a, 0xd3, 0x30,
0x18, 0xc7, 0x97, 0x76, 0x6e, 0x98, 0x0a, 0x6a, 0x18, 0x52, 0x7b, 0xa8, 0x73, 0xa7, 0xe9, 0x21,
0x85, 0x7a, 0x51, 0x77, 0xd1, 0x6d, 0x0a, 0xa2, 0x82, 0x14, 0x84, 0xe1, 0x45, 0xd2, 0x35, 0xeb,
0x82, 0x6d, 0x52, 0xda, 0x74, 0xd0, 0x9b, 0x8f, 0xe2, 0xe3, 0xec, 0xe8, 0xc1, 0x83, 0x27, 0x71,
0x05, 0xdf, 0xc0, 0x07, 0x90, 0x26, 0xeb, 0x56, 0x14, 0x95, 0x9d, 0xfa, 0xcf, 0xd7, 0xff, 0x3f,
0xdf, 0xf7, 0xfb, 0x08, 0x9c, 0xc5, 0x4c, 0x6e, 0xcb, 0x10, 0xaf, 0x45, 0xea, 0xad, 0x05, 0x97,
0x84, 0x71, 0x9a, 0x47, 0x5d, 0x49, 0x32, 0xe6, 0xd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