events: move types into service package

When using events, it was found to be fairly unwieldy with a number of
extra packages. For the most part, when interacting with the events
service, we want types of the same version of the service. This has been
accomplished by moving all events types into the events package.

In addition, several fixes to the way events are marshaled have been
included. Specifically, we defer to the protobuf type registration
system to assemble events and type urls, with a little bit sheen on top
of add a containerd.io oriented namespace.

This has resulted in much cleaner event consumption and has removed the
reliance on error prone type urls, in favor of concrete types.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day 2017-06-22 19:12:25 -07:00
parent c4da4ed393
commit c05be46348
No known key found for this signature in database
GPG Key ID: 67B3DED84EDC823F
32 changed files with 642 additions and 900 deletions

View File

@ -1,25 +1,26 @@
// Code generated by protoc-gen-gogo. // Code generated by protoc-gen-gogo.
// source: github.com/containerd/containerd/api/types/event/container.proto // source: github.com/containerd/containerd/api/services/events/v1/container.proto
// DO NOT EDIT! // DO NOT EDIT!
/* /*
Package event is a generated protocol buffer package. Package events is a generated protocol buffer package.
It is generated from these files: It is generated from these files:
github.com/containerd/containerd/api/types/event/container.proto github.com/containerd/containerd/api/services/events/v1/container.proto
github.com/containerd/containerd/api/types/event/content.proto github.com/containerd/containerd/api/services/events/v1/content.proto
github.com/containerd/containerd/api/types/event/event.proto github.com/containerd/containerd/api/services/events/v1/events.proto
github.com/containerd/containerd/api/types/event/image.proto github.com/containerd/containerd/api/services/events/v1/image.proto
github.com/containerd/containerd/api/types/event/namespace.proto github.com/containerd/containerd/api/services/events/v1/namespace.proto
github.com/containerd/containerd/api/types/event/runtime.proto github.com/containerd/containerd/api/services/events/v1/runtime.proto
github.com/containerd/containerd/api/types/event/snapshot.proto github.com/containerd/containerd/api/services/events/v1/snapshot.proto
github.com/containerd/containerd/api/types/event/task.proto github.com/containerd/containerd/api/services/events/v1/task.proto
It has these top-level messages: It has these top-level messages:
ContainerCreate ContainerCreate
ContainerUpdate ContainerUpdate
ContainerDelete ContainerDelete
ContentDelete ContentDelete
StreamEventsRequest
Envelope Envelope
ImageUpdate ImageUpdate
ImageDelete ImageDelete
@ -38,7 +39,7 @@
TaskStart TaskStart
TaskDelete TaskDelete
*/ */
package event package events
import proto "github.com/gogo/protobuf/proto" import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
@ -103,10 +104,10 @@ func (*ContainerDelete) ProtoMessage() {}
func (*ContainerDelete) Descriptor() ([]byte, []int) { return fileDescriptorContainer, []int{2} } func (*ContainerDelete) Descriptor() ([]byte, []int) { return fileDescriptorContainer, []int{2} }
func init() { func init() {
proto.RegisterType((*ContainerCreate)(nil), "containerd.v1.types.ContainerCreate") proto.RegisterType((*ContainerCreate)(nil), "containerd.services.events.v1.ContainerCreate")
proto.RegisterType((*ContainerCreate_Runtime)(nil), "containerd.v1.types.ContainerCreate.Runtime") proto.RegisterType((*ContainerCreate_Runtime)(nil), "containerd.services.events.v1.ContainerCreate.Runtime")
proto.RegisterType((*ContainerUpdate)(nil), "containerd.v1.types.ContainerUpdate") proto.RegisterType((*ContainerUpdate)(nil), "containerd.services.events.v1.ContainerUpdate")
proto.RegisterType((*ContainerDelete)(nil), "containerd.v1.types.ContainerDelete") proto.RegisterType((*ContainerDelete)(nil), "containerd.services.events.v1.ContainerDelete")
} }
func (m *ContainerCreate) Marshal() (dAtA []byte, err error) { func (m *ContainerCreate) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
@ -1226,34 +1227,35 @@ var (
) )
func init() { func init() {
proto.RegisterFile("github.com/containerd/containerd/api/types/event/container.proto", fileDescriptorContainer) proto.RegisterFile("github.com/containerd/containerd/api/services/events/v1/container.proto", fileDescriptorContainer)
} }
var fileDescriptorContainer = []byte{ var fileDescriptorContainer = []byte{
// 387 bytes of a gzipped FileDescriptorProto // 406 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0x4f, 0x6b, 0xe2, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00,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 0x66, 0x81, 0x2f, 0xaf, 0x2f, 0x3c,
0x03, 0x00, 0x00, 0xad, 0x57, 0x12, 0x6d, 0xb4, 0xe2, 0x46, 0x9e, 0x5d, 0x07, 0x00, 0x00, 0xff, 0xff, 0x66, 0x84,
0x14, 0x0e, 0xa3, 0x03, 0x00, 0x00,
} }

View File

@ -1,9 +1,11 @@
syntax = "proto3"; syntax = "proto3";
package containerd.v1.types; package containerd.services.events.v1;
import "gogoproto/gogo.proto"; import "gogoproto/gogo.proto";
option go_package = "github.com/containerd/containerd/api/services/events/v1;events";
message ContainerCreate { message ContainerCreate {
string container_id = 1; string container_id = 1;
string image = 2; string image = 2;

View File

@ -1,8 +1,8 @@
// Code generated by protoc-gen-gogo. // Code generated by protoc-gen-gogo.
// source: github.com/containerd/containerd/api/types/event/content.proto // source: github.com/containerd/containerd/api/services/events/v1/content.proto
// DO NOT EDIT! // DO NOT EDIT!
package event package events
import proto "github.com/gogo/protobuf/proto" import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
@ -30,7 +30,7 @@ func (*ContentDelete) ProtoMessage() {}
func (*ContentDelete) Descriptor() ([]byte, []int) { return fileDescriptorContent, []int{0} } func (*ContentDelete) Descriptor() ([]byte, []int) { return fileDescriptorContent, []int{0} }
func init() { func init() {
proto.RegisterType((*ContentDelete)(nil), "containerd.v1.types.ContentDelete") proto.RegisterType((*ContentDelete)(nil), "containerd.services.events.v1.ContentDelete")
} }
func (m *ContentDelete) Marshal() (dAtA []byte, err error) { func (m *ContentDelete) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
@ -309,21 +309,23 @@ var (
) )
func init() { func init() {
proto.RegisterFile("github.com/containerd/containerd/api/types/event/content.proto", fileDescriptorContent) proto.RegisterFile("github.com/containerd/containerd/api/services/events/v1/content.proto", fileDescriptorContent)
} }
var fileDescriptorContent = []byte{ var fileDescriptorContent = []byte{
// 192 bytes of a gzipped FileDescriptorProto // 210 bytes of a gzipped FileDescriptorProto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, 0x0f, 0x1e, 0xc9, 0x31, 0x46, 0xd9, 0x91, 0xe9, 0x65, 0x6b, 0x08, 0x2b, 0x89,
0x0d, 0xec, 0x7a, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6a, 0x41, 0x46, 0x06, 0x3b, 0x01,
0x00, 0x00,
} }

View File

@ -1,9 +1,11 @@
syntax = "proto3"; syntax = "proto3";
package containerd.v1.types; package containerd.services.events.v1;
import "gogoproto/gogo.proto"; import "gogoproto/gogo.proto";
option go_package = "github.com/containerd/containerd/api/services/events/v1;events";
message ContentDelete { message ContentDelete {
string digest = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false]; string digest = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
} }

View File

@ -2,27 +2,24 @@
// source: github.com/containerd/containerd/api/services/events/v1/events.proto // source: github.com/containerd/containerd/api/services/events/v1/events.proto
// DO NOT EDIT! // DO NOT EDIT!
/*
Package events is a generated protocol buffer package.
It is generated from these files:
github.com/containerd/containerd/api/services/events/v1/events.proto
It has these top-level messages:
StreamEventsRequest
*/
package events package events
import proto "github.com/gogo/protobuf/proto" import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
import math "math" import math "math"
import containerd_v1_types "github.com/containerd/containerd/api/types/event" import _ "github.com/gogo/protobuf/gogoproto"
import _ "github.com/gogo/protobuf/types"
import google_protobuf2 "github.com/gogo/protobuf/types"
import time "time"
import ( import (
context "golang.org/x/net/context" context "golang.org/x/net/context"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
) )
import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types"
import strings "strings" import strings "strings"
import reflect "reflect" import reflect "reflect"
@ -32,12 +29,7 @@ import io "io"
var _ = proto.Marshal var _ = proto.Marshal
var _ = fmt.Errorf var _ = fmt.Errorf
var _ = math.Inf var _ = math.Inf
var _ = time.Kitchen
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
type StreamEventsRequest struct { type StreamEventsRequest struct {
} }
@ -46,8 +38,19 @@ func (m *StreamEventsRequest) Reset() { *m = StreamEventsRequ
func (*StreamEventsRequest) ProtoMessage() {} func (*StreamEventsRequest) ProtoMessage() {}
func (*StreamEventsRequest) Descriptor() ([]byte, []int) { return fileDescriptorEvents, []int{0} } func (*StreamEventsRequest) Descriptor() ([]byte, []int) { return fileDescriptorEvents, []int{0} }
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"`
}
func (m *Envelope) Reset() { *m = Envelope{} }
func (*Envelope) ProtoMessage() {}
func (*Envelope) Descriptor() ([]byte, []int) { return fileDescriptorEvents, []int{1} }
func init() { func init() {
proto.RegisterType((*StreamEventsRequest)(nil), "containerd.services.events.v1.StreamEventsRequest") proto.RegisterType((*StreamEventsRequest)(nil), "containerd.services.events.v1.StreamEventsRequest")
proto.RegisterType((*Envelope)(nil), "containerd.services.events.v1.Envelope")
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -88,7 +91,7 @@ func (c *eventsClient) Stream(ctx context.Context, in *StreamEventsRequest, opts
} }
type Events_StreamClient interface { type Events_StreamClient interface {
Recv() (*containerd_v1_types.Envelope, error) Recv() (*Envelope, error)
grpc.ClientStream grpc.ClientStream
} }
@ -96,8 +99,8 @@ type eventsStreamClient struct {
grpc.ClientStream grpc.ClientStream
} }
func (x *eventsStreamClient) Recv() (*containerd_v1_types.Envelope, error) { func (x *eventsStreamClient) Recv() (*Envelope, error) {
m := new(containerd_v1_types.Envelope) m := new(Envelope)
if err := x.ClientStream.RecvMsg(m); err != nil { if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err return nil, err
} }
@ -123,7 +126,7 @@ func _Events_Stream_Handler(srv interface{}, stream grpc.ServerStream) error {
} }
type Events_StreamServer interface { type Events_StreamServer interface {
Send(*containerd_v1_types.Envelope) error Send(*Envelope) error
grpc.ServerStream grpc.ServerStream
} }
@ -131,7 +134,7 @@ type eventsStreamServer struct {
grpc.ServerStream grpc.ServerStream
} }
func (x *eventsStreamServer) Send(m *containerd_v1_types.Envelope) error { func (x *eventsStreamServer) Send(m *Envelope) error {
return x.ServerStream.SendMsg(m) return x.ServerStream.SendMsg(m)
} }
@ -167,6 +170,48 @@ func (m *StreamEventsRequest) MarshalTo(dAtA []byte) (int, error) {
return i, nil return i, nil
} }
func (m *Envelope) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Envelope) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
dAtA[i] = 0xa
i++
i = encodeVarintEvents(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp)))
n1, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i:])
if err != nil {
return 0, err
}
i += n1
if len(m.Topic) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintEvents(dAtA, i, uint64(len(m.Topic)))
i += copy(dAtA[i:], m.Topic)
}
if m.Event != nil {
dAtA[i] = 0x1a
i++
i = encodeVarintEvents(dAtA, i, uint64(m.Event.Size()))
n2, err := m.Event.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n2
}
return i, nil
}
func encodeFixed64Events(dAtA []byte, offset int, v uint64) int { func encodeFixed64Events(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8) dAtA[offset+1] = uint8(v >> 8)
@ -200,6 +245,22 @@ func (m *StreamEventsRequest) Size() (n int) {
return n return n
} }
func (m *Envelope) Size() (n int) {
var l int
_ = l
l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp)
n += 1 + l + sovEvents(uint64(l))
l = len(m.Topic)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
if m.Event != nil {
l = m.Event.Size()
n += 1 + l + sovEvents(uint64(l))
}
return n
}
func sovEvents(x uint64) (n int) { func sovEvents(x uint64) (n int) {
for { for {
n++ n++
@ -222,6 +283,18 @@ func (this *StreamEventsRequest) String() string {
}, "") }, "")
return s return s
} }
func (this *Envelope) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&Envelope{`,
`Timestamp:` + strings.Replace(strings.Replace(this.Timestamp.String(), "Timestamp", "google_protobuf1.Timestamp", 1), `&`, ``, 1) + `,`,
`Topic:` + fmt.Sprintf("%v", this.Topic) + `,`,
`Event:` + strings.Replace(fmt.Sprintf("%v", this.Event), "Any", "google_protobuf2.Any", 1) + `,`,
`}`,
}, "")
return s
}
func valueToStringEvents(v interface{}) string { func valueToStringEvents(v interface{}) string {
rv := reflect.ValueOf(v) rv := reflect.ValueOf(v)
if rv.IsNil() { if rv.IsNil() {
@ -280,6 +353,148 @@ func (m *StreamEventsRequest) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *Envelope) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Envelope: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Envelope: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Topic", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Topic = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Event", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvents
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthEvents
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Event == nil {
m.Event = &google_protobuf2.Any{}
}
if err := m.Event.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipEvents(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthEvents
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipEvents(dAtA []byte) (n int, err error) { func skipEvents(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
@ -390,18 +605,25 @@ func init() {
} }
var fileDescriptorEvents = []byte{ var fileDescriptorEvents = []byte{
// 205 bytes of a gzipped FileDescriptorProto // 313 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x72, 0x49, 0xcf, 0x2c, 0xc9, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x91, 0xc1, 0x4a, 0xc3, 0x30,
0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0x1c, 0xc6, 0x17, 0x65, 0x63, 0x8b, 0xb7, 0x38, 0x61, 0x16, 0xcc, 0xc6, 0x2e, 0x0e, 0x0f, 0x89,
0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x17, 0xa7, 0x16, 0x95, 0x65, 0x26, 0xa7, 0x16, 0xeb, 0x9b, 0x47, 0x41, 0x70, 0xb8, 0x17, 0xa8, 0x1e, 0xc4, 0x5b, 0x57, 0xff, 0xc6, 0xc0, 0x9a, 0x74,
0xa7, 0x96, 0xa5, 0xe6, 0x95, 0x14, 0xeb, 0x97, 0x19, 0x42, 0x59, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0x6d, 0x56, 0xd8, 0xcd, 0x47, 0xd8, 0x63, 0xf5, 0xe8, 0xd1, 0x93, 0xba, 0x3e, 0x89, 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0x7d, 0xea, 0xd4, 0xb4, 0x61, 0x1b, 0x9e, 0xbc, 0x05, 0x00, 0x00, 0xff,
0xff, 0xc3, 0x54, 0xa2, 0xf3, 0x36, 0x02, 0x00, 0x00,
} }

View File

@ -2,12 +2,20 @@ syntax = "proto3";
package containerd.services.events.v1; package containerd.services.events.v1;
import "github.com/containerd/containerd/api/types/event/event.proto"; import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/any.proto";
option go_package = "github.com/containerd/containerd/api/services/events/v1;events"; option go_package = "github.com/containerd/containerd/api/services/events/v1;events";
service Events { service Events {
rpc Stream(StreamEventsRequest) returns (stream containerd.v1.types.Envelope); rpc Stream(StreamEventsRequest) returns (stream Envelope);
} }
message StreamEventsRequest {} message StreamEventsRequest {}
message Envelope {
google.protobuf.Timestamp timestamp = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
string topic = 2;
google.protobuf.Any event = 3;
}

View File

@ -1,8 +1,8 @@
// Code generated by protoc-gen-gogo. // Code generated by protoc-gen-gogo.
// source: github.com/containerd/containerd/api/types/event/image.proto // source: github.com/containerd/containerd/api/services/events/v1/image.proto
// DO NOT EDIT! // DO NOT EDIT!
package event package events
import proto "github.com/gogo/protobuf/proto" import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
@ -37,8 +37,8 @@ func (*ImageDelete) ProtoMessage() {}
func (*ImageDelete) Descriptor() ([]byte, []int) { return fileDescriptorImage, []int{1} } func (*ImageDelete) Descriptor() ([]byte, []int) { return fileDescriptorImage, []int{1} }
func init() { func init() {
proto.RegisterType((*ImageUpdate)(nil), "containerd.v1.types.ImageUpdate") proto.RegisterType((*ImageUpdate)(nil), "containerd.services.images.v1.ImageUpdate")
proto.RegisterType((*ImageDelete)(nil), "containerd.v1.types.ImageDelete") proto.RegisterType((*ImageDelete)(nil), "containerd.services.images.v1.ImageDelete")
} }
func (m *ImageUpdate) Marshal() (dAtA []byte, err error) { func (m *ImageUpdate) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
@ -592,24 +592,25 @@ var (
) )
func init() { func init() {
proto.RegisterFile("github.com/containerd/containerd/api/types/event/image.proto", fileDescriptorImage) proto.RegisterFile("github.com/containerd/containerd/api/services/events/v1/image.proto", fileDescriptorImage)
} }
var fileDescriptorImage = []byte{ var fileDescriptorImage = []byte{
// 232 bytes of a gzipped FileDescriptorProto // 251 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x49, 0xcf, 0x2c, 0xc9, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x72, 0x4e, 0xcf, 0x2c, 0xc9,
0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d,
0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xa7, 0x96, 0xa5, 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x17, 0xa7, 0x16, 0x95, 0x65, 0x26, 0xa7, 0x16, 0xeb,
0xe6, 0x95, 0xe8, 0x67, 0xe6, 0x26, 0xa6, 0xa7, 0xea, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0x09, 0xa7, 0x96, 0xa5, 0xe6, 0x95, 0x14, 0xeb, 0x97, 0x19, 0xea, 0x67, 0xe6, 0x26, 0xa6, 0xa7, 0xea,
0x23, 0xd4, 0xe9, 0x95, 0x19, 0xea, 0x81, 0x95, 0x29, 0x2d, 0x62, 0xe4, 0xe2, 0xf6, 0x04, 0x29, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0xc9, 0x22, 0x94, 0xeb, 0xc1, 0x94, 0xea, 0x81, 0x15, 0x14,
0x0a, 0x2d, 0x48, 0x49, 0x2c, 0x49, 0x15, 0x12, 0xe2, 0x62, 0xc9, 0x4b, 0xcc, 0x4d, 0x95, 0x60, 0xeb, 0x95, 0x19, 0x2a, 0xad, 0x61, 0xe4, 0xe2, 0xf6, 0x04, 0xf1, 0x42, 0x0b, 0x52, 0x12, 0x4b,
0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x02, 0xb3, 0x85, 0x5c, 0xb8, 0xd8, 0x72, 0x12, 0x93, 0x52, 0x73, 0x52, 0x85, 0x84, 0xb8, 0x58, 0xf2, 0x12, 0x73, 0x53, 0x25, 0x18, 0x15, 0x18, 0x35, 0x38, 0x83,
0x8a, 0x25, 0x98, 0x14, 0x98, 0x35, 0xb8, 0x8d, 0x74, 0xf4, 0xb0, 0x98, 0xa4, 0x87, 0x64, 0x8a, 0xc0, 0x6c, 0x21, 0x3f, 0x2e, 0xb6, 0x9c, 0xc4, 0xa4, 0xd4, 0x9c, 0x62, 0x09, 0x26, 0x05, 0x66,
0x9e, 0x0f, 0x58, 0xb9, 0x6b, 0x5e, 0x49, 0x51, 0x65, 0x10, 0x54, 0xaf, 0x94, 0x25, 0x17, 0x37, 0x0d, 0x6e, 0x23, 0x33, 0x3d, 0xbc, 0x66, 0xea, 0x21, 0x99, 0xa7, 0xe7, 0x03, 0xd6, 0xe8, 0x9a,
0x92, 0xb0, 0x90, 0x00, 0x17, 0x73, 0x76, 0x6a, 0x25, 0xd4, 0x1e, 0x10, 0x53, 0x48, 0x84, 0x8b, 0x57, 0x52, 0x54, 0x19, 0x04, 0x35, 0x45, 0xca, 0x92, 0x8b, 0x1b, 0x49, 0x58, 0x48, 0x80, 0x8b,
0xb5, 0x2c, 0x31, 0xa7, 0x34, 0x55, 0x82, 0x09, 0x2c, 0x06, 0xe1, 0x58, 0x31, 0x59, 0x30, 0x2a, 0x39, 0x3b, 0xb5, 0x12, 0x6a, 0x23, 0x88, 0x29, 0x24, 0xc2, 0xc5, 0x5a, 0x96, 0x98, 0x53, 0x9a,
0x29, 0x42, 0xdd, 0xe8, 0x92, 0x9a, 0x93, 0x8a, 0xdd, 0x8d, 0x4e, 0x12, 0x27, 0x1e, 0xca, 0x31, 0x2a, 0xc1, 0x04, 0x16, 0x83, 0x70, 0xac, 0x98, 0x2c, 0x18, 0x95, 0x14, 0xa1, 0xae, 0x75, 0x49,
0xdc, 0x78, 0x28, 0xc7, 0xd0, 0xf0, 0x48, 0x8e, 0xf1, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0xcd, 0x49, 0xc5, 0xee, 0x5a, 0xa7, 0x88, 0x13, 0x0f, 0xe5, 0x18, 0x6e, 0x3c, 0x94, 0x63, 0x68,
0x18, 0x1f, 0x3c, 0x92, 0x63, 0x4c, 0x62, 0x03, 0xfb, 0xde, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x78, 0x24, 0xc7, 0x78, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31,
0xa7, 0x64, 0x49, 0x13, 0x3d, 0x01, 0x00, 0x00, 0x46, 0xd9, 0x91, 0x19, 0x9e, 0xd6, 0x10, 0x56, 0x12, 0x1b, 0x38, 0x44, 0x8d, 0x01, 0x01, 0x00,
0x00, 0xff, 0xff, 0x0c, 0x2f, 0x4e, 0xf3, 0x98, 0x01, 0x00, 0x00,
} }

View File

@ -1,6 +1,8 @@
syntax = "proto3"; syntax = "proto3";
package containerd.v1.types; package containerd.services.images.v1;
option go_package = "github.com/containerd/containerd/api/services/events/v1;events";
message ImageUpdate { message ImageUpdate {
string name = 1; string name = 1;

View File

@ -1,12 +1,15 @@
// Code generated by protoc-gen-gogo. // Code generated by protoc-gen-gogo.
// source: github.com/containerd/containerd/api/types/event/namespace.proto // source: github.com/containerd/containerd/api/services/events/v1/namespace.proto
// DO NOT EDIT! // DO NOT EDIT!
package event package events
import proto "github.com/gogo/protobuf/proto" import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
import math "math" import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
import _ "github.com/gogo/protobuf/types"
import _ "github.com/gogo/protobuf/types"
import strings "strings" import strings "strings"
import reflect "reflect" import reflect "reflect"
@ -46,9 +49,9 @@ func (*NamespaceDelete) ProtoMessage() {}
func (*NamespaceDelete) Descriptor() ([]byte, []int) { return fileDescriptorNamespace, []int{2} } func (*NamespaceDelete) Descriptor() ([]byte, []int) { return fileDescriptorNamespace, []int{2} }
func init() { func init() {
proto.RegisterType((*NamespaceCreate)(nil), "containerd.v1.types.NamespaceCreate") proto.RegisterType((*NamespaceCreate)(nil), "containerd.services.events.v1.NamespaceCreate")
proto.RegisterType((*NamespaceUpdate)(nil), "containerd.v1.types.NamespaceUpdate") proto.RegisterType((*NamespaceUpdate)(nil), "containerd.services.events.v1.NamespaceUpdate")
proto.RegisterType((*NamespaceDelete)(nil), "containerd.v1.types.NamespaceDelete") proto.RegisterType((*NamespaceDelete)(nil), "containerd.services.events.v1.NamespaceDelete")
} }
func (m *NamespaceCreate) Marshal() (dAtA []byte, err error) { func (m *NamespaceCreate) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
@ -877,25 +880,29 @@ var (
) )
func init() { func init() {
proto.RegisterFile("github.com/containerd/containerd/api/types/event/namespace.proto", fileDescriptorNamespace) proto.RegisterFile("github.com/containerd/containerd/api/services/events/v1/namespace.proto", fileDescriptorNamespace)
} }
var fileDescriptorNamespace = []byte{ var fileDescriptorNamespace = []byte{
// 247 bytes of a gzipped FileDescriptorProto // 311 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x72, 0x48, 0xcf, 0x2c, 0xc9, 0x1f, 0x8b, 0x08, 0x00, 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93, 0x58, 0x10, 0x4d, 0x52, 0xf2, 0xe9, 0xf9, 0xf9, 0xe9, 0x39, 0xa9, 0xfa, 0x60, 0x5e, 0x52, 0x69,
0x52, 0x73, 0x8a, 0x25, 0x98, 0x14, 0x98, 0x35, 0xb8, 0x8d, 0x0c, 0xf4, 0xb0, 0x98, 0xa6, 0x87, 0x9a, 0x7e, 0x49, 0x66, 0x6e, 0x6a, 0x71, 0x49, 0x62, 0x6e, 0x01, 0x54, 0x81, 0x24, 0xba, 0x82,
0x66, 0x92, 0x9e, 0x0f, 0x58, 0x8b, 0x6b, 0x5e, 0x49, 0x51, 0x65, 0x10, 0x54, 0xbf, 0x94, 0x25, 0xc4, 0xbc, 0x4a, 0x88, 0x94, 0xd2, 0x16, 0x46, 0x2e, 0x7e, 0x3f, 0x98, 0x23, 0x9c, 0x8b, 0x52,
0x17, 0x37, 0x92, 0xb0, 0x90, 0x00, 0x17, 0x73, 0x76, 0x6a, 0x25, 0xd4, 0x2e, 0x10, 0x53, 0x48, 0x13, 0x4b, 0x52, 0x85, 0x84, 0xb8, 0x58, 0x40, 0xee, 0x92, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c,
0x84, 0x8b, 0xb5, 0x2c, 0x31, 0xa7, 0x34, 0x55, 0x82, 0x09, 0x2c, 0x06, 0xe1, 0x58, 0x31, 0x59, 0x02, 0xb3, 0x85, 0x82, 0xb8, 0xd8, 0x72, 0x12, 0x93, 0x52, 0x73, 0x8a, 0x25, 0x98, 0x14, 0x98,
0x30, 0xa2, 0x3a, 0x36, 0xb4, 0x20, 0x85, 0x4a, 0x8e, 0x85, 0x98, 0x44, 0x6d, 0xc7, 0xaa, 0x22, 0x35, 0xb8, 0x8d, 0xac, 0xf4, 0xf0, 0xba, 0x54, 0x0f, 0xcd, 0x4c, 0x3d, 0x1f, 0xb0, 0x66, 0xd7,
0xb9, 0xd5, 0x25, 0x35, 0x27, 0x15, 0xbb, 0x5b, 0x9d, 0x24, 0x4e, 0x3c, 0x94, 0x63, 0xb8, 0xf1, 0xbc, 0x92, 0xa2, 0xca, 0x20, 0xa8, 0x49, 0x52, 0x96, 0x5c, 0xdc, 0x48, 0xc2, 0x42, 0x02, 0x5c,
0x50, 0x8e, 0xa1, 0xe1, 0x91, 0x1c, 0xe3, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0xcc, 0xd9, 0xa9, 0x95, 0x50, 0x5b, 0x41, 0x4c, 0x21, 0x11, 0x2e, 0xd6, 0xb2, 0xc4, 0x9c, 0xd2,
0x78, 0x24, 0xc7, 0x98, 0xc4, 0x06, 0x8e, 0x36, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1c, 0x54, 0x09, 0x26, 0xb0, 0x18, 0x84, 0x63, 0xc5, 0x64, 0xc1, 0x88, 0xea, 0xec, 0xd0, 0x82, 0x14,
0xab, 0x9e, 0xdf, 0xfa, 0x01, 0x00, 0x00, 0xaa, 0x3b, 0x1b, 0x62, 0x26, 0xb5, 0x9d, 0xad, 0x8a, 0xe4, 0x6a, 0x97, 0xd4, 0x9c, 0x54, 0xec,
0xae, 0x76, 0x8a, 0x38, 0xf1, 0x50, 0x8e, 0xe1, 0xc6, 0x43, 0x39, 0x86, 0x86, 0x47, 0x72, 0x8c,
0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0x63, 0x94, 0x1d, 0x99,
0x09, 0xcd, 0x1a, 0xc2, 0x4a, 0x62, 0x03, 0xc7, 0xba, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x78,
0xf1, 0x6d, 0xaa, 0xb1, 0x02, 0x00, 0x00,
} }

View File

@ -0,0 +1,23 @@
syntax = "proto3";
package containerd.services.events.v1;
import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/any.proto";
option go_package = "github.com/containerd/containerd/api/services/events/v1;events";
message NamespaceCreate {
string name = 1;
map<string, string> labels = 2;
}
message NamespaceUpdate {
string name = 1;
map<string, string> labels = 2;
}
message NamespaceDelete {
string name = 1;
}

View File

@ -1,8 +1,8 @@
// Code generated by protoc-gen-gogo. // Code generated by protoc-gen-gogo.
// source: github.com/containerd/containerd/api/types/event/runtime.proto // source: github.com/containerd/containerd/api/services/events/v1/runtime.proto
// DO NOT EDIT! // DO NOT EDIT!
package event package events
import proto "github.com/gogo/protobuf/proto" import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
@ -83,11 +83,11 @@ func (*RuntimeDelete) ProtoMessage() {}
func (*RuntimeDelete) Descriptor() ([]byte, []int) { return fileDescriptorRuntime, []int{4} } func (*RuntimeDelete) Descriptor() ([]byte, []int) { return fileDescriptorRuntime, []int{4} }
func init() { func init() {
proto.RegisterType((*RuntimeIO)(nil), "containerd.v1.types.RuntimeIO") proto.RegisterType((*RuntimeIO)(nil), "containerd.services.events.v1.RuntimeIO")
proto.RegisterType((*RuntimeMount)(nil), "containerd.v1.types.RuntimeMount") proto.RegisterType((*RuntimeMount)(nil), "containerd.services.events.v1.RuntimeMount")
proto.RegisterType((*RuntimeCreate)(nil), "containerd.v1.types.RuntimeCreate") proto.RegisterType((*RuntimeCreate)(nil), "containerd.services.events.v1.RuntimeCreate")
proto.RegisterType((*RuntimeEvent)(nil), "containerd.v1.types.RuntimeEvent") proto.RegisterType((*RuntimeEvent)(nil), "containerd.services.events.v1.RuntimeEvent")
proto.RegisterType((*RuntimeDelete)(nil), "containerd.v1.types.RuntimeDelete") proto.RegisterType((*RuntimeDelete)(nil), "containerd.services.events.v1.RuntimeDelete")
} }
func (m *RuntimeIO) Marshal() (dAtA []byte, err error) { func (m *RuntimeIO) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
@ -1475,42 +1475,44 @@ var (
) )
func init() { func init() {
proto.RegisterFile("github.com/containerd/containerd/api/types/event/runtime.proto", fileDescriptorRuntime) proto.RegisterFile("github.com/containerd/containerd/api/services/events/v1/runtime.proto", fileDescriptorRuntime)
} }
var fileDescriptorRuntime = []byte{ var fileDescriptorRuntime = []byte{
// 523 bytes of a gzipped FileDescriptorProto // 555 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xcb, 0x6e, 0xd3, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xc1, 0x6a, 0xdb, 0x4c,
0x14, 0xad, 0x9d, 0x34, 0x4d, 0x26, 0x04, 0xa1, 0xa1, 0x42, 0x56, 0x16, 0x76, 0x88, 0x58, 0x64, 0x10, 0x8e, 0x64, 0xc7, 0xb1, 0xd7, 0xbf, 0x7f, 0xca, 0x12, 0x8a, 0x30, 0x54, 0x32, 0xa6, 0x07,
0x65, 0x8b, 0x20, 0x21, 0xc4, 0x02, 0xa9, 0xa1, 0x45, 0xca, 0x02, 0x45, 0x9a, 0x66, 0x5f, 0x39, 0x43, 0x61, 0x85, 0xdd, 0x4b, 0x69, 0xa1, 0x34, 0x6e, 0x52, 0xf0, 0xa1, 0x18, 0x36, 0x3e, 0x94,
0xf1, 0x34, 0x1d, 0x35, 0xf1, 0xb5, 0xc6, 0xd7, 0x15, 0xdd, 0xf1, 0x09, 0xfc, 0x04, 0xff, 0x92, 0x5e, 0x82, 0x2c, 0x6d, 0x9c, 0x25, 0xb6, 0x56, 0xec, 0x8e, 0x4c, 0x73, 0xeb, 0x23, 0xf4, 0x25,
0x25, 0x2b, 0xc4, 0x2a, 0x50, 0x7f, 0x09, 0x9a, 0x47, 0xdc, 0x08, 0x95, 0x48, 0xb0, 0x19, 0xdd, 0xfa, 0x2e, 0x3e, 0xf6, 0x54, 0x7a, 0x72, 0x1b, 0x3d, 0x42, 0x9f, 0xa0, 0x68, 0x77, 0xed, 0x98,
0x73, 0x7c, 0xe7, 0xcc, 0xb9, 0x0f, 0x93, 0x77, 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xff, 0x7a, 0x3f, 0xb9, 0x53, 0xbe, 0xe4, 0x7b, 0x26, 0x4b, 0x2e, 0x22, 0x23, 0xba, 0x39, 0x68, 0x13, 0xb3, 0xc0, 0x64, 0xb3, 0xc0, 0x64, 0xb2, 0x59,
0xe7, 0x91, 0x23, 0xfb, 0x07, 0xd9, 0xd1, 0x6d, 0xe1, 0x9f, 0x3e, 0x6b, 0xfb, 0x7d, 0xd6, 0xff, 0xe0, 0x61, 0x7d, 0xb5, 0x0e, 0x0e, 0xbe, 0xfc, 0x0c, 0x1c, 0x5a, 0x37, 0x6d, 0x27, 0xd0, 0xfd,
0xc7, 0xe7, 0xc8, 0x5b, 0xdf, 0xf9, 0x07, 0x3f, 0xee, 0xfc, 0x83, 0xcf, 0xa5, 0xef, 0xac, 0x4b, 0x7a, 0xe7, 0xe6, 0x29, 0x9b, 0xb3, 0x3d, 0x6e, 0x7a, 0xe8, 0xc8, 0x7e, 0x5f, 0xd6, 0xce, 0x0d,
0xdf, 0xf9, 0x56, 0xfa, 0xce, 0xaf, 0xd2, 0x77, 0x66, 0x0d, 0xad, 0xf0, 0xea, 0x77, 0x00, 0x00, 0xfc, 0x5b, 0x67, 0x65, 0xbf, 0xce, 0xea, 0x43, 0x74, 0x0e, 0x3f, 0xac, 0x6e, 0xfd, 0x83, 0x1f,
0x00, 0xff, 0xff, 0xdd, 0x0e, 0xff, 0x3e, 0x11, 0x04, 0x00, 0x00, 0xb7, 0xfe, 0xc1, 0xe7, 0xc2, 0x77, 0x56, 0x85, 0xef, 0x7c, 0x2b, 0x7c, 0xe7, 0x57, 0xe1, 0x3b,
0x1f, 0x5f, 0x3f, 0xf0, 0x6f, 0xf1, 0xca, 0x44, 0xd3, 0x9a, 0x56, 0xf0, 0xfc, 0x4f, 0x00, 0x00,
0x00, 0xff, 0xff, 0xe0, 0x7b, 0x76, 0x39, 0x76, 0x04, 0x00, 0x00,
} }

View File

@ -1,11 +1,13 @@
syntax = "proto3"; syntax = "proto3";
package containerd.v1.types; package containerd.services.events.v1;
import "gogoproto/gogo.proto"; import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto"; import "google/protobuf/timestamp.proto";
import "github.com/containerd/containerd/api/types/task/task.proto"; import "github.com/containerd/containerd/api/types/task/task.proto";
option go_package = "github.com/containerd/containerd/api/services/events/v1;events";
message RuntimeIO { message RuntimeIO {
string stdin = 1; string stdin = 1;
string stdout = 2; string stdout = 2;

View File

@ -1,8 +1,8 @@
// Code generated by protoc-gen-gogo. // Code generated by protoc-gen-gogo.
// source: github.com/containerd/containerd/api/types/event/snapshot.proto // source: github.com/containerd/containerd/api/services/events/v1/snapshot.proto
// DO NOT EDIT! // DO NOT EDIT!
package event package events
import proto "github.com/gogo/protobuf/proto" import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
@ -45,9 +45,9 @@ func (*SnapshotRemove) ProtoMessage() {}
func (*SnapshotRemove) Descriptor() ([]byte, []int) { return fileDescriptorSnapshot, []int{2} } func (*SnapshotRemove) Descriptor() ([]byte, []int) { return fileDescriptorSnapshot, []int{2} }
func init() { func init() {
proto.RegisterType((*SnapshotPrepare)(nil), "containerd.v1.types.SnapshotPrepare") proto.RegisterType((*SnapshotPrepare)(nil), "containerd.services.events.v1.SnapshotPrepare")
proto.RegisterType((*SnapshotCommit)(nil), "containerd.v1.types.SnapshotCommit") proto.RegisterType((*SnapshotCommit)(nil), "containerd.services.events.v1.SnapshotCommit")
proto.RegisterType((*SnapshotRemove)(nil), "containerd.v1.types.SnapshotRemove") proto.RegisterType((*SnapshotRemove)(nil), "containerd.services.events.v1.SnapshotRemove")
} }
func (m *SnapshotPrepare) Marshal() (dAtA []byte, err error) { func (m *SnapshotPrepare) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
@ -652,22 +652,23 @@ var (
) )
func init() { func init() {
proto.RegisterFile("github.com/containerd/containerd/api/types/event/snapshot.proto", fileDescriptorSnapshot) proto.RegisterFile("github.com/containerd/containerd/api/services/events/v1/snapshot.proto", fileDescriptorSnapshot)
} }
var fileDescriptorSnapshot = []byte{ var fileDescriptorSnapshot = []byte{
// 201 bytes of a gzipped FileDescriptorProto // 219 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x4f, 0xcf, 0x2c, 0xc9, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x72, 0x4b, 0xcf, 0x2c, 0xc9,
0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d,
0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xa7, 0x96, 0xa5, 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x17, 0xa7, 0x16, 0x95, 0x65, 0x26, 0xa7, 0x16, 0xeb,
0xe6, 0x95, 0xe8, 0x17, 0xe7, 0x25, 0x16, 0x14, 0x67, 0xe4, 0x97, 0xe8, 0x15, 0x14, 0xe5, 0x97, 0xa7, 0x96, 0xa5, 0xe6, 0x95, 0x14, 0xeb, 0x97, 0x19, 0xea, 0x17, 0xe7, 0x25, 0x16, 0x14, 0x67,
0xe4, 0x0b, 0x09, 0x23, 0x94, 0xea, 0x95, 0x19, 0xea, 0x81, 0x55, 0x2a, 0x59, 0x73, 0xf1, 0x07, 0xe4, 0x97, 0xe8, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0xc9, 0x22, 0x74, 0xe8, 0xc1, 0x54, 0xeb,
0x43, 0x95, 0x05, 0x14, 0xa5, 0x16, 0x24, 0x16, 0xa5, 0x0a, 0x09, 0x70, 0x31, 0x67, 0xa7, 0x56, 0x41, 0x54, 0xeb, 0x95, 0x19, 0x2a, 0x59, 0x73, 0xf1, 0x07, 0x43, 0x35, 0x04, 0x14, 0xa5, 0x16,
0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x06, 0x81, 0x98, 0x42, 0x62, 0x5c, 0x6c, 0x20, 0x99, 0xbc, 0x24, 0x16, 0xa5, 0x0a, 0x09, 0x70, 0x31, 0x67, 0xa7, 0x56, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70,
0x12, 0x09, 0x26, 0xb0, 0x20, 0x94, 0xa7, 0x64, 0xc6, 0xc5, 0x07, 0xd3, 0xec, 0x9c, 0x9f, 0x9b, 0x06, 0x81, 0x98, 0x42, 0x62, 0x5c, 0x6c, 0x20, 0x99, 0xbc, 0x12, 0x09, 0x26, 0xb0, 0x20, 0x94,
0x9b, 0x59, 0x82, 0x45, 0xaf, 0x10, 0x17, 0x4b, 0x5e, 0x62, 0x6e, 0x2a, 0x54, 0x27, 0x98, 0xad, 0xa7, 0x64, 0xc6, 0xc5, 0x07, 0xd3, 0xec, 0x9c, 0x9f, 0x9b, 0x9b, 0x59, 0x82, 0x45, 0xaf, 0x10,
0xa4, 0x84, 0xd0, 0x17, 0x94, 0x9a, 0x9b, 0x5f, 0x86, 0xc5, 0x4e, 0x27, 0x89, 0x13, 0x0f, 0xe5, 0x17, 0x4b, 0x5e, 0x62, 0x6e, 0x2a, 0x54, 0x27, 0x98, 0xad, 0xa4, 0x84, 0xd0, 0x17, 0x94, 0x9a,
0x18, 0x6e, 0x3c, 0x94, 0x63, 0x68, 0x78, 0x24, 0xc7, 0x78, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x9b, 0x5f, 0x86, 0xc5, 0x4e, 0xa7, 0x88, 0x13, 0x0f, 0xe5, 0x18, 0x6e, 0x3c, 0x94, 0x63, 0x68,
0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x26, 0xb1, 0x81, 0xbd, 0x63, 0x0c, 0x08, 0x00, 0x00, 0xff, 0x78, 0x24, 0xc7, 0x78, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31,
0xff, 0x5e, 0xad, 0x28, 0x20, 0x11, 0x01, 0x00, 0x00, 0x46, 0xd9, 0x91, 0x19, 0x32, 0xd6, 0x10, 0x56, 0x12, 0x1b, 0x38, 0x60, 0x8c, 0x01, 0x01, 0x00,
0x00, 0xff, 0xff, 0x10, 0x4c, 0x3d, 0xb2, 0x62, 0x01, 0x00, 0x00,
} }

View File

@ -1,6 +1,8 @@
syntax = "proto3"; syntax = "proto3";
package containerd.v1.types; package containerd.services.events.v1;
option go_package = "github.com/containerd/containerd/api/services/events/v1;events";
message SnapshotPrepare { message SnapshotPrepare {
string key = 1; string key = 1;

View File

@ -1,8 +1,8 @@
// Code generated by protoc-gen-gogo. // Code generated by protoc-gen-gogo.
// source: github.com/containerd/containerd/api/types/event/task.proto // source: github.com/containerd/containerd/api/services/events/v1/task.proto
// DO NOT EDIT! // DO NOT EDIT!
package event package events
import proto "github.com/gogo/protobuf/proto" import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
@ -45,9 +45,9 @@ func (*TaskDelete) ProtoMessage() {}
func (*TaskDelete) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{2} } func (*TaskDelete) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{2} }
func init() { func init() {
proto.RegisterType((*TaskCreate)(nil), "containerd.v1.types.TaskCreate") proto.RegisterType((*TaskCreate)(nil), "containerd.services.events.v1.TaskCreate")
proto.RegisterType((*TaskStart)(nil), "containerd.v1.types.TaskStart") proto.RegisterType((*TaskStart)(nil), "containerd.services.events.v1.TaskStart")
proto.RegisterType((*TaskDelete)(nil), "containerd.v1.types.TaskDelete") proto.RegisterType((*TaskDelete)(nil), "containerd.services.events.v1.TaskDelete")
} }
func (m *TaskCreate) Marshal() (dAtA []byte, err error) { func (m *TaskCreate) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
@ -628,24 +628,25 @@ var (
) )
func init() { func init() {
proto.RegisterFile("github.com/containerd/containerd/api/types/event/task.proto", fileDescriptorTask) proto.RegisterFile("github.com/containerd/containerd/api/services/events/v1/task.proto", fileDescriptorTask)
} }
var fileDescriptorTask = []byte{ var fileDescriptorTask = []byte{
// 228 bytes of a gzipped FileDescriptorProto // 245 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x4e, 0xcf, 0x2c, 0xc9, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x72, 0x4a, 0xcf, 0x2c, 0xc9,
0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d,
0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xa7, 0x96, 0xa5, 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x17, 0xa7, 0x16, 0x95, 0x65, 0x26, 0xa7, 0x16, 0xeb,
0xe6, 0x95, 0xe8, 0x97, 0x24, 0x16, 0x67, 0xeb, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0x09, 0x23, 0xa7, 0x96, 0xa5, 0xe6, 0x95, 0x14, 0xeb, 0x97, 0x19, 0xea, 0x97, 0x24, 0x16, 0x67, 0xeb, 0x15,
0x94, 0xe9, 0x95, 0x19, 0xea, 0x81, 0x55, 0x29, 0x39, 0x70, 0x71, 0x85, 0x24, 0x16, 0x67, 0x3b, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0xc9, 0x22, 0x54, 0xeb, 0xc1, 0x54, 0xea, 0x41, 0x54, 0xea, 0x95,
0x17, 0xa5, 0x26, 0x96, 0xa4, 0x0a, 0x19, 0x71, 0xf1, 0xc0, 0x15, 0xc5, 0x67, 0xa6, 0x48, 0x30, 0x19, 0x2a, 0x39, 0x70, 0x71, 0x85, 0x24, 0x16, 0x67, 0x3b, 0x17, 0xa5, 0x26, 0x96, 0xa4, 0x0a,
0x2a, 0x30, 0x6a, 0x70, 0x3a, 0xf1, 0x3f, 0xba, 0x27, 0xcf, 0xed, 0x0c, 0x13, 0xf7, 0x74, 0x09, 0x19, 0x71, 0xf1, 0xc0, 0x95, 0xc7, 0x67, 0xa6, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x3a, 0xf1,
0xe2, 0x86, 0x2b, 0xf2, 0x4c, 0x51, 0xb2, 0xe7, 0xe2, 0x04, 0x99, 0x10, 0x5c, 0x92, 0x58, 0x54, 0x3f, 0xba, 0x27, 0xcf, 0xed, 0x0c, 0x13, 0xf7, 0x74, 0x09, 0xe2, 0x86, 0x2b, 0xf2, 0x4c, 0x51,
0x42, 0x96, 0x01, 0xc5, 0x10, 0x27, 0xb8, 0xa4, 0xe6, 0xa4, 0x92, 0xe7, 0x04, 0x21, 0x01, 0x2e, 0xb2, 0xe7, 0xe2, 0x04, 0x99, 0x10, 0x5c, 0x92, 0x58, 0x54, 0x42, 0x96, 0x01, 0xc5, 0x10, 0x27,
0xe6, 0x82, 0xcc, 0x14, 0x09, 0x26, 0x05, 0x46, 0x0d, 0xde, 0x20, 0x10, 0x53, 0x48, 0x9e, 0x8b, 0xb8, 0xa4, 0xe6, 0xa4, 0x92, 0xe7, 0x04, 0x21, 0x01, 0x2e, 0xe6, 0x82, 0xcc, 0x14, 0x09, 0x26,
0x3b, 0xb5, 0x22, 0xb3, 0x24, 0xbe, 0xb8, 0x24, 0xb1, 0xa4, 0xb4, 0x58, 0x82, 0x19, 0x2c, 0xc3, 0x05, 0x46, 0x0d, 0xde, 0x20, 0x10, 0x53, 0x48, 0x9e, 0x8b, 0x3b, 0xb5, 0x22, 0xb3, 0x24, 0xbe,
0x05, 0x12, 0x0a, 0x06, 0x8b, 0x38, 0x49, 0x9c, 0x78, 0x28, 0xc7, 0x70, 0xe3, 0xa1, 0x1c, 0x43, 0xb8, 0x24, 0xb1, 0xa4, 0xb4, 0x58, 0x82, 0x19, 0x2c, 0xc3, 0x05, 0x12, 0x0a, 0x06, 0x8b, 0x38,
0xc3, 0x23, 0x39, 0xc6, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x45, 0x9c, 0x78, 0x28, 0xc7, 0x70, 0xe3, 0xa1, 0x1c, 0x43, 0xc3, 0x23, 0x39, 0xc6, 0x13, 0x8f,
0x31, 0x89, 0x0d, 0x1c, 0x5a, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0e, 0x43, 0xc1, 0x0e, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x31, 0xca, 0x8e, 0xcc, 0x40, 0xb7,
0x6c, 0x01, 0x00, 0x00, 0x86, 0xb0, 0x92, 0xd8, 0xc0, 0xe1, 0x6e, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xfe, 0x52, 0xb1,
0x6e, 0xbd, 0x01, 0x00, 0x00,
} }

View File

@ -1,6 +1,8 @@
syntax = "proto3"; syntax = "proto3";
package containerd.v1.types; package containerd.services.events.v1;
option go_package = "github.com/containerd/containerd/api/services/events/v1;events";
message TaskCreate { message TaskCreate {
string container_id = 1; string container_id = 1;

View File

@ -1,429 +0,0 @@
// Code generated by protoc-gen-gogo.
// source: github.com/containerd/containerd/api/types/event/event.proto
// DO NOT EDIT!
package event
import proto "github.com/gogo/protobuf/proto"
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 time "time"
import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types"
import strings "strings"
import reflect "reflect"
import io "io"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var _ = time.Kitchen
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"`
}
func (m *Envelope) Reset() { *m = Envelope{} }
func (*Envelope) ProtoMessage() {}
func (*Envelope) Descriptor() ([]byte, []int) { return fileDescriptorEvent, []int{0} }
func init() {
proto.RegisterType((*Envelope)(nil), "containerd.v1.types.Envelope")
}
func (m *Envelope) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Envelope) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
dAtA[i] = 0xa
i++
i = encodeVarintEvent(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp)))
n1, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i:])
if err != nil {
return 0, err
}
i += n1
if len(m.Topic) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintEvent(dAtA, i, uint64(len(m.Topic)))
i += copy(dAtA[i:], m.Topic)
}
if m.Event != nil {
dAtA[i] = 0x1a
i++
i = encodeVarintEvent(dAtA, i, uint64(m.Event.Size()))
n2, err := m.Event.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n2
}
return i, nil
}
func encodeFixed64Event(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
dAtA[offset+4] = uint8(v >> 32)
dAtA[offset+5] = uint8(v >> 40)
dAtA[offset+6] = uint8(v >> 48)
dAtA[offset+7] = uint8(v >> 56)
return offset + 8
}
func encodeFixed32Event(dAtA []byte, offset int, v uint32) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
return offset + 4
}
func encodeVarintEvent(dAtA []byte, offset int, v uint64) int {
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return offset + 1
}
func (m *Envelope) Size() (n int) {
var l int
_ = l
l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp)
n += 1 + l + sovEvent(uint64(l))
l = len(m.Topic)
if l > 0 {
n += 1 + l + sovEvent(uint64(l))
}
if m.Event != nil {
l = m.Event.Size()
n += 1 + l + sovEvent(uint64(l))
}
return n
}
func sovEvent(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
}
func sozEvent(x uint64) (n int) {
return sovEvent(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (this *Envelope) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&Envelope{`,
`Timestamp:` + strings.Replace(strings.Replace(this.Timestamp.String(), "Timestamp", "google_protobuf1.Timestamp", 1), `&`, ``, 1) + `,`,
`Topic:` + fmt.Sprintf("%v", this.Topic) + `,`,
`Event:` + strings.Replace(fmt.Sprintf("%v", this.Event), "Any", "google_protobuf2.Any", 1) + `,`,
`}`,
}, "")
return s
}
func valueToStringEvent(v interface{}) string {
rv := reflect.ValueOf(v)
if rv.IsNil() {
return "nil"
}
pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("*%v", pv)
}
func (m *Envelope) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvent
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Envelope: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Envelope: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvent
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthEvent
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Topic", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvent
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthEvent
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Topic = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Event", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEvent
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthEvent
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Event == nil {
m.Event = &google_protobuf2.Any{}
}
if err := m.Event.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipEvent(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthEvent
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipEvent(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEvent
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEvent
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
return iNdEx, nil
case 1:
iNdEx += 8
return iNdEx, nil
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEvent
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
iNdEx += length
if length < 0 {
return 0, ErrInvalidLengthEvent
}
return iNdEx, nil
case 3:
for {
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEvent
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
innerWire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
innerWireType := int(innerWire & 0x7)
if innerWireType == 4 {
break
}
next, err := skipEvent(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
}
return iNdEx, nil
case 4:
return iNdEx, nil
case 5:
iNdEx += 4
return iNdEx, nil
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
}
panic("unreachable")
}
var (
ErrInvalidLengthEvent = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowEvent = fmt.Errorf("proto: integer overflow")
)
func init() {
proto.RegisterFile("github.com/containerd/containerd/api/types/event/event.proto", fileDescriptorEvent)
}
var fileDescriptorEvent = []byte{
// 248 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x49, 0xcf, 0x2c, 0xc9,
0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d,
0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xa7, 0x96, 0xa5,
0xe6, 0x95, 0x40, 0x48, 0xbd, 0x82, 0xa2, 0xfc, 0x92, 0x7c, 0x21, 0x61, 0x84, 0x3a, 0xbd, 0x32,
0x43, 0x3d, 0xb0, 0x32, 0x29, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0xb0, 0xbc, 0x3e, 0x88, 0x05, 0x51,
0x2a, 0x25, 0x9f, 0x9e, 0x9f, 0x9f, 0x9e, 0x93, 0xaa, 0x0f, 0xe6, 0x25, 0x95, 0xa6, 0xe9, 0x97,
0x64, 0xe6, 0xa6, 0x16, 0x97, 0x24, 0xe6, 0x16, 0x40, 0x15, 0x48, 0xa2, 0x2b, 0x48, 0xcc, 0xab,
0x84, 0x48, 0x29, 0x4d, 0x60, 0xe4, 0xe2, 0x70, 0xcd, 0x2b, 0x4b, 0xcd, 0xc9, 0x2f, 0x48, 0x15,
0x72, 0xe2, 0xe2, 0x84, 0x6b, 0x95, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x36, 0x92, 0xd2, 0x83, 0xe8,
0xd5, 0x83, 0xe9, 0xd5, 0x0b, 0x81, 0xa9, 0x70, 0xe2, 0x38, 0x71, 0x4f, 0x9e, 0x61, 0xc2, 0x7d,
0x79, 0xc6, 0x20, 0x84, 0x36, 0x21, 0x11, 0x2e, 0xd6, 0x92, 0xfc, 0x82, 0xcc, 0x64, 0x09, 0x26,
0x05, 0x46, 0x0d, 0xce, 0x20, 0x08, 0x47, 0x48, 0x8b, 0x8b, 0x15, 0xec, 0x39, 0x09, 0x66, 0xb0,
0xa9, 0x22, 0x18, 0xa6, 0x3a, 0xe6, 0x55, 0x06, 0x41, 0x94, 0x38, 0x49, 0x9c, 0x78, 0x28, 0xc7,
0x70, 0xe3, 0xa1, 0x1c, 0x43, 0xc3, 0x23, 0x39, 0xc6, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92,
0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x31, 0x89, 0x0d, 0xac, 0xdc, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff,
0xb7, 0xff, 0x84, 0x18, 0x5a, 0x01, 0x00, 0x00,
}

View File

@ -1,13 +0,0 @@
syntax = "proto3";
package containerd.v1.types;
import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/any.proto";
message Envelope {
google.protobuf.Timestamp timestamp = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
string topic = 2;
google.protobuf.Any event = 3;
}

View File

@ -1,17 +0,0 @@
syntax = "proto3";
package containerd.v1.types;
message NamespaceCreate {
string name = 1;
map<string, string> labels = 2;
}
message NamespaceUpdate {
string name = 1;
map<string, string> labels = 2;
}
message NamespaceDelete {
string name = 1;
}

View File

@ -7,8 +7,7 @@ import (
"text/tabwriter" "text/tabwriter"
eventsapi "github.com/containerd/containerd/api/services/events/v1" eventsapi "github.com/containerd/containerd/api/services/events/v1"
"github.com/containerd/containerd/api/types/event" "github.com/containerd/containerd/events"
"github.com/gogo/protobuf/proto"
"github.com/urfave/cli" "github.com/urfave/cli"
) )
@ -56,118 +55,55 @@ var eventsCommand = cli.Command{
}, },
} }
func getEventOutput(evt *event.Envelope) (string, error) { func getEventOutput(env *eventsapi.Envelope) (string, error) {
out := "" out := ""
switch evt.Event.TypeUrl {
case "types.containerd.io/containerd.v1.types.event.ContainerCreate": var de events.DynamicEvent
e := &event.ContainerCreate{} if err := events.UnmarshalEvent(env.Event, &de); err != nil {
if err := proto.Unmarshal(evt.Event.Value, e); err != nil { return "", err
return out, err }
}
switch e := de.Event.(type) {
case *eventsapi.ContainerCreate:
out = fmt.Sprintf("id=%s image=%s runtime=%s", e.ContainerID, e.Image, e.Runtime) out = fmt.Sprintf("id=%s image=%s runtime=%s", e.ContainerID, e.Image, e.Runtime)
case "types.containerd.io/containerd.v1.types.event.TaskCreate": case *eventsapi.TaskCreate:
e := &event.TaskCreate{}
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
return out, err
}
out = "id=" + e.ContainerID out = "id=" + e.ContainerID
case "types.containerd.io/containerd.v1.types.event.TaskStart": case *eventsapi.TaskStart:
e := &event.TaskStart{}
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
return out, err
}
out = "id=" + e.ContainerID out = "id=" + e.ContainerID
case "types.containerd.io/containerd.v1.types.event.TaskDelete": case *eventsapi.TaskDelete:
e := &event.TaskDelete{}
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
return out, err
}
out = fmt.Sprintf("id=%s pid=%d status=%d", e.ContainerID, e.Pid, e.ExitStatus) out = fmt.Sprintf("id=%s pid=%d status=%d", e.ContainerID, e.Pid, e.ExitStatus)
case "types.containerd.io/containerd.v1.types.event.ContainerUpdate": case *eventsapi.ContainerUpdate:
e := &event.ContainerUpdate{}
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
return out, err
}
out = "id=" + e.ContainerID out = "id=" + e.ContainerID
case "types.containerd.io/containerd.v1.types.event.ContainerDelete": case *eventsapi.ContainerDelete:
e := &event.ContainerDelete{}
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
return out, err
}
out = "id=" + e.ContainerID out = "id=" + e.ContainerID
case "types.containerd.io/containerd.v1.types.event.SnapshotPrepare": case *eventsapi.SnapshotPrepare:
e := &event.SnapshotPrepare{}
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
return out, err
}
out = fmt.Sprintf("key=%s parent=%s", e.Key, e.Parent) out = fmt.Sprintf("key=%s parent=%s", e.Key, e.Parent)
case "types.containerd.io/containerd.v1.types.event.SnapshotCommit": case *eventsapi.SnapshotCommit:
e := &event.SnapshotCommit{}
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
return out, err
}
out = fmt.Sprintf("key=%s name=%s", e.Key, e.Name) out = fmt.Sprintf("key=%s name=%s", e.Key, e.Name)
case "types.containerd.io/containerd.v1.types.event.SnapshotRemove": case *eventsapi.SnapshotRemove:
e := &event.SnapshotRemove{}
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
return out, err
}
out = "key=" + e.Key out = "key=" + e.Key
case "types.containerd.io/containerd.v1.types.event.ImageUpdate": case *eventsapi.ImageUpdate:
e := &event.ImageUpdate{}
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
return out, err
}
out = fmt.Sprintf("name=%s labels=%s", e.Name, e.Labels) out = fmt.Sprintf("name=%s labels=%s", e.Name, e.Labels)
case "types.containerd.io/containerd.v1.types.event.ImageDelete": case *eventsapi.ImageDelete:
e := &event.ImageDelete{}
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
return out, err
}
out = "name=" + e.Name out = "name=" + e.Name
case "types.containerd.io/containerd.v1.types.event.NamespaceCreate": case *eventsapi.NamespaceCreate:
e := &event.NamespaceCreate{}
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
return out, err
}
out = fmt.Sprintf("name=%s labels=%s", e.Name, e.Labels) out = fmt.Sprintf("name=%s labels=%s", e.Name, e.Labels)
case "types.containerd.io/containerd.v1.types.event.NamespaceUpdate": case *eventsapi.NamespaceUpdate:
e := &event.NamespaceUpdate{}
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
return out, err
}
out = fmt.Sprintf("name=%s labels=%s", e.Name, e.Labels) out = fmt.Sprintf("name=%s labels=%s", e.Name, e.Labels)
case "types.containerd.io/containerd.v1.types.event.NamespaceDelete": case *eventsapi.NamespaceDelete:
e := &event.NamespaceDelete{}
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
return out, err
}
out = "name=" + e.Name out = "name=" + e.Name
case "types.containerd.io/containerd.v1.types.event.RuntimeCreate": case *eventsapi.RuntimeCreate:
e := &event.RuntimeCreate{}
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
return out, err
}
mounts := []string{} mounts := []string{}
for _, m := range e.RootFS { for _, m := range e.RootFS {
mounts = append(mounts, fmt.Sprintf("type=%s:src=%s", m.Type, m.Source)) mounts = append(mounts, fmt.Sprintf("type=%s:src=%s", m.Type, m.Source))
} }
out = fmt.Sprintf("id=%s bundle=%s rootfs=%s checkpoint=%s", e.ID, e.Bundle, strings.Join(mounts, ","), e.Checkpoint) out = fmt.Sprintf("id=%s bundle=%s rootfs=%s checkpoint=%s", e.ID, e.Bundle, strings.Join(mounts, ","), e.Checkpoint)
case "types.containerd.io/containerd.v1.types.event.RuntimeEvent": case *eventsapi.RuntimeEvent:
e := &event.RuntimeEvent{}
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
return out, err
}
out = fmt.Sprintf("id=%s type=%s pid=%d status=%d exited=%s", e.ID, e.Type, e.Pid, e.ExitStatus, e.ExitedAt) out = fmt.Sprintf("id=%s type=%s pid=%d status=%d exited=%s", e.ID, e.Type, e.Pid, e.ExitStatus, e.ExitedAt)
case "types.containerd.io/containerd.v1.types.event.RuntimeDelete": case *eventsapi.RuntimeDelete:
e := &event.RuntimeDelete{}
if err := proto.Unmarshal(evt.Event.Value, e); err != nil {
return out, err
}
out = fmt.Sprintf("id=%s runtime=%s status=%d exited=%s", e.ID, e.Runtime, e.ExitStatus, e.ExitedAt) out = fmt.Sprintf("id=%s runtime=%s status=%d exited=%s", e.ID, e.Runtime, e.ExitStatus, e.ExitedAt)
default: default:
out = evt.Event.TypeUrl out = env.Event.TypeUrl
} }
return out, nil return out, nil

View File

@ -1,92 +1,72 @@
package events package events
import ( import (
"path"
"strings"
"github.com/containerd/containerd/api/types/event"
"github.com/gogo/protobuf/proto" "github.com/gogo/protobuf/proto"
protobuf "github.com/gogo/protobuf/types" "github.com/gogo/protobuf/types"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
func getUrl(name string) string { const (
base := "types.containerd.io" typesPrefix = "types.containerd.io/"
return path.Join(base, strings.Join([]string{ )
"containerd",
EventVersion,
"types",
"event",
name,
}, "."))
}
func convertToAny(evt Event) (*protobuf.Any, error) { // MarshalEvent marshal the event into an any, namespacing the type url to the
url := "" // containerd types.
var pb proto.Message func MarshalEvent(event Event) (*types.Any, error) {
switch v := evt.(type) { pb, ok := event.(proto.Message)
case event.ContainerCreate: if !ok {
url = getUrl("ContainerCreate") return nil, errors.Errorf("%T not a protobuf", event)
pb = &v
case event.ContainerDelete:
url = getUrl("ContainerDelete")
pb = &v
case event.TaskCreate:
url = getUrl("TaskCreate")
pb = &v
case event.TaskStart:
url = getUrl("TaskStart")
pb = &v
case event.TaskDelete:
url = getUrl("TaskDelete")
pb = &v
case event.ContentDelete:
url = getUrl("ContentDelete")
pb = &v
case event.SnapshotPrepare:
url = getUrl("SnapshotPrepare")
pb = &v
case event.SnapshotCommit:
url = getUrl("SnapshotCommit")
pb = &v
case event.SnapshotRemove:
url = getUrl("SnapshotRemove")
pb = &v
case event.ImageUpdate:
url = getUrl("ImageUpdate")
pb = &v
case event.ImageDelete:
url = getUrl("ImageDelete")
pb = &v
case event.NamespaceCreate:
url = getUrl("NamespaceCreate")
pb = &v
case event.NamespaceUpdate:
url = getUrl("NamespaceUpdate")
pb = &v
case event.NamespaceDelete:
url = getUrl("NamespaceDelete")
pb = &v
case event.RuntimeCreate:
url = getUrl("RuntimeCreate")
pb = &v
case event.RuntimeEvent:
url = getUrl("RuntimeEvent")
pb = &v
case event.RuntimeDelete:
url = getUrl("RuntimeDelete")
pb = &v
default:
return nil, errors.Errorf("unsupported event type: %T", v)
} }
url := typesPrefix + proto.MessageName(pb)
val, err := proto.Marshal(pb) val, err := proto.Marshal(pb)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return &protobuf.Any{ return &types.Any{
TypeUrl: url, TypeUrl: url,
Value: val, Value: val,
}, nil }, nil
} }
// DynamEvent acts as a holder type for unmarshaling events where the type is
// not previously known.
type DynamicEvent struct {
Event
}
// UnmarshalEvent provides an event object based on the provided any.
//
// Use with DynamicEvent (or protobuf/types.DynamicAny) if the type is not
// known before hand.
func UnmarshalEvent(any *types.Any, event Event) error {
switch v := event.(type) {
case proto.Message:
if err := types.UnmarshalAny(any, v); err != nil {
return errors.Wrapf(err, "failed to unmarshal event %v", any)
}
case *DynamicEvent:
var da types.DynamicAny
if err := types.UnmarshalAny(any, &da); err != nil {
return errors.Wrapf(err, "failed to unmarshal event %v", any)
}
v.Event = da.Message
default:
return errors.Errorf("unsupported event type: %T", event)
}
return nil
}
// Is returns true if the event in any will unmarashal into the provided event.
func Is(any *types.Any, event Event) bool {
pb, ok := event.(proto.Message)
if !ok {
return false
}
return types.Is(any, pb)
}

View File

@ -4,7 +4,7 @@ import (
"context" "context"
"sync" "sync"
"github.com/containerd/containerd/api/types/event" events "github.com/containerd/containerd/api/services/events/v1"
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
goevents "github.com/docker/go-events" goevents "github.com/docker/go-events"
) )
@ -38,12 +38,12 @@ func (e *Emitter) Post(ctx context.Context, evt Event) error {
return nil return nil
} }
func (e *Emitter) Events(ctx context.Context, clientID string) chan *event.Envelope { func (e *Emitter) Events(ctx context.Context, clientID string) chan *events.Envelope {
e.m.Lock() e.m.Lock()
if _, ok := e.sinks[clientID]; !ok { if _, ok := e.sinks[clientID]; !ok {
ns, _ := namespaces.Namespace(ctx) ns, _ := namespaces.Namespace(ctx)
s := &eventSink{ s := &eventSink{
ch: make(chan *event.Envelope), ch: make(chan *events.Envelope),
ns: ns, ns: ns,
} }
e.sinks[clientID] = s e.sinks[clientID] = s

View File

@ -5,7 +5,7 @@ import (
"time" "time"
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/containerd/containerd/api/types/event" "github.com/containerd/containerd/api/services/events/v1"
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
goevents "github.com/docker/go-events" goevents "github.com/docker/go-events"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -18,7 +18,7 @@ type sinkEvent struct {
type eventSink struct { type eventSink struct {
ns string ns string
ch chan *event.Envelope ch chan *events.Envelope
} }
func (s *eventSink) Write(evt goevents.Event) error { func (s *eventSink) Write(evt goevents.Event) error {
@ -34,7 +34,7 @@ func (s *eventSink) Write(evt goevents.Event) error {
return nil return nil
} }
eventData, err := convertToAny(e.event) eventData, err := MarshalEvent(e.event)
if err != nil { if err != nil {
return err return err
} }
@ -45,7 +45,7 @@ func (s *eventSink) Write(evt goevents.Event) error {
"ns": ns, "ns": ns,
}).Debug("event") }).Debug("event")
s.ch <- &event.Envelope{ s.ch <- &events.Envelope{
Timestamp: time.Now(), Timestamp: time.Now(),
Topic: topic, Topic: topic,
Event: eventData, Event: eventData,

View File

@ -16,8 +16,8 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
eventsapi "github.com/containerd/containerd/api/services/events/v1"
"github.com/containerd/containerd/api/services/shim/v1" "github.com/containerd/containerd/api/services/shim/v1"
"github.com/containerd/containerd/api/types/event"
"github.com/containerd/containerd/api/types/mount" "github.com/containerd/containerd/api/types/mount"
"github.com/containerd/containerd/api/types/task" "github.com/containerd/containerd/api/types/task"
"github.com/containerd/containerd/events" "github.com/containerd/containerd/events"
@ -242,19 +242,19 @@ func (r *Runtime) Create(ctx context.Context, id string, opts plugin.CreateOpts)
return nil, err return nil, err
} }
var runtimeMounts []*event.RuntimeMount var runtimeMounts []*eventsapi.RuntimeMount
for _, m := range opts.Rootfs { for _, m := range opts.Rootfs {
runtimeMounts = append(runtimeMounts, &event.RuntimeMount{ runtimeMounts = append(runtimeMounts, &eventsapi.RuntimeMount{
Type: m.Type, Type: m.Type,
Source: m.Source, Source: m.Source,
Options: m.Options, Options: m.Options,
}) })
} }
if err := r.emit(ctx, "/runtime/create", event.RuntimeCreate{ if err := r.emit(ctx, "/runtime/create", &eventsapi.RuntimeCreate{
ID: id, ID: id,
Bundle: path, Bundle: path,
RootFS: runtimeMounts, RootFS: runtimeMounts,
IO: &event.RuntimeIO{ IO: &eventsapi.RuntimeIO{
Stdin: opts.IO.Stdin, Stdin: opts.IO.Stdin,
Stdout: opts.IO.Stdout, Stdout: opts.IO.Stdout,
Stderr: opts.IO.Stderr, Stderr: opts.IO.Stderr,
@ -290,7 +290,7 @@ func (r *Runtime) Delete(ctx context.Context, c plugin.Task) (*plugin.Exit, erro
r.tasks.delete(ctx, lc) r.tasks.delete(ctx, lc)
i := c.Info() i := c.Info()
if err := r.emit(ctx, "/runtime/delete", event.RuntimeDelete{ if err := r.emit(ctx, "/runtime/delete", &eventsapi.RuntimeDelete{
ID: i.ID, ID: i.ID,
Runtime: i.Runtime, Runtime: i.Runtime,
ExitStatus: rsp.ExitStatus, ExitStatus: rsp.ExitStatus,
@ -416,7 +416,7 @@ func (r *Runtime) forward(ctx context.Context, events shim.Shim_EventsClient) {
ExitStatus: e.ExitStatus, ExitStatus: e.ExitStatus,
ExitedAt: e.ExitedAt, ExitedAt: e.ExitedAt,
} }
if err := r.emit(ctx, "/runtime/"+topic, event.RuntimeEvent{ if err := r.emit(ctx, "/runtime/"+topic, &eventsapi.RuntimeEvent{
ID: e.ID, ID: e.ID,
Type: e.Type, Type: e.Type,
Pid: e.Pid, Pid: e.Pid,

View File

@ -7,9 +7,8 @@ import (
eventsapi "github.com/containerd/containerd/api/services/events/v1" eventsapi "github.com/containerd/containerd/api/services/events/v1"
"github.com/containerd/containerd/api/services/tasks/v1" "github.com/containerd/containerd/api/services/tasks/v1"
"github.com/containerd/containerd/api/types/event"
tasktypes "github.com/containerd/containerd/api/types/task" tasktypes "github.com/containerd/containerd/api/types/task"
"github.com/gogo/protobuf/proto" "github.com/containerd/containerd/events"
protobuf "github.com/gogo/protobuf/types" protobuf "github.com/gogo/protobuf/types"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"
) )
@ -74,24 +73,27 @@ func (p *process) Kill(ctx context.Context, s syscall.Signal) error {
func (p *process) Wait(ctx context.Context) (uint32, error) { func (p *process) Wait(ctx context.Context) (uint32, error) {
// TODO (ehazlett): add filtering for specific event // TODO (ehazlett): add filtering for specific event
events, err := p.task.client.EventService().Stream(ctx, &eventsapi.StreamEventsRequest{}) eventstream, err := p.task.client.EventService().Stream(ctx, &eventsapi.StreamEventsRequest{})
if err != nil { if err != nil {
return UnknownExitStatus, err return UnknownExitStatus, err
} }
<-p.pidSync <-p.pidSync
evloop:
for { for {
evt, err := events.Recv() evt, err := eventstream.Recv()
if err != nil { if err != nil {
return UnknownExitStatus, err return UnknownExitStatus, err
} }
if evt.Event.TypeUrl == "types.containerd.io/containerd.v1.types.event.RuntimeEvent" {
e := &event.RuntimeEvent{} switch {
if err := proto.Unmarshal(evt.Event.Value, e); err != nil { case events.Is(evt.Event, &eventsapi.RuntimeEvent{}):
var e eventsapi.RuntimeEvent
if err := events.UnmarshalEvent(evt.Event, &e); err != nil {
return UnknownExitStatus, err return UnknownExitStatus, err
} }
if e.Type != tasktypes.Event_EXIT { if e.Type != tasktypes.Event_EXIT {
continue continue evloop
} }
if e.ID == p.task.containerID && e.Pid == p.pid { if e.ID == p.task.containerID && e.Pid == p.pid {

View File

@ -3,7 +3,7 @@ package containers
import ( import (
"github.com/boltdb/bolt" "github.com/boltdb/bolt"
api "github.com/containerd/containerd/api/services/containers/v1" api "github.com/containerd/containerd/api/services/containers/v1"
"github.com/containerd/containerd/api/types/event" eventsapi "github.com/containerd/containerd/api/services/events/v1"
"github.com/containerd/containerd/containers" "github.com/containerd/containerd/containers"
"github.com/containerd/containerd/events" "github.com/containerd/containerd/events"
"github.com/containerd/containerd/metadata" "github.com/containerd/containerd/metadata"
@ -93,10 +93,10 @@ func (s *Service) Create(ctx context.Context, req *api.CreateContainerRequest) (
}); err != nil { }); err != nil {
return &resp, err return &resp, err
} }
if err := s.emit(ctx, "/containers/create", event.ContainerCreate{ if err := s.emit(ctx, "/containers/create", &eventsapi.ContainerCreate{
ContainerID: resp.Container.ID, ContainerID: resp.Container.ID,
Image: resp.Container.Image, Image: resp.Container.Image,
Runtime: &event.ContainerCreate_Runtime{ Runtime: &eventsapi.ContainerCreate_Runtime{
Name: resp.Container.Runtime.Name, Name: resp.Container.Runtime.Name,
Options: resp.Container.Runtime.Options, Options: resp.Container.Runtime.Options,
}, },
@ -160,7 +160,7 @@ func (s *Service) Update(ctx context.Context, req *api.UpdateContainerRequest) (
return &resp, err return &resp, err
} }
if err := s.emit(ctx, "/containers/update", event.ContainerUpdate{ if err := s.emit(ctx, "/containers/update", &eventsapi.ContainerUpdate{
ContainerID: resp.Container.ID, ContainerID: resp.Container.ID,
Image: resp.Container.Image, Image: resp.Container.Image,
Labels: resp.Container.Labels, Labels: resp.Container.Labels,
@ -179,7 +179,7 @@ func (s *Service) Delete(ctx context.Context, req *api.DeleteContainerRequest) (
return &empty.Empty{}, mapGRPCError(err, req.ID) return &empty.Empty{}, mapGRPCError(err, req.ID)
} }
if err := s.emit(ctx, "/containers/delete", event.ContainerDelete{ if err := s.emit(ctx, "/containers/delete", &eventsapi.ContainerDelete{
ContainerID: req.ID, ContainerID: req.ID,
}); err != nil { }); err != nil {
return &empty.Empty{}, err return &empty.Empty{}, err

View File

@ -6,7 +6,7 @@ import (
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
api "github.com/containerd/containerd/api/services/content/v1" api "github.com/containerd/containerd/api/services/content/v1"
"github.com/containerd/containerd/api/types/event" eventsapi "github.com/containerd/containerd/api/services/events/v1"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/events" "github.com/containerd/containerd/events"
"github.com/containerd/containerd/log" "github.com/containerd/containerd/log"
@ -128,7 +128,7 @@ func (s *Service) Delete(ctx context.Context, req *api.DeleteContentRequest) (*e
return nil, serverErrorToGRPC(err, req.Digest.String()) return nil, serverErrorToGRPC(err, req.Digest.String())
} }
if err := s.emit(ctx, "/content/delete", event.ContentDelete{ if err := s.emit(ctx, "/content/delete", &eventsapi.ContentDelete{
Digest: req.Digest, Digest: req.Digest,
}); err != nil { }); err != nil {
return nil, err return nil, err

View File

@ -2,8 +2,8 @@ package images
import ( import (
"github.com/boltdb/bolt" "github.com/boltdb/bolt"
eventsapi "github.com/containerd/containerd/api/services/events/v1"
imagesapi "github.com/containerd/containerd/api/services/images/v1" imagesapi "github.com/containerd/containerd/api/services/images/v1"
"github.com/containerd/containerd/api/types/event"
"github.com/containerd/containerd/events" "github.com/containerd/containerd/events"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/metadata" "github.com/containerd/containerd/metadata"
@ -69,7 +69,7 @@ func (s *Service) Update(ctx context.Context, req *imagesapi.UpdateImageRequest)
return nil, err return nil, err
} }
if err := s.emit(ctx, "/images/update", event.ImageUpdate{ if err := s.emit(ctx, "/images/update", &eventsapi.ImageUpdate{
Name: req.Image.Name, Name: req.Image.Name,
Labels: req.Image.Labels, Labels: req.Image.Labels,
}); err != nil { }); err != nil {
@ -103,7 +103,7 @@ func (s *Service) Delete(ctx context.Context, req *imagesapi.DeleteImageRequest)
return nil, err return nil, err
} }
if err := s.emit(ctx, "/images/delete", event.ImageDelete{ if err := s.emit(ctx, "/images/delete", &eventsapi.ImageDelete{
Name: req.Name, Name: req.Name,
}); err != nil { }); err != nil {
return nil, err return nil, err

View File

@ -4,8 +4,8 @@ import (
"strings" "strings"
"github.com/boltdb/bolt" "github.com/boltdb/bolt"
eventsapi "github.com/containerd/containerd/api/services/events/v1"
api "github.com/containerd/containerd/api/services/namespaces/v1" api "github.com/containerd/containerd/api/services/namespaces/v1"
"github.com/containerd/containerd/api/types/event"
"github.com/containerd/containerd/events" "github.com/containerd/containerd/events"
"github.com/containerd/containerd/metadata" "github.com/containerd/containerd/metadata"
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
@ -118,7 +118,7 @@ func (s *Service) Create(ctx context.Context, req *api.CreateNamespaceRequest) (
return &resp, err return &resp, err
} }
if err := s.emit(ctx, "/namespaces/create", event.NamespaceCreate{ if err := s.emit(ctx, "/namespaces/create", &eventsapi.NamespaceCreate{
Name: req.Namespace.Name, Name: req.Namespace.Name,
Labels: req.Namespace.Labels, Labels: req.Namespace.Labels,
}); err != nil { }); err != nil {
@ -171,7 +171,7 @@ func (s *Service) Update(ctx context.Context, req *api.UpdateNamespaceRequest) (
return &resp, err return &resp, err
} }
if err := s.emit(ctx, "/namespaces/update", event.NamespaceUpdate{ if err := s.emit(ctx, "/namespaces/update", &eventsapi.NamespaceUpdate{
Name: req.Namespace.Name, Name: req.Namespace.Name,
Labels: req.Namespace.Labels, Labels: req.Namespace.Labels,
}); err != nil { }); err != nil {
@ -188,7 +188,7 @@ func (s *Service) Delete(ctx context.Context, req *api.DeleteNamespaceRequest) (
return &empty.Empty{}, err return &empty.Empty{}, err
} }
if err := s.emit(ctx, "/namespaces/delete", event.NamespaceDelete{ if err := s.emit(ctx, "/namespaces/delete", &eventsapi.NamespaceDelete{
Name: req.Name, Name: req.Name,
}); err != nil { }); err != nil {
return &empty.Empty{}, err return &empty.Empty{}, err

View File

@ -3,8 +3,8 @@ package snapshot
import ( import (
gocontext "context" gocontext "context"
eventsapi "github.com/containerd/containerd/api/services/events/v1"
snapshotapi "github.com/containerd/containerd/api/services/snapshot/v1" snapshotapi "github.com/containerd/containerd/api/services/snapshot/v1"
"github.com/containerd/containerd/api/types/event"
mounttypes "github.com/containerd/containerd/api/types/mount" mounttypes "github.com/containerd/containerd/api/types/mount"
"github.com/containerd/containerd/events" "github.com/containerd/containerd/events"
"github.com/containerd/containerd/log" "github.com/containerd/containerd/log"
@ -63,7 +63,7 @@ func (s *service) Prepare(ctx context.Context, pr *snapshotapi.PrepareSnapshotRe
return nil, grpcError(err) return nil, grpcError(err)
} }
if err := s.emit(ctx, "/snapshot/prepare", event.SnapshotPrepare{ if err := s.emit(ctx, "/snapshot/prepare", &eventsapi.SnapshotPrepare{
Key: pr.Key, Key: pr.Key,
Parent: pr.Parent, Parent: pr.Parent,
}); err != nil { }); err != nil {
@ -108,7 +108,7 @@ func (s *service) Commit(ctx context.Context, cr *snapshotapi.CommitSnapshotRequ
return nil, grpcError(err) return nil, grpcError(err)
} }
if err := s.emit(ctx, "/snapshot/commit", event.SnapshotCommit{ if err := s.emit(ctx, "/snapshot/commit", &eventsapi.SnapshotCommit{
Key: cr.Key, Key: cr.Key,
Name: cr.Name, Name: cr.Name,
}); err != nil { }); err != nil {
@ -125,7 +125,7 @@ func (s *service) Remove(ctx context.Context, rr *snapshotapi.RemoveSnapshotRequ
return nil, grpcError(err) return nil, grpcError(err)
} }
if err := s.emit(ctx, "/snapshot/remove", event.SnapshotRemove{ if err := s.emit(ctx, "/snapshot/remove", &eventsapi.SnapshotRemove{
Key: rr.Key, Key: rr.Key,
}); err != nil { }); err != nil {
return nil, err return nil, err

View File

@ -9,9 +9,9 @@ import (
"path/filepath" "path/filepath"
"github.com/boltdb/bolt" "github.com/boltdb/bolt"
eventsapi "github.com/containerd/containerd/api/services/events/v1"
api "github.com/containerd/containerd/api/services/tasks/v1" api "github.com/containerd/containerd/api/services/tasks/v1"
"github.com/containerd/containerd/api/types/descriptor" "github.com/containerd/containerd/api/types/descriptor"
"github.com/containerd/containerd/api/types/event"
"github.com/containerd/containerd/api/types/task" "github.com/containerd/containerd/api/types/task"
"github.com/containerd/containerd/archive" "github.com/containerd/containerd/archive"
"github.com/containerd/containerd/containers" "github.com/containerd/containerd/containers"
@ -154,7 +154,7 @@ func (s *Service) Create(ctx context.Context, r *api.CreateTaskRequest) (*api.Cr
log.G(ctx).Error(err) log.G(ctx).Error(err)
} }
if err := s.emit(ctx, "/tasks/create", event.TaskCreate{ if err := s.emit(ctx, "/tasks/create", &eventsapi.TaskCreate{
ContainerID: r.ContainerID, ContainerID: r.ContainerID,
}); err != nil { }); err != nil {
return nil, err return nil, err
@ -175,7 +175,7 @@ func (s *Service) Start(ctx context.Context, r *api.StartTaskRequest) (*google_p
return nil, err return nil, err
} }
if err := s.emit(ctx, "/tasks/start", event.TaskStart{ if err := s.emit(ctx, "/tasks/start", &eventsapi.TaskStart{
ContainerID: r.ContainerID, ContainerID: r.ContainerID,
}); err != nil { }); err != nil {
return nil, err return nil, err
@ -197,7 +197,7 @@ func (s *Service) Delete(ctx context.Context, r *api.DeleteTaskRequest) (*api.De
if err != nil { if err != nil {
return nil, err return nil, err
} }
if err := s.emit(ctx, "/tasks/delete", event.TaskDelete{ if err := s.emit(ctx, "/tasks/delete", &eventsapi.TaskDelete{
ContainerID: r.ContainerID, ContainerID: r.ContainerID,
Pid: exit.Pid, Pid: exit.Pid,
ExitStatus: exit.Status, ExitStatus: exit.Status,

18
task.go
View File

@ -13,11 +13,10 @@ import (
"github.com/containerd/containerd/api/services/containers/v1" "github.com/containerd/containerd/api/services/containers/v1"
eventsapi "github.com/containerd/containerd/api/services/events/v1" eventsapi "github.com/containerd/containerd/api/services/events/v1"
"github.com/containerd/containerd/api/services/tasks/v1" "github.com/containerd/containerd/api/services/tasks/v1"
"github.com/containerd/containerd/api/types/event"
tasktypes "github.com/containerd/containerd/api/types/task" tasktypes "github.com/containerd/containerd/api/types/task"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/events"
"github.com/containerd/containerd/rootfs" "github.com/containerd/containerd/rootfs"
"github.com/gogo/protobuf/proto"
"github.com/opencontainers/image-spec/specs-go/v1" "github.com/opencontainers/image-spec/specs-go/v1"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"
) )
@ -143,24 +142,27 @@ func (t *task) Status(ctx context.Context) (TaskStatus, error) {
// Wait is a blocking call that will wait for the task to exit and return the exit status // Wait is a blocking call that will wait for the task to exit and return the exit status
func (t *task) Wait(ctx context.Context) (uint32, error) { func (t *task) Wait(ctx context.Context) (uint32, error) {
// TODO (ehazlett): add filtering for specific event // TODO (ehazlett): add filtering for specific event
events, err := t.client.EventService().Stream(ctx, &eventsapi.StreamEventsRequest{}) eventstream, err := t.client.EventService().Stream(ctx, &eventsapi.StreamEventsRequest{})
if err != nil { if err != nil {
return UnknownExitStatus, err return UnknownExitStatus, err
} }
<-t.pidSync <-t.pidSync
evloop:
for { for {
evt, err := events.Recv() evt, err := eventstream.Recv()
if err != nil { if err != nil {
return UnknownExitStatus, err return UnknownExitStatus, err
} }
if evt.Event.TypeUrl == "types.containerd.io/containerd.v1.types.event.RuntimeEvent" {
e := &event.RuntimeEvent{} switch {
if err := proto.Unmarshal(evt.Event.Value, e); err != nil { case events.Is(evt.Event, &eventsapi.RuntimeEvent{}):
var e eventsapi.RuntimeEvent
if err := events.UnmarshalEvent(evt.Event, &e); err != nil {
return UnknownExitStatus, err return UnknownExitStatus, err
} }
if e.Type != tasktypes.Event_EXIT { if e.Type != tasktypes.Event_EXIT {
continue continue evloop
} }
if e.ID == t.containerID && e.Pid == t.pid { if e.ID == t.containerID && e.Pid == t.pid {