vendor protobuf & grpc

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda 2020-02-25 14:27:11 +09:00
parent 9b4967bd6b
commit 8e448bb279
158 changed files with 12967 additions and 10634 deletions

View File

@ -31,11 +31,11 @@ At this point you can use `go` to checkout `containerd` in your `GOPATH`:
go get github.com/containerd/containerd go get github.com/containerd/containerd
``` ```
For proper results, install the `protoc` release into `/usr/local` on your build system. For example, the following commands will download and install the 3.5.0 release for a 64-bit Linux host: For proper results, install the `protoc` release into `/usr/local` on your build system. For example, the following commands will download and install the 3.11.4 release for a 64-bit Linux host:
``` ```
$ wget -c https://github.com/google/protobuf/releases/download/v3.5.0/protoc-3.5.0-linux-x86_64.zip $ wget -c https://github.com/google/protobuf/releases/download/v3.11.4/protoc-3.11.4-linux-x86_64.zip
$ sudo unzip protoc-3.5.0-linux-x86_64.zip -d /usr/local $ sudo unzip protoc-3.11.4-linux-x86_64.zip -d /usr/local
``` ```
`containerd` uses [Btrfs](https://en.wikipedia.org/wiki/Btrfs) it means that you `containerd` uses [Btrfs](https://en.wikipedia.org/wiki/Btrfs) it means that you

View File

@ -11,6 +11,7 @@ import (
types "github.com/gogo/protobuf/types" types "github.com/gogo/protobuf/types"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -24,7 +25,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type ContainerCreate struct { type ContainerCreate struct {
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
@ -48,7 +49,7 @@ func (m *ContainerCreate) XXX_Marshal(b []byte, deterministic bool) ([]byte, err
return xxx_messageInfo_ContainerCreate.Marshal(b, m, deterministic) return xxx_messageInfo_ContainerCreate.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -88,7 +89,7 @@ func (m *ContainerCreate_Runtime) XXX_Marshal(b []byte, deterministic bool) ([]b
return xxx_messageInfo_ContainerCreate_Runtime.Marshal(b, m, deterministic) return xxx_messageInfo_ContainerCreate_Runtime.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -130,7 +131,7 @@ func (m *ContainerUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, err
return xxx_messageInfo_ContainerUpdate.Marshal(b, m, deterministic) return xxx_messageInfo_ContainerUpdate.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -169,7 +170,7 @@ func (m *ContainerDelete) XXX_Marshal(b []byte, deterministic bool) ([]byte, err
return xxx_messageInfo_ContainerDelete.Marshal(b, m, deterministic) return xxx_messageInfo_ContainerDelete.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -325,7 +326,7 @@ func (m *ContainerDelete) Field(fieldpath []string) (string, bool) {
func (m *ContainerCreate) Marshal() (dAtA []byte, err error) { func (m *ContainerCreate) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -333,42 +334,52 @@ func (m *ContainerCreate) Marshal() (dAtA []byte, err error) {
} }
func (m *ContainerCreate) MarshalTo(dAtA []byte) (int, error) { func (m *ContainerCreate) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ContainerCreate) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ID) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintContainer(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ID)
}
if len(m.Image) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintContainer(dAtA, i, uint64(len(m.Image)))
i += copy(dAtA[i:], m.Image)
} }
if m.Runtime != nil { if m.Runtime != nil {
dAtA[i] = 0x1a {
i++ size, err := m.Runtime.MarshalToSizedBuffer(dAtA[:i])
i = encodeVarintContainer(dAtA, i, uint64(m.Runtime.Size())) if err != nil {
n1, err := m.Runtime.MarshalTo(dAtA[i:]) return 0, err
if err != nil { }
return 0, err i -= size
i = encodeVarintContainer(dAtA, i, uint64(size))
} }
i += n1 i--
dAtA[i] = 0x1a
} }
if m.XXX_unrecognized != nil { if len(m.Image) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Image)
copy(dAtA[i:], m.Image)
i = encodeVarintContainer(dAtA, i, uint64(len(m.Image)))
i--
dAtA[i] = 0x12
} }
return i, nil if len(m.ID) > 0 {
i -= len(m.ID)
copy(dAtA[i:], m.ID)
i = encodeVarintContainer(dAtA, i, uint64(len(m.ID)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *ContainerCreate_Runtime) Marshal() (dAtA []byte, err error) { func (m *ContainerCreate_Runtime) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -376,36 +387,45 @@ func (m *ContainerCreate_Runtime) Marshal() (dAtA []byte, err error) {
} }
func (m *ContainerCreate_Runtime) MarshalTo(dAtA []byte) (int, error) { func (m *ContainerCreate_Runtime) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ContainerCreate_Runtime) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Name) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintContainer(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
} }
if m.Options != nil { if m.Options != nil {
dAtA[i] = 0x12 {
i++ size, err := m.Options.MarshalToSizedBuffer(dAtA[:i])
i = encodeVarintContainer(dAtA, i, uint64(m.Options.Size())) if err != nil {
n2, err := m.Options.MarshalTo(dAtA[i:]) return 0, err
if err != nil { }
return 0, err i -= size
i = encodeVarintContainer(dAtA, i, uint64(size))
} }
i += n2 i--
dAtA[i] = 0x12
} }
if m.XXX_unrecognized != nil { if len(m.Name) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintContainer(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func (m *ContainerUpdate) Marshal() (dAtA []byte, err error) { func (m *ContainerUpdate) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -413,55 +433,66 @@ func (m *ContainerUpdate) Marshal() (dAtA []byte, err error) {
} }
func (m *ContainerUpdate) MarshalTo(dAtA []byte) (int, error) { func (m *ContainerUpdate) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ContainerUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ID) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintContainer(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ID)
}
if len(m.Image) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintContainer(dAtA, i, uint64(len(m.Image)))
i += copy(dAtA[i:], m.Image)
}
if len(m.Labels) > 0 {
for k, _ := range m.Labels {
dAtA[i] = 0x1a
i++
v := m.Labels[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 len(m.SnapshotKey) > 0 { if len(m.SnapshotKey) > 0 {
dAtA[i] = 0x22 i -= len(m.SnapshotKey)
i++ copy(dAtA[i:], m.SnapshotKey)
i = encodeVarintContainer(dAtA, i, uint64(len(m.SnapshotKey))) i = encodeVarintContainer(dAtA, i, uint64(len(m.SnapshotKey)))
i += copy(dAtA[i:], m.SnapshotKey) i--
dAtA[i] = 0x22
} }
if m.XXX_unrecognized != nil { if len(m.Labels) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) for k := range m.Labels {
v := m.Labels[k]
baseI := i
i -= len(v)
copy(dAtA[i:], v)
i = encodeVarintContainer(dAtA, i, uint64(len(v)))
i--
dAtA[i] = 0x12
i -= len(k)
copy(dAtA[i:], k)
i = encodeVarintContainer(dAtA, i, uint64(len(k)))
i--
dAtA[i] = 0xa
i = encodeVarintContainer(dAtA, i, uint64(baseI-i))
i--
dAtA[i] = 0x1a
}
} }
return i, nil if len(m.Image) > 0 {
i -= len(m.Image)
copy(dAtA[i:], m.Image)
i = encodeVarintContainer(dAtA, i, uint64(len(m.Image)))
i--
dAtA[i] = 0x12
}
if len(m.ID) > 0 {
i -= len(m.ID)
copy(dAtA[i:], m.ID)
i = encodeVarintContainer(dAtA, i, uint64(len(m.ID)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *ContainerDelete) Marshal() (dAtA []byte, err error) { func (m *ContainerDelete) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -469,30 +500,39 @@ func (m *ContainerDelete) Marshal() (dAtA []byte, err error) {
} }
func (m *ContainerDelete) MarshalTo(dAtA []byte) (int, error) { func (m *ContainerDelete) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ContainerDelete) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ID) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintContainer(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ID)
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if len(m.ID) > 0 {
i -= len(m.ID)
copy(dAtA[i:], m.ID)
i = encodeVarintContainer(dAtA, i, uint64(len(m.ID)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func encodeVarintContainer(dAtA []byte, offset int, v uint64) int { func encodeVarintContainer(dAtA []byte, offset int, v uint64) int {
offset -= sovContainer(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *ContainerCreate) Size() (n int) { func (m *ContainerCreate) Size() (n int) {
if m == nil { if m == nil {
@ -587,14 +627,7 @@ func (m *ContainerDelete) Size() (n int) {
} }
func sovContainer(x uint64) (n int) { func sovContainer(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozContainer(x uint64) (n int) { func sozContainer(x uint64) (n int) {
return sovContainer(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovContainer(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -1309,6 +1342,7 @@ func (m *ContainerDelete) Unmarshal(dAtA []byte) error {
func skipContainer(dAtA []byte) (n int, err error) { func skipContainer(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1340,10 +1374,8 @@ func skipContainer(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1364,55 +1396,30 @@ func skipContainer(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthContainer return 0, ErrInvalidLengthContainer
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthContainer
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowContainer
}
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 := skipContainer(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthContainer
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupContainer
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthContainer
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthContainer = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthContainer = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowContainer = fmt.Errorf("proto: integer overflow") ErrIntOverflowContainer = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupContainer = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -9,6 +9,7 @@ import (
github_com_opencontainers_go_digest "github.com/opencontainers/go-digest" github_com_opencontainers_go_digest "github.com/opencontainers/go-digest"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -22,7 +23,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type ContentDelete struct { type ContentDelete struct {
Digest github_com_opencontainers_go_digest.Digest `protobuf:"bytes,1,opt,name=digest,proto3,customtype=github.com/opencontainers/go-digest.Digest" json:"digest"` Digest github_com_opencontainers_go_digest.Digest `protobuf:"bytes,1,opt,name=digest,proto3,customtype=github.com/opencontainers/go-digest.Digest" json:"digest"`
@ -44,7 +45,7 @@ func (m *ContentDelete) XXX_Marshal(b []byte, deterministic bool) ([]byte, error
return xxx_messageInfo_ContentDelete.Marshal(b, m, deterministic) return xxx_messageInfo_ContentDelete.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -106,7 +107,7 @@ func (m *ContentDelete) Field(fieldpath []string) (string, bool) {
func (m *ContentDelete) Marshal() (dAtA []byte, err error) { func (m *ContentDelete) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -114,30 +115,39 @@ func (m *ContentDelete) Marshal() (dAtA []byte, err error) {
} }
func (m *ContentDelete) MarshalTo(dAtA []byte) (int, error) { func (m *ContentDelete) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ContentDelete) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Digest) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintContent(dAtA, i, uint64(len(m.Digest)))
i += copy(dAtA[i:], m.Digest)
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if len(m.Digest) > 0 {
i -= len(m.Digest)
copy(dAtA[i:], m.Digest)
i = encodeVarintContent(dAtA, i, uint64(len(m.Digest)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func encodeVarintContent(dAtA []byte, offset int, v uint64) int { func encodeVarintContent(dAtA []byte, offset int, v uint64) int {
offset -= sovContent(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *ContentDelete) Size() (n int) { func (m *ContentDelete) Size() (n int) {
if m == nil { if m == nil {
@ -156,14 +166,7 @@ func (m *ContentDelete) Size() (n int) {
} }
func sovContent(x uint64) (n int) { func sovContent(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozContent(x uint64) (n int) { func sozContent(x uint64) (n int) {
return sovContent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovContent(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -276,6 +279,7 @@ func (m *ContentDelete) Unmarshal(dAtA []byte) error {
func skipContent(dAtA []byte) (n int, err error) { func skipContent(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -307,10 +311,8 @@ func skipContent(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -331,55 +333,30 @@ func skipContent(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthContent return 0, ErrInvalidLengthContent
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthContent
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowContent
}
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 := skipContent(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthContent
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupContent
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthContent
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthContent = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthContent = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowContent = fmt.Errorf("proto: integer overflow") ErrIntOverflowContent = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupContent = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -9,6 +9,7 @@ import (
github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -22,7 +23,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type ImageCreate struct { type ImageCreate struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
@ -45,7 +46,7 @@ func (m *ImageCreate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return xxx_messageInfo_ImageCreate.Marshal(b, m, deterministic) return xxx_messageInfo_ImageCreate.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -85,7 +86,7 @@ func (m *ImageUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return xxx_messageInfo_ImageUpdate.Marshal(b, m, deterministic) return xxx_messageInfo_ImageUpdate.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -124,7 +125,7 @@ func (m *ImageDelete) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return xxx_messageInfo_ImageDelete.Marshal(b, m, deterministic) return xxx_messageInfo_ImageDelete.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -238,7 +239,7 @@ func (m *ImageDelete) Field(fieldpath []string) (string, bool) {
func (m *ImageCreate) Marshal() (dAtA []byte, err error) { func (m *ImageCreate) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -246,43 +247,52 @@ func (m *ImageCreate) Marshal() (dAtA []byte, err error) {
} }
func (m *ImageCreate) MarshalTo(dAtA []byte) (int, error) { func (m *ImageCreate) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ImageCreate) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Name) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintImage(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
} }
if len(m.Labels) > 0 { if len(m.Labels) > 0 {
for k, _ := range m.Labels { for k := range m.Labels {
dAtA[i] = 0x12
i++
v := m.Labels[k] v := m.Labels[k]
mapSize := 1 + len(k) + sovImage(uint64(len(k))) + 1 + len(v) + sovImage(uint64(len(v))) baseI := i
i = encodeVarintImage(dAtA, i, uint64(mapSize)) i -= len(v)
dAtA[i] = 0xa copy(dAtA[i:], v)
i++
i = encodeVarintImage(dAtA, i, uint64(len(k)))
i += copy(dAtA[i:], k)
dAtA[i] = 0x12
i++
i = encodeVarintImage(dAtA, i, uint64(len(v))) i = encodeVarintImage(dAtA, i, uint64(len(v)))
i += copy(dAtA[i:], v) i--
dAtA[i] = 0x12
i -= len(k)
copy(dAtA[i:], k)
i = encodeVarintImage(dAtA, i, uint64(len(k)))
i--
dAtA[i] = 0xa
i = encodeVarintImage(dAtA, i, uint64(baseI-i))
i--
dAtA[i] = 0x12
} }
} }
if m.XXX_unrecognized != nil { if len(m.Name) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintImage(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func (m *ImageUpdate) Marshal() (dAtA []byte, err error) { func (m *ImageUpdate) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -290,43 +300,52 @@ func (m *ImageUpdate) Marshal() (dAtA []byte, err error) {
} }
func (m *ImageUpdate) MarshalTo(dAtA []byte) (int, error) { func (m *ImageUpdate) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ImageUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Name) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintImage(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
} }
if len(m.Labels) > 0 { if len(m.Labels) > 0 {
for k, _ := range m.Labels { for k := range m.Labels {
dAtA[i] = 0x12
i++
v := m.Labels[k] v := m.Labels[k]
mapSize := 1 + len(k) + sovImage(uint64(len(k))) + 1 + len(v) + sovImage(uint64(len(v))) baseI := i
i = encodeVarintImage(dAtA, i, uint64(mapSize)) i -= len(v)
dAtA[i] = 0xa copy(dAtA[i:], v)
i++
i = encodeVarintImage(dAtA, i, uint64(len(k)))
i += copy(dAtA[i:], k)
dAtA[i] = 0x12
i++
i = encodeVarintImage(dAtA, i, uint64(len(v))) i = encodeVarintImage(dAtA, i, uint64(len(v)))
i += copy(dAtA[i:], v) i--
dAtA[i] = 0x12
i -= len(k)
copy(dAtA[i:], k)
i = encodeVarintImage(dAtA, i, uint64(len(k)))
i--
dAtA[i] = 0xa
i = encodeVarintImage(dAtA, i, uint64(baseI-i))
i--
dAtA[i] = 0x12
} }
} }
if m.XXX_unrecognized != nil { if len(m.Name) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintImage(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func (m *ImageDelete) Marshal() (dAtA []byte, err error) { func (m *ImageDelete) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -334,30 +353,39 @@ func (m *ImageDelete) Marshal() (dAtA []byte, err error) {
} }
func (m *ImageDelete) MarshalTo(dAtA []byte) (int, error) { func (m *ImageDelete) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ImageDelete) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Name) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintImage(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if len(m.Name) > 0 {
i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintImage(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func encodeVarintImage(dAtA []byte, offset int, v uint64) int { func encodeVarintImage(dAtA []byte, offset int, v uint64) int {
offset -= sovImage(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *ImageCreate) Size() (n int) { func (m *ImageCreate) Size() (n int) {
if m == nil { if m == nil {
@ -424,14 +452,7 @@ func (m *ImageDelete) Size() (n int) {
} }
func sovImage(x uint64) (n int) { func sovImage(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozImage(x uint64) (n int) { func sozImage(x uint64) (n int) {
return sovImage(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovImage(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -1014,6 +1035,7 @@ func (m *ImageDelete) Unmarshal(dAtA []byte) error {
func skipImage(dAtA []byte) (n int, err error) { func skipImage(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1045,10 +1067,8 @@ func skipImage(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1069,55 +1089,30 @@ func skipImage(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthImage return 0, ErrInvalidLengthImage
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthImage
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowImage
}
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 := skipImage(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthImage
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupImage
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthImage
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthImage = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthImage = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowImage = fmt.Errorf("proto: integer overflow") ErrIntOverflowImage = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupImage = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -9,6 +9,7 @@ import (
github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -22,7 +23,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type NamespaceCreate struct { type NamespaceCreate struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
@ -45,7 +46,7 @@ func (m *NamespaceCreate) XXX_Marshal(b []byte, deterministic bool) ([]byte, err
return xxx_messageInfo_NamespaceCreate.Marshal(b, m, deterministic) return xxx_messageInfo_NamespaceCreate.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -85,7 +86,7 @@ func (m *NamespaceUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, err
return xxx_messageInfo_NamespaceUpdate.Marshal(b, m, deterministic) return xxx_messageInfo_NamespaceUpdate.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -124,7 +125,7 @@ func (m *NamespaceDelete) XXX_Marshal(b []byte, deterministic bool) ([]byte, err
return xxx_messageInfo_NamespaceDelete.Marshal(b, m, deterministic) return xxx_messageInfo_NamespaceDelete.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -238,7 +239,7 @@ func (m *NamespaceDelete) Field(fieldpath []string) (string, bool) {
func (m *NamespaceCreate) Marshal() (dAtA []byte, err error) { func (m *NamespaceCreate) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -246,43 +247,52 @@ func (m *NamespaceCreate) Marshal() (dAtA []byte, err error) {
} }
func (m *NamespaceCreate) MarshalTo(dAtA []byte) (int, error) { func (m *NamespaceCreate) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *NamespaceCreate) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Name) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintNamespace(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
} }
if len(m.Labels) > 0 { if len(m.Labels) > 0 {
for k, _ := range m.Labels { for k := range m.Labels {
dAtA[i] = 0x12
i++
v := m.Labels[k] v := m.Labels[k]
mapSize := 1 + len(k) + sovNamespace(uint64(len(k))) + 1 + len(v) + sovNamespace(uint64(len(v))) baseI := i
i = encodeVarintNamespace(dAtA, i, uint64(mapSize)) i -= len(v)
dAtA[i] = 0xa copy(dAtA[i:], v)
i++
i = encodeVarintNamespace(dAtA, i, uint64(len(k)))
i += copy(dAtA[i:], k)
dAtA[i] = 0x12
i++
i = encodeVarintNamespace(dAtA, i, uint64(len(v))) i = encodeVarintNamespace(dAtA, i, uint64(len(v)))
i += copy(dAtA[i:], v) i--
dAtA[i] = 0x12
i -= len(k)
copy(dAtA[i:], k)
i = encodeVarintNamespace(dAtA, i, uint64(len(k)))
i--
dAtA[i] = 0xa
i = encodeVarintNamespace(dAtA, i, uint64(baseI-i))
i--
dAtA[i] = 0x12
} }
} }
if m.XXX_unrecognized != nil { if len(m.Name) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintNamespace(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func (m *NamespaceUpdate) Marshal() (dAtA []byte, err error) { func (m *NamespaceUpdate) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -290,43 +300,52 @@ func (m *NamespaceUpdate) Marshal() (dAtA []byte, err error) {
} }
func (m *NamespaceUpdate) MarshalTo(dAtA []byte) (int, error) { func (m *NamespaceUpdate) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *NamespaceUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Name) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintNamespace(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
} }
if len(m.Labels) > 0 { if len(m.Labels) > 0 {
for k, _ := range m.Labels { for k := range m.Labels {
dAtA[i] = 0x12
i++
v := m.Labels[k] v := m.Labels[k]
mapSize := 1 + len(k) + sovNamespace(uint64(len(k))) + 1 + len(v) + sovNamespace(uint64(len(v))) baseI := i
i = encodeVarintNamespace(dAtA, i, uint64(mapSize)) i -= len(v)
dAtA[i] = 0xa copy(dAtA[i:], v)
i++
i = encodeVarintNamespace(dAtA, i, uint64(len(k)))
i += copy(dAtA[i:], k)
dAtA[i] = 0x12
i++
i = encodeVarintNamespace(dAtA, i, uint64(len(v))) i = encodeVarintNamespace(dAtA, i, uint64(len(v)))
i += copy(dAtA[i:], v) i--
dAtA[i] = 0x12
i -= len(k)
copy(dAtA[i:], k)
i = encodeVarintNamespace(dAtA, i, uint64(len(k)))
i--
dAtA[i] = 0xa
i = encodeVarintNamespace(dAtA, i, uint64(baseI-i))
i--
dAtA[i] = 0x12
} }
} }
if m.XXX_unrecognized != nil { if len(m.Name) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintNamespace(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func (m *NamespaceDelete) Marshal() (dAtA []byte, err error) { func (m *NamespaceDelete) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -334,30 +353,39 @@ func (m *NamespaceDelete) Marshal() (dAtA []byte, err error) {
} }
func (m *NamespaceDelete) MarshalTo(dAtA []byte) (int, error) { func (m *NamespaceDelete) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *NamespaceDelete) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Name) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintNamespace(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if len(m.Name) > 0 {
i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintNamespace(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func encodeVarintNamespace(dAtA []byte, offset int, v uint64) int { func encodeVarintNamespace(dAtA []byte, offset int, v uint64) int {
offset -= sovNamespace(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *NamespaceCreate) Size() (n int) { func (m *NamespaceCreate) Size() (n int) {
if m == nil { if m == nil {
@ -424,14 +452,7 @@ func (m *NamespaceDelete) Size() (n int) {
} }
func sovNamespace(x uint64) (n int) { func sovNamespace(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozNamespace(x uint64) (n int) { func sozNamespace(x uint64) (n int) {
return sovNamespace(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovNamespace(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -1014,6 +1035,7 @@ func (m *NamespaceDelete) Unmarshal(dAtA []byte) error {
func skipNamespace(dAtA []byte) (n int, err error) { func skipNamespace(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1045,10 +1067,8 @@ func skipNamespace(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1069,55 +1089,30 @@ func skipNamespace(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthNamespace return 0, ErrInvalidLengthNamespace
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthNamespace
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowNamespace
}
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 := skipNamespace(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthNamespace
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupNamespace
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthNamespace
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthNamespace = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthNamespace = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowNamespace = fmt.Errorf("proto: integer overflow") ErrIntOverflowNamespace = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupNamespace = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -8,6 +8,7 @@ import (
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -21,7 +22,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type SnapshotPrepare struct { type SnapshotPrepare struct {
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
@ -44,7 +45,7 @@ func (m *SnapshotPrepare) XXX_Marshal(b []byte, deterministic bool) ([]byte, err
return xxx_messageInfo_SnapshotPrepare.Marshal(b, m, deterministic) return xxx_messageInfo_SnapshotPrepare.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -84,7 +85,7 @@ func (m *SnapshotCommit) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro
return xxx_messageInfo_SnapshotCommit.Marshal(b, m, deterministic) return xxx_messageInfo_SnapshotCommit.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -123,7 +124,7 @@ func (m *SnapshotRemove) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro
return xxx_messageInfo_SnapshotRemove.Marshal(b, m, deterministic) return xxx_messageInfo_SnapshotRemove.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -219,7 +220,7 @@ func (m *SnapshotRemove) Field(fieldpath []string) (string, bool) {
func (m *SnapshotPrepare) Marshal() (dAtA []byte, err error) { func (m *SnapshotPrepare) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -227,32 +228,40 @@ func (m *SnapshotPrepare) Marshal() (dAtA []byte, err error) {
} }
func (m *SnapshotPrepare) MarshalTo(dAtA []byte) (int, error) { func (m *SnapshotPrepare) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *SnapshotPrepare) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Key) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintSnapshot(dAtA, i, uint64(len(m.Key)))
i += copy(dAtA[i:], m.Key)
} }
if len(m.Parent) > 0 { if len(m.Parent) > 0 {
dAtA[i] = 0x12 i -= len(m.Parent)
i++ copy(dAtA[i:], m.Parent)
i = encodeVarintSnapshot(dAtA, i, uint64(len(m.Parent))) i = encodeVarintSnapshot(dAtA, i, uint64(len(m.Parent)))
i += copy(dAtA[i:], m.Parent) i--
dAtA[i] = 0x12
} }
if m.XXX_unrecognized != nil { if len(m.Key) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Key)
copy(dAtA[i:], m.Key)
i = encodeVarintSnapshot(dAtA, i, uint64(len(m.Key)))
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func (m *SnapshotCommit) Marshal() (dAtA []byte, err error) { func (m *SnapshotCommit) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -260,32 +269,40 @@ func (m *SnapshotCommit) Marshal() (dAtA []byte, err error) {
} }
func (m *SnapshotCommit) MarshalTo(dAtA []byte) (int, error) { func (m *SnapshotCommit) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *SnapshotCommit) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Key) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintSnapshot(dAtA, i, uint64(len(m.Key)))
i += copy(dAtA[i:], m.Key)
} }
if len(m.Name) > 0 { if len(m.Name) > 0 {
dAtA[i] = 0x12 i -= len(m.Name)
i++ copy(dAtA[i:], m.Name)
i = encodeVarintSnapshot(dAtA, i, uint64(len(m.Name))) i = encodeVarintSnapshot(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name) i--
dAtA[i] = 0x12
} }
if m.XXX_unrecognized != nil { if len(m.Key) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Key)
copy(dAtA[i:], m.Key)
i = encodeVarintSnapshot(dAtA, i, uint64(len(m.Key)))
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func (m *SnapshotRemove) Marshal() (dAtA []byte, err error) { func (m *SnapshotRemove) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -293,30 +310,39 @@ func (m *SnapshotRemove) Marshal() (dAtA []byte, err error) {
} }
func (m *SnapshotRemove) MarshalTo(dAtA []byte) (int, error) { func (m *SnapshotRemove) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *SnapshotRemove) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Key) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintSnapshot(dAtA, i, uint64(len(m.Key)))
i += copy(dAtA[i:], m.Key)
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if len(m.Key) > 0 {
i -= len(m.Key)
copy(dAtA[i:], m.Key)
i = encodeVarintSnapshot(dAtA, i, uint64(len(m.Key)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func encodeVarintSnapshot(dAtA []byte, offset int, v uint64) int { func encodeVarintSnapshot(dAtA []byte, offset int, v uint64) int {
offset -= sovSnapshot(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *SnapshotPrepare) Size() (n int) { func (m *SnapshotPrepare) Size() (n int) {
if m == nil { if m == nil {
@ -375,14 +401,7 @@ func (m *SnapshotRemove) Size() (n int) {
} }
func sovSnapshot(x uint64) (n int) { func sovSnapshot(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozSnapshot(x uint64) (n int) { func sozSnapshot(x uint64) (n int) {
return sovSnapshot(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovSnapshot(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -755,6 +774,7 @@ func (m *SnapshotRemove) Unmarshal(dAtA []byte) error {
func skipSnapshot(dAtA []byte) (n int, err error) { func skipSnapshot(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -786,10 +806,8 @@ func skipSnapshot(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -810,55 +828,30 @@ func skipSnapshot(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthSnapshot return 0, ErrInvalidLengthSnapshot
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthSnapshot
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowSnapshot
}
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 := skipSnapshot(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthSnapshot
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupSnapshot
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthSnapshot
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthSnapshot = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthSnapshot = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowSnapshot = fmt.Errorf("proto: integer overflow") ErrIntOverflowSnapshot = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupSnapshot = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -11,6 +11,7 @@ import (
github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
time "time" time "time"
@ -26,7 +27,7 @@ var _ = time.Kitchen
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type TaskCreate struct { type TaskCreate struct {
ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
@ -53,7 +54,7 @@ func (m *TaskCreate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TaskCreate.Marshal(b, m, deterministic) return xxx_messageInfo_TaskCreate.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -93,7 +94,7 @@ func (m *TaskStart) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TaskStart.Marshal(b, m, deterministic) return xxx_messageInfo_TaskStart.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -138,7 +139,7 @@ func (m *TaskDelete) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TaskDelete.Marshal(b, m, deterministic) return xxx_messageInfo_TaskDelete.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -180,7 +181,7 @@ func (m *TaskIO) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TaskIO.Marshal(b, m, deterministic) return xxx_messageInfo_TaskIO.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -223,7 +224,7 @@ func (m *TaskExit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TaskExit.Marshal(b, m, deterministic) return xxx_messageInfo_TaskExit.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -262,7 +263,7 @@ func (m *TaskOOM) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TaskOOM.Marshal(b, m, deterministic) return xxx_messageInfo_TaskOOM.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -302,7 +303,7 @@ func (m *TaskExecAdded) XXX_Marshal(b []byte, deterministic bool) ([]byte, error
return xxx_messageInfo_TaskExecAdded.Marshal(b, m, deterministic) return xxx_messageInfo_TaskExecAdded.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -343,7 +344,7 @@ func (m *TaskExecStarted) XXX_Marshal(b []byte, deterministic bool) ([]byte, err
return xxx_messageInfo_TaskExecStarted.Marshal(b, m, deterministic) return xxx_messageInfo_TaskExecStarted.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -382,7 +383,7 @@ func (m *TaskPaused) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TaskPaused.Marshal(b, m, deterministic) return xxx_messageInfo_TaskPaused.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -421,7 +422,7 @@ func (m *TaskResumed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return xxx_messageInfo_TaskResumed.Marshal(b, m, deterministic) return xxx_messageInfo_TaskResumed.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -461,7 +462,7 @@ func (m *TaskCheckpointed) XXX_Marshal(b []byte, deterministic bool) ([]byte, er
return xxx_messageInfo_TaskCheckpointed.Marshal(b, m, deterministic) return xxx_messageInfo_TaskCheckpointed.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -741,7 +742,7 @@ func (m *TaskCheckpointed) Field(fieldpath []string) (string, bool) {
func (m *TaskCreate) Marshal() (dAtA []byte, err error) { func (m *TaskCreate) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -749,65 +750,78 @@ func (m *TaskCreate) Marshal() (dAtA []byte, err error) {
} }
func (m *TaskCreate) MarshalTo(dAtA []byte) (int, error) { func (m *TaskCreate) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *TaskCreate) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ContainerID) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
i += copy(dAtA[i:], m.ContainerID)
} }
if len(m.Bundle) > 0 { if m.Pid != 0 {
dAtA[i] = 0x12 i = encodeVarintTask(dAtA, i, uint64(m.Pid))
i++ i--
i = encodeVarintTask(dAtA, i, uint64(len(m.Bundle))) dAtA[i] = 0x30
i += copy(dAtA[i:], m.Bundle)
} }
if len(m.Rootfs) > 0 { if len(m.Checkpoint) > 0 {
for _, msg := range m.Rootfs { i -= len(m.Checkpoint)
dAtA[i] = 0x1a copy(dAtA[i:], m.Checkpoint)
i++ i = encodeVarintTask(dAtA, i, uint64(len(m.Checkpoint)))
i = encodeVarintTask(dAtA, i, uint64(msg.Size())) i--
n, err := msg.MarshalTo(dAtA[i:]) dAtA[i] = 0x2a
}
if m.IO != nil {
{
size, err := m.IO.MarshalToSizedBuffer(dAtA[:i])
if err != nil { if err != nil {
return 0, err return 0, err
} }
i += n i -= size
i = encodeVarintTask(dAtA, i, uint64(size))
} }
} i--
if m.IO != nil {
dAtA[i] = 0x22 dAtA[i] = 0x22
i++ }
i = encodeVarintTask(dAtA, i, uint64(m.IO.Size())) if len(m.Rootfs) > 0 {
n1, err := m.IO.MarshalTo(dAtA[i:]) for iNdEx := len(m.Rootfs) - 1; iNdEx >= 0; iNdEx-- {
if err != nil { {
return 0, err size, err := m.Rootfs[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTask(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
} }
i += n1
} }
if len(m.Checkpoint) > 0 { if len(m.Bundle) > 0 {
dAtA[i] = 0x2a i -= len(m.Bundle)
i++ copy(dAtA[i:], m.Bundle)
i = encodeVarintTask(dAtA, i, uint64(len(m.Checkpoint))) i = encodeVarintTask(dAtA, i, uint64(len(m.Bundle)))
i += copy(dAtA[i:], m.Checkpoint) i--
dAtA[i] = 0x12
} }
if m.Pid != 0 { if len(m.ContainerID) > 0 {
dAtA[i] = 0x30 i -= len(m.ContainerID)
i++ copy(dAtA[i:], m.ContainerID)
i = encodeVarintTask(dAtA, i, uint64(m.Pid)) i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
i--
dAtA[i] = 0xa
} }
if m.XXX_unrecognized != nil { return len(dAtA) - i, nil
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
} }
func (m *TaskStart) Marshal() (dAtA []byte, err error) { func (m *TaskStart) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -815,31 +829,38 @@ func (m *TaskStart) Marshal() (dAtA []byte, err error) {
} }
func (m *TaskStart) MarshalTo(dAtA []byte) (int, error) { func (m *TaskStart) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *TaskStart) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ContainerID) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
i += copy(dAtA[i:], m.ContainerID)
} }
if m.Pid != 0 { if m.Pid != 0 {
dAtA[i] = 0x10
i++
i = encodeVarintTask(dAtA, i, uint64(m.Pid)) i = encodeVarintTask(dAtA, i, uint64(m.Pid))
i--
dAtA[i] = 0x10
} }
if m.XXX_unrecognized != nil { if len(m.ContainerID) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.ContainerID)
copy(dAtA[i:], m.ContainerID)
i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func (m *TaskDelete) Marshal() (dAtA []byte, err error) { func (m *TaskDelete) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -847,50 +868,58 @@ func (m *TaskDelete) Marshal() (dAtA []byte, err error) {
} }
func (m *TaskDelete) MarshalTo(dAtA []byte) (int, error) { func (m *TaskDelete) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *TaskDelete) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ContainerID) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID))) }
i += copy(dAtA[i:], m.ContainerID) if len(m.ID) > 0 {
i -= len(m.ID)
copy(dAtA[i:], m.ID)
i = encodeVarintTask(dAtA, i, uint64(len(m.ID)))
i--
dAtA[i] = 0x2a
}
n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt):])
if err2 != nil {
return 0, err2
}
i -= n2
i = encodeVarintTask(dAtA, i, uint64(n2))
i--
dAtA[i] = 0x22
if m.ExitStatus != 0 {
i = encodeVarintTask(dAtA, i, uint64(m.ExitStatus))
i--
dAtA[i] = 0x18
} }
if m.Pid != 0 { if m.Pid != 0 {
dAtA[i] = 0x10
i++
i = encodeVarintTask(dAtA, i, uint64(m.Pid)) i = encodeVarintTask(dAtA, i, uint64(m.Pid))
i--
dAtA[i] = 0x10
} }
if m.ExitStatus != 0 { if len(m.ContainerID) > 0 {
dAtA[i] = 0x18 i -= len(m.ContainerID)
i++ copy(dAtA[i:], m.ContainerID)
i = encodeVarintTask(dAtA, i, uint64(m.ExitStatus)) i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
i--
dAtA[i] = 0xa
} }
dAtA[i] = 0x22 return len(dAtA) - i, nil
i++
i = encodeVarintTask(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt)))
n2, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i:])
if err != nil {
return 0, err
}
i += n2
if len(m.ID) > 0 {
dAtA[i] = 0x2a
i++
i = encodeVarintTask(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ID)
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
} }
func (m *TaskIO) Marshal() (dAtA []byte, err error) { func (m *TaskIO) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -898,48 +927,57 @@ func (m *TaskIO) Marshal() (dAtA []byte, err error) {
} }
func (m *TaskIO) MarshalTo(dAtA []byte) (int, error) { func (m *TaskIO) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *TaskIO) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Stdin) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintTask(dAtA, i, uint64(len(m.Stdin)))
i += copy(dAtA[i:], m.Stdin)
}
if len(m.Stdout) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintTask(dAtA, i, uint64(len(m.Stdout)))
i += copy(dAtA[i:], m.Stdout)
}
if len(m.Stderr) > 0 {
dAtA[i] = 0x1a
i++
i = encodeVarintTask(dAtA, i, uint64(len(m.Stderr)))
i += copy(dAtA[i:], m.Stderr)
} }
if m.Terminal { if m.Terminal {
dAtA[i] = 0x20 i--
i++
if m.Terminal { if m.Terminal {
dAtA[i] = 1 dAtA[i] = 1
} else { } else {
dAtA[i] = 0 dAtA[i] = 0
} }
i++ i--
dAtA[i] = 0x20
} }
if m.XXX_unrecognized != nil { if len(m.Stderr) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Stderr)
copy(dAtA[i:], m.Stderr)
i = encodeVarintTask(dAtA, i, uint64(len(m.Stderr)))
i--
dAtA[i] = 0x1a
} }
return i, nil if len(m.Stdout) > 0 {
i -= len(m.Stdout)
copy(dAtA[i:], m.Stdout)
i = encodeVarintTask(dAtA, i, uint64(len(m.Stdout)))
i--
dAtA[i] = 0x12
}
if len(m.Stdin) > 0 {
i -= len(m.Stdin)
copy(dAtA[i:], m.Stdin)
i = encodeVarintTask(dAtA, i, uint64(len(m.Stdin)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *TaskExit) Marshal() (dAtA []byte, err error) { func (m *TaskExit) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -947,50 +985,58 @@ func (m *TaskExit) Marshal() (dAtA []byte, err error) {
} }
func (m *TaskExit) MarshalTo(dAtA []byte) (int, error) { func (m *TaskExit) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *TaskExit) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ContainerID) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
i += copy(dAtA[i:], m.ContainerID)
} }
if len(m.ID) > 0 { n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt):])
dAtA[i] = 0x12 if err3 != nil {
i++ return 0, err3
i = encodeVarintTask(dAtA, i, uint64(len(m.ID))) }
i += copy(dAtA[i:], m.ID) i -= n3
i = encodeVarintTask(dAtA, i, uint64(n3))
i--
dAtA[i] = 0x2a
if m.ExitStatus != 0 {
i = encodeVarintTask(dAtA, i, uint64(m.ExitStatus))
i--
dAtA[i] = 0x20
} }
if m.Pid != 0 { if m.Pid != 0 {
dAtA[i] = 0x18
i++
i = encodeVarintTask(dAtA, i, uint64(m.Pid)) i = encodeVarintTask(dAtA, i, uint64(m.Pid))
i--
dAtA[i] = 0x18
} }
if m.ExitStatus != 0 { if len(m.ID) > 0 {
dAtA[i] = 0x20 i -= len(m.ID)
i++ copy(dAtA[i:], m.ID)
i = encodeVarintTask(dAtA, i, uint64(m.ExitStatus)) i = encodeVarintTask(dAtA, i, uint64(len(m.ID)))
i--
dAtA[i] = 0x12
} }
dAtA[i] = 0x2a if len(m.ContainerID) > 0 {
i++ i -= len(m.ContainerID)
i = encodeVarintTask(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt))) copy(dAtA[i:], m.ContainerID)
n3, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i:]) i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
if err != nil { i--
return 0, err dAtA[i] = 0xa
} }
i += n3 return len(dAtA) - i, nil
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
} }
func (m *TaskOOM) Marshal() (dAtA []byte, err error) { func (m *TaskOOM) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -998,26 +1044,33 @@ func (m *TaskOOM) Marshal() (dAtA []byte, err error) {
} }
func (m *TaskOOM) MarshalTo(dAtA []byte) (int, error) { func (m *TaskOOM) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *TaskOOM) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ContainerID) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
i += copy(dAtA[i:], m.ContainerID)
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if len(m.ContainerID) > 0 {
i -= len(m.ContainerID)
copy(dAtA[i:], m.ContainerID)
i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *TaskExecAdded) Marshal() (dAtA []byte, err error) { func (m *TaskExecAdded) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1025,32 +1078,40 @@ func (m *TaskExecAdded) Marshal() (dAtA []byte, err error) {
} }
func (m *TaskExecAdded) MarshalTo(dAtA []byte) (int, error) { func (m *TaskExecAdded) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *TaskExecAdded) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ContainerID) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
i += copy(dAtA[i:], m.ContainerID)
} }
if len(m.ExecID) > 0 { if len(m.ExecID) > 0 {
dAtA[i] = 0x12 i -= len(m.ExecID)
i++ copy(dAtA[i:], m.ExecID)
i = encodeVarintTask(dAtA, i, uint64(len(m.ExecID))) i = encodeVarintTask(dAtA, i, uint64(len(m.ExecID)))
i += copy(dAtA[i:], m.ExecID) i--
dAtA[i] = 0x12
} }
if m.XXX_unrecognized != nil { if len(m.ContainerID) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.ContainerID)
copy(dAtA[i:], m.ContainerID)
i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func (m *TaskExecStarted) Marshal() (dAtA []byte, err error) { func (m *TaskExecStarted) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1058,37 +1119,45 @@ func (m *TaskExecStarted) Marshal() (dAtA []byte, err error) {
} }
func (m *TaskExecStarted) MarshalTo(dAtA []byte) (int, error) { func (m *TaskExecStarted) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *TaskExecStarted) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ContainerID) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
i += copy(dAtA[i:], m.ContainerID)
}
if len(m.ExecID) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintTask(dAtA, i, uint64(len(m.ExecID)))
i += copy(dAtA[i:], m.ExecID)
} }
if m.Pid != 0 { if m.Pid != 0 {
dAtA[i] = 0x18
i++
i = encodeVarintTask(dAtA, i, uint64(m.Pid)) i = encodeVarintTask(dAtA, i, uint64(m.Pid))
i--
dAtA[i] = 0x18
} }
if m.XXX_unrecognized != nil { if len(m.ExecID) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.ExecID)
copy(dAtA[i:], m.ExecID)
i = encodeVarintTask(dAtA, i, uint64(len(m.ExecID)))
i--
dAtA[i] = 0x12
} }
return i, nil if len(m.ContainerID) > 0 {
i -= len(m.ContainerID)
copy(dAtA[i:], m.ContainerID)
i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *TaskPaused) Marshal() (dAtA []byte, err error) { func (m *TaskPaused) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1096,26 +1165,33 @@ func (m *TaskPaused) Marshal() (dAtA []byte, err error) {
} }
func (m *TaskPaused) MarshalTo(dAtA []byte) (int, error) { func (m *TaskPaused) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *TaskPaused) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ContainerID) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
i += copy(dAtA[i:], m.ContainerID)
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if len(m.ContainerID) > 0 {
i -= len(m.ContainerID)
copy(dAtA[i:], m.ContainerID)
i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *TaskResumed) Marshal() (dAtA []byte, err error) { func (m *TaskResumed) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1123,26 +1199,33 @@ func (m *TaskResumed) Marshal() (dAtA []byte, err error) {
} }
func (m *TaskResumed) MarshalTo(dAtA []byte) (int, error) { func (m *TaskResumed) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *TaskResumed) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ContainerID) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
i += copy(dAtA[i:], m.ContainerID)
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if len(m.ContainerID) > 0 {
i -= len(m.ContainerID)
copy(dAtA[i:], m.ContainerID)
i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *TaskCheckpointed) Marshal() (dAtA []byte, err error) { func (m *TaskCheckpointed) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1150,36 +1233,46 @@ func (m *TaskCheckpointed) Marshal() (dAtA []byte, err error) {
} }
func (m *TaskCheckpointed) MarshalTo(dAtA []byte) (int, error) { func (m *TaskCheckpointed) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *TaskCheckpointed) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ContainerID) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
i += copy(dAtA[i:], m.ContainerID)
} }
if len(m.Checkpoint) > 0 { if len(m.Checkpoint) > 0 {
dAtA[i] = 0x12 i -= len(m.Checkpoint)
i++ copy(dAtA[i:], m.Checkpoint)
i = encodeVarintTask(dAtA, i, uint64(len(m.Checkpoint))) i = encodeVarintTask(dAtA, i, uint64(len(m.Checkpoint)))
i += copy(dAtA[i:], m.Checkpoint) i--
dAtA[i] = 0x12
} }
if m.XXX_unrecognized != nil { if len(m.ContainerID) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.ContainerID)
copy(dAtA[i:], m.ContainerID)
i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func encodeVarintTask(dAtA []byte, offset int, v uint64) int { func encodeVarintTask(dAtA []byte, offset int, v uint64) int {
offset -= sovTask(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *TaskCreate) Size() (n int) { func (m *TaskCreate) Size() (n int) {
if m == nil { if m == nil {
@ -1432,14 +1525,7 @@ func (m *TaskCheckpointed) Size() (n int) {
} }
func sovTask(x uint64) (n int) { func sovTask(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozTask(x uint64) (n int) { func sozTask(x uint64) (n int) {
return sovTask(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovTask(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -1448,11 +1534,16 @@ func (this *TaskCreate) String() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
repeatedStringForRootfs := "[]*Mount{"
for _, f := range this.Rootfs {
repeatedStringForRootfs += strings.Replace(fmt.Sprintf("%v", f), "Mount", "types.Mount", 1) + ","
}
repeatedStringForRootfs += "}"
s := strings.Join([]string{`&TaskCreate{`, s := strings.Join([]string{`&TaskCreate{`,
`ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`,
`Bundle:` + fmt.Sprintf("%v", this.Bundle) + `,`, `Bundle:` + fmt.Sprintf("%v", this.Bundle) + `,`,
`Rootfs:` + strings.Replace(fmt.Sprintf("%v", this.Rootfs), "Mount", "types.Mount", 1) + `,`, `Rootfs:` + repeatedStringForRootfs + `,`,
`IO:` + strings.Replace(fmt.Sprintf("%v", this.IO), "TaskIO", "TaskIO", 1) + `,`, `IO:` + strings.Replace(this.IO.String(), "TaskIO", "TaskIO", 1) + `,`,
`Checkpoint:` + fmt.Sprintf("%v", this.Checkpoint) + `,`, `Checkpoint:` + fmt.Sprintf("%v", this.Checkpoint) + `,`,
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
@ -1480,7 +1571,7 @@ func (this *TaskDelete) String() string {
`ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`,
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
`ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`,
`ExitedAt:` + strings.Replace(strings.Replace(this.ExitedAt.String(), "Timestamp", "types1.Timestamp", 1), `&`, ``, 1) + `,`, `ExitedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ExitedAt), "Timestamp", "types1.Timestamp", 1), `&`, ``, 1) + `,`,
`ID:` + fmt.Sprintf("%v", this.ID) + `,`, `ID:` + fmt.Sprintf("%v", this.ID) + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`, `}`,
@ -1510,7 +1601,7 @@ func (this *TaskExit) String() string {
`ID:` + fmt.Sprintf("%v", this.ID) + `,`, `ID:` + fmt.Sprintf("%v", this.ID) + `,`,
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
`ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`,
`ExitedAt:` + strings.Replace(strings.Replace(this.ExitedAt.String(), "Timestamp", "types1.Timestamp", 1), `&`, ``, 1) + `,`, `ExitedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ExitedAt), "Timestamp", "types1.Timestamp", 1), `&`, ``, 1) + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`, `}`,
}, "") }, "")
@ -3120,6 +3211,7 @@ func (m *TaskCheckpointed) Unmarshal(dAtA []byte) error {
func skipTask(dAtA []byte) (n int, err error) { func skipTask(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -3151,10 +3243,8 @@ func skipTask(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -3175,55 +3265,30 @@ func skipTask(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthTask return 0, ErrInvalidLengthTask
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthTask
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTask
}
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 := skipTask(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthTask
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupTask
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthTask
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthTask = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthTask = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowTask = fmt.Errorf("proto: integer overflow") ErrIntOverflowTask = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupTask = fmt.Errorf("proto: unexpected end of group")
) )

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -11,8 +11,11 @@ import (
github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys"
types1 "github.com/gogo/protobuf/types" types1 "github.com/gogo/protobuf/types"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -26,7 +29,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type ApplyRequest struct { type ApplyRequest struct {
// Diff is the descriptor of the diff to be extracted // Diff is the descriptor of the diff to be extracted
@ -51,7 +54,7 @@ func (m *ApplyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return xxx_messageInfo_ApplyRequest.Marshal(b, m, deterministic) return xxx_messageInfo_ApplyRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -93,7 +96,7 @@ func (m *ApplyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error
return xxx_messageInfo_ApplyResponse.Marshal(b, m, deterministic) return xxx_messageInfo_ApplyResponse.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -146,7 +149,7 @@ func (m *DiffRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return xxx_messageInfo_DiffRequest.Marshal(b, m, deterministic) return xxx_messageInfo_DiffRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -186,7 +189,7 @@ func (m *DiffResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return xxx_messageInfo_DiffResponse.Marshal(b, m, deterministic) return xxx_messageInfo_DiffResponse.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -313,6 +316,17 @@ type DiffServer interface {
Diff(context.Context, *DiffRequest) (*DiffResponse, error) Diff(context.Context, *DiffRequest) (*DiffResponse, error)
} }
// UnimplementedDiffServer can be embedded to have forward compatible implementations.
type UnimplementedDiffServer struct {
}
func (*UnimplementedDiffServer) Apply(ctx context.Context, req *ApplyRequest) (*ApplyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Apply not implemented")
}
func (*UnimplementedDiffServer) Diff(ctx context.Context, req *DiffRequest) (*DiffResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Diff not implemented")
}
func RegisterDiffServer(s *grpc.Server, srv DiffServer) { func RegisterDiffServer(s *grpc.Server, srv DiffServer) {
s.RegisterService(&_Diff_serviceDesc, srv) s.RegisterService(&_Diff_serviceDesc, srv)
} }
@ -373,7 +387,7 @@ var _Diff_serviceDesc = grpc.ServiceDesc{
func (m *ApplyRequest) Marshal() (dAtA []byte, err error) { func (m *ApplyRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -381,70 +395,78 @@ func (m *ApplyRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *ApplyRequest) MarshalTo(dAtA []byte) (int, error) { func (m *ApplyRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ApplyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Diff != nil { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintDiff(dAtA, i, uint64(m.Diff.Size()))
n1, err := m.Diff.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n1
}
if len(m.Mounts) > 0 {
for _, msg := range m.Mounts {
dAtA[i] = 0x12
i++
i = encodeVarintDiff(dAtA, i, uint64(msg.Size()))
n, err := msg.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n
}
} }
if len(m.Payloads) > 0 { if len(m.Payloads) > 0 {
for k, _ := range m.Payloads { for k := range m.Payloads {
dAtA[i] = 0x1a
i++
v := m.Payloads[k] v := m.Payloads[k]
msgSize := 0 baseI := i
if v != nil {
msgSize = v.Size()
msgSize += 1 + sovDiff(uint64(msgSize))
}
mapSize := 1 + len(k) + sovDiff(uint64(len(k))) + msgSize
i = encodeVarintDiff(dAtA, i, uint64(mapSize))
dAtA[i] = 0xa
i++
i = encodeVarintDiff(dAtA, i, uint64(len(k)))
i += copy(dAtA[i:], k)
if v != nil { if v != nil {
{
size, err := v.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintDiff(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12 dAtA[i] = 0x12
i++ }
i = encodeVarintDiff(dAtA, i, uint64(v.Size())) i -= len(k)
n2, err := v.MarshalTo(dAtA[i:]) copy(dAtA[i:], k)
i = encodeVarintDiff(dAtA, i, uint64(len(k)))
i--
dAtA[i] = 0xa
i = encodeVarintDiff(dAtA, i, uint64(baseI-i))
i--
dAtA[i] = 0x1a
}
}
if len(m.Mounts) > 0 {
for iNdEx := len(m.Mounts) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Mounts[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil { if err != nil {
return 0, err return 0, err
} }
i += n2 i -= size
i = encodeVarintDiff(dAtA, i, uint64(size))
} }
i--
dAtA[i] = 0x12
} }
} }
if m.XXX_unrecognized != nil { if m.Diff != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) {
size, err := m.Diff.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintDiff(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func (m *ApplyResponse) Marshal() (dAtA []byte, err error) { func (m *ApplyResponse) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -452,30 +474,38 @@ func (m *ApplyResponse) Marshal() (dAtA []byte, err error) {
} }
func (m *ApplyResponse) MarshalTo(dAtA []byte) (int, error) { func (m *ApplyResponse) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ApplyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Applied != nil {
dAtA[i] = 0xa
i++
i = encodeVarintDiff(dAtA, i, uint64(m.Applied.Size()))
n3, err := m.Applied.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n3
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if m.Applied != nil {
{
size, err := m.Applied.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintDiff(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *DiffRequest) Marshal() (dAtA []byte, err error) { func (m *DiffRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -483,73 +513,87 @@ func (m *DiffRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *DiffRequest) MarshalTo(dAtA []byte) (int, error) { func (m *DiffRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *DiffRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Left) > 0 { if m.XXX_unrecognized != nil {
for _, msg := range m.Left { i -= len(m.XXX_unrecognized)
dAtA[i] = 0xa copy(dAtA[i:], m.XXX_unrecognized)
i++
i = encodeVarintDiff(dAtA, i, uint64(msg.Size()))
n, err := msg.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n
}
}
if len(m.Right) > 0 {
for _, msg := range m.Right {
dAtA[i] = 0x12
i++
i = encodeVarintDiff(dAtA, i, uint64(msg.Size()))
n, err := msg.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n
}
}
if len(m.MediaType) > 0 {
dAtA[i] = 0x1a
i++
i = encodeVarintDiff(dAtA, i, uint64(len(m.MediaType)))
i += copy(dAtA[i:], m.MediaType)
}
if len(m.Ref) > 0 {
dAtA[i] = 0x22
i++
i = encodeVarintDiff(dAtA, i, uint64(len(m.Ref)))
i += copy(dAtA[i:], m.Ref)
} }
if len(m.Labels) > 0 { if len(m.Labels) > 0 {
for k, _ := range m.Labels { for k := range m.Labels {
dAtA[i] = 0x2a
i++
v := m.Labels[k] v := m.Labels[k]
mapSize := 1 + len(k) + sovDiff(uint64(len(k))) + 1 + len(v) + sovDiff(uint64(len(v))) baseI := i
i = encodeVarintDiff(dAtA, i, uint64(mapSize)) i -= len(v)
dAtA[i] = 0xa copy(dAtA[i:], v)
i++
i = encodeVarintDiff(dAtA, i, uint64(len(k)))
i += copy(dAtA[i:], k)
dAtA[i] = 0x12
i++
i = encodeVarintDiff(dAtA, i, uint64(len(v))) i = encodeVarintDiff(dAtA, i, uint64(len(v)))
i += copy(dAtA[i:], v) i--
dAtA[i] = 0x12
i -= len(k)
copy(dAtA[i:], k)
i = encodeVarintDiff(dAtA, i, uint64(len(k)))
i--
dAtA[i] = 0xa
i = encodeVarintDiff(dAtA, i, uint64(baseI-i))
i--
dAtA[i] = 0x2a
} }
} }
if m.XXX_unrecognized != nil { if len(m.Ref) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Ref)
copy(dAtA[i:], m.Ref)
i = encodeVarintDiff(dAtA, i, uint64(len(m.Ref)))
i--
dAtA[i] = 0x22
} }
return i, nil if len(m.MediaType) > 0 {
i -= len(m.MediaType)
copy(dAtA[i:], m.MediaType)
i = encodeVarintDiff(dAtA, i, uint64(len(m.MediaType)))
i--
dAtA[i] = 0x1a
}
if len(m.Right) > 0 {
for iNdEx := len(m.Right) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Right[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintDiff(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
if len(m.Left) > 0 {
for iNdEx := len(m.Left) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Left[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintDiff(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
} }
func (m *DiffResponse) Marshal() (dAtA []byte, err error) { func (m *DiffResponse) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -557,34 +601,44 @@ func (m *DiffResponse) Marshal() (dAtA []byte, err error) {
} }
func (m *DiffResponse) MarshalTo(dAtA []byte) (int, error) { func (m *DiffResponse) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *DiffResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Diff != nil {
dAtA[i] = 0x1a
i++
i = encodeVarintDiff(dAtA, i, uint64(m.Diff.Size()))
n4, err := m.Diff.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n4
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if m.Diff != nil {
{
size, err := m.Diff.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintDiff(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
}
return len(dAtA) - i, nil
} }
func encodeVarintDiff(dAtA []byte, offset int, v uint64) int { func encodeVarintDiff(dAtA []byte, offset int, v uint64) int {
offset -= sovDiff(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *ApplyRequest) Size() (n int) { func (m *ApplyRequest) Size() (n int) {
if m == nil { if m == nil {
@ -694,14 +748,7 @@ func (m *DiffResponse) Size() (n int) {
} }
func sovDiff(x uint64) (n int) { func sovDiff(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozDiff(x uint64) (n int) { func sozDiff(x uint64) (n int) {
return sovDiff(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovDiff(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -710,6 +757,11 @@ func (this *ApplyRequest) String() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
repeatedStringForMounts := "[]*Mount{"
for _, f := range this.Mounts {
repeatedStringForMounts += strings.Replace(fmt.Sprintf("%v", f), "Mount", "types.Mount", 1) + ","
}
repeatedStringForMounts += "}"
keysForPayloads := make([]string, 0, len(this.Payloads)) keysForPayloads := make([]string, 0, len(this.Payloads))
for k, _ := range this.Payloads { for k, _ := range this.Payloads {
keysForPayloads = append(keysForPayloads, k) keysForPayloads = append(keysForPayloads, k)
@ -722,7 +774,7 @@ func (this *ApplyRequest) String() string {
mapStringForPayloads += "}" mapStringForPayloads += "}"
s := strings.Join([]string{`&ApplyRequest{`, s := strings.Join([]string{`&ApplyRequest{`,
`Diff:` + strings.Replace(fmt.Sprintf("%v", this.Diff), "Descriptor", "types.Descriptor", 1) + `,`, `Diff:` + strings.Replace(fmt.Sprintf("%v", this.Diff), "Descriptor", "types.Descriptor", 1) + `,`,
`Mounts:` + strings.Replace(fmt.Sprintf("%v", this.Mounts), "Mount", "types.Mount", 1) + `,`, `Mounts:` + repeatedStringForMounts + `,`,
`Payloads:` + mapStringForPayloads + `,`, `Payloads:` + mapStringForPayloads + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`, `}`,
@ -744,6 +796,16 @@ func (this *DiffRequest) String() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
repeatedStringForLeft := "[]*Mount{"
for _, f := range this.Left {
repeatedStringForLeft += strings.Replace(fmt.Sprintf("%v", f), "Mount", "types.Mount", 1) + ","
}
repeatedStringForLeft += "}"
repeatedStringForRight := "[]*Mount{"
for _, f := range this.Right {
repeatedStringForRight += strings.Replace(fmt.Sprintf("%v", f), "Mount", "types.Mount", 1) + ","
}
repeatedStringForRight += "}"
keysForLabels := make([]string, 0, len(this.Labels)) keysForLabels := make([]string, 0, len(this.Labels))
for k, _ := range this.Labels { for k, _ := range this.Labels {
keysForLabels = append(keysForLabels, k) keysForLabels = append(keysForLabels, k)
@ -755,8 +817,8 @@ func (this *DiffRequest) String() string {
} }
mapStringForLabels += "}" mapStringForLabels += "}"
s := strings.Join([]string{`&DiffRequest{`, s := strings.Join([]string{`&DiffRequest{`,
`Left:` + strings.Replace(fmt.Sprintf("%v", this.Left), "Mount", "types.Mount", 1) + `,`, `Left:` + repeatedStringForLeft + `,`,
`Right:` + strings.Replace(fmt.Sprintf("%v", this.Right), "Mount", "types.Mount", 1) + `,`, `Right:` + repeatedStringForRight + `,`,
`MediaType:` + fmt.Sprintf("%v", this.MediaType) + `,`, `MediaType:` + fmt.Sprintf("%v", this.MediaType) + `,`,
`Ref:` + fmt.Sprintf("%v", this.Ref) + `,`, `Ref:` + fmt.Sprintf("%v", this.Ref) + `,`,
`Labels:` + mapStringForLabels + `,`, `Labels:` + mapStringForLabels + `,`,
@ -1533,6 +1595,7 @@ func (m *DiffResponse) Unmarshal(dAtA []byte) error {
func skipDiff(dAtA []byte) (n int, err error) { func skipDiff(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1564,10 +1627,8 @@ func skipDiff(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1588,55 +1649,30 @@ func skipDiff(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthDiff return 0, ErrInvalidLengthDiff
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthDiff
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowDiff
}
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 := skipDiff(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthDiff
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupDiff
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthDiff
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthDiff = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthDiff = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowDiff = fmt.Errorf("proto: integer overflow") ErrIntOverflowDiff = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupDiff = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -11,8 +11,11 @@ import (
github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types"
types "github.com/gogo/protobuf/types" types "github.com/gogo/protobuf/types"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
time "time" time "time"
@ -28,7 +31,7 @@ var _ = time.Kitchen
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type PublishRequest struct { type PublishRequest struct {
Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"` Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
@ -51,7 +54,7 @@ func (m *PublishRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro
return xxx_messageInfo_PublishRequest.Marshal(b, m, deterministic) return xxx_messageInfo_PublishRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -90,7 +93,7 @@ func (m *ForwardRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro
return xxx_messageInfo_ForwardRequest.Marshal(b, m, deterministic) return xxx_messageInfo_ForwardRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -129,7 +132,7 @@ func (m *SubscribeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, er
return xxx_messageInfo_SubscribeRequest.Marshal(b, m, deterministic) return xxx_messageInfo_SubscribeRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -171,7 +174,7 @@ func (m *Envelope) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Envelope.Marshal(b, m, deterministic) return xxx_messageInfo_Envelope.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -377,6 +380,20 @@ type EventsServer interface {
Subscribe(*SubscribeRequest, Events_SubscribeServer) error Subscribe(*SubscribeRequest, Events_SubscribeServer) error
} }
// UnimplementedEventsServer can be embedded to have forward compatible implementations.
type UnimplementedEventsServer struct {
}
func (*UnimplementedEventsServer) Publish(ctx context.Context, req *PublishRequest) (*types.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Publish not implemented")
}
func (*UnimplementedEventsServer) Forward(ctx context.Context, req *ForwardRequest) (*types.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Forward not implemented")
}
func (*UnimplementedEventsServer) Subscribe(req *SubscribeRequest, srv Events_SubscribeServer) error {
return status.Errorf(codes.Unimplemented, "method Subscribe not implemented")
}
func RegisterEventsServer(s *grpc.Server, srv EventsServer) { func RegisterEventsServer(s *grpc.Server, srv EventsServer) {
s.RegisterService(&_Events_serviceDesc, srv) s.RegisterService(&_Events_serviceDesc, srv)
} }
@ -464,7 +481,7 @@ var _Events_serviceDesc = grpc.ServiceDesc{
func (m *PublishRequest) Marshal() (dAtA []byte, err error) { func (m *PublishRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -472,36 +489,45 @@ func (m *PublishRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *PublishRequest) MarshalTo(dAtA []byte) (int, error) { func (m *PublishRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *PublishRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Topic) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Topic)))
i += copy(dAtA[i:], m.Topic)
} }
if m.Event != nil { if m.Event != nil {
dAtA[i] = 0x12 {
i++ size, err := m.Event.MarshalToSizedBuffer(dAtA[:i])
i = encodeVarintEvents(dAtA, i, uint64(m.Event.Size())) if err != nil {
n1, err := m.Event.MarshalTo(dAtA[i:]) return 0, err
if err != nil { }
return 0, err i -= size
i = encodeVarintEvents(dAtA, i, uint64(size))
} }
i += n1 i--
dAtA[i] = 0x12
} }
if m.XXX_unrecognized != nil { if len(m.Topic) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Topic)
copy(dAtA[i:], m.Topic)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Topic)))
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func (m *ForwardRequest) Marshal() (dAtA []byte, err error) { func (m *ForwardRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -509,30 +535,38 @@ func (m *ForwardRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *ForwardRequest) MarshalTo(dAtA []byte) (int, error) { func (m *ForwardRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ForwardRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Envelope != nil {
dAtA[i] = 0xa
i++
i = encodeVarintEvents(dAtA, i, uint64(m.Envelope.Size()))
n2, err := m.Envelope.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n2
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if m.Envelope != nil {
{
size, err := m.Envelope.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintEvents(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *SubscribeRequest) Marshal() (dAtA []byte, err error) { func (m *SubscribeRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -540,35 +574,35 @@ func (m *SubscribeRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *SubscribeRequest) MarshalTo(dAtA []byte) (int, error) { func (m *SubscribeRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *SubscribeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.Filters) > 0 { if len(m.Filters) > 0 {
for _, s := range m.Filters { for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Filters[iNdEx])
copy(dAtA[i:], m.Filters[iNdEx])
i = encodeVarintEvents(dAtA, i, uint64(len(m.Filters[iNdEx])))
i--
dAtA[i] = 0xa dAtA[i] = 0xa
i++
l = len(s)
for l >= 1<<7 {
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
l >>= 7
i++
}
dAtA[i] = uint8(l)
i++
i += copy(dAtA[i:], s)
} }
} }
if m.XXX_unrecognized != nil { return len(dAtA) - i, nil
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
} }
func (m *Envelope) Marshal() (dAtA []byte, err error) { func (m *Envelope) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -576,54 +610,66 @@ func (m *Envelope) Marshal() (dAtA []byte, err error) {
} }
func (m *Envelope) MarshalTo(dAtA []byte) (int, error) { func (m *Envelope) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Envelope) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
dAtA[i] = 0xa if m.XXX_unrecognized != nil {
i++ i -= len(m.XXX_unrecognized)
i = encodeVarintEvents(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp))) copy(dAtA[i:], m.XXX_unrecognized)
n3, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i:])
if err != nil {
return 0, err
}
i += n3
if len(m.Namespace) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintEvents(dAtA, i, uint64(len(m.Namespace)))
i += copy(dAtA[i:], m.Namespace)
}
if len(m.Topic) > 0 {
dAtA[i] = 0x1a
i++
i = encodeVarintEvents(dAtA, i, uint64(len(m.Topic)))
i += copy(dAtA[i:], m.Topic)
} }
if m.Event != nil { if m.Event != nil {
dAtA[i] = 0x22 {
i++ size, err := m.Event.MarshalToSizedBuffer(dAtA[:i])
i = encodeVarintEvents(dAtA, i, uint64(m.Event.Size())) if err != nil {
n4, err := m.Event.MarshalTo(dAtA[i:]) return 0, err
if err != nil { }
return 0, err i -= size
i = encodeVarintEvents(dAtA, i, uint64(size))
} }
i += n4 i--
dAtA[i] = 0x22
} }
if m.XXX_unrecognized != nil { if len(m.Topic) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Topic)
copy(dAtA[i:], m.Topic)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Topic)))
i--
dAtA[i] = 0x1a
} }
return i, nil if len(m.Namespace) > 0 {
i -= len(m.Namespace)
copy(dAtA[i:], m.Namespace)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Namespace)))
i--
dAtA[i] = 0x12
}
n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):])
if err4 != nil {
return 0, err4
}
i -= n4
i = encodeVarintEvents(dAtA, i, uint64(n4))
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
} }
func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { func encodeVarintEvents(dAtA []byte, offset int, v uint64) int {
offset -= sovEvents(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *PublishRequest) Size() (n int) { func (m *PublishRequest) Size() (n int) {
if m == nil { if m == nil {
@ -706,14 +752,7 @@ func (m *Envelope) Size() (n int) {
} }
func sovEvents(x uint64) (n int) { func sovEvents(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozEvents(x uint64) (n int) { func sozEvents(x uint64) (n int) {
return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -735,7 +774,7 @@ func (this *ForwardRequest) String() string {
return "nil" return "nil"
} }
s := strings.Join([]string{`&ForwardRequest{`, s := strings.Join([]string{`&ForwardRequest{`,
`Envelope:` + strings.Replace(fmt.Sprintf("%v", this.Envelope), "Envelope", "Envelope", 1) + `,`, `Envelope:` + strings.Replace(this.Envelope.String(), "Envelope", "Envelope", 1) + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`, `}`,
}, "") }, "")
@ -757,7 +796,7 @@ func (this *Envelope) String() string {
return "nil" return "nil"
} }
s := strings.Join([]string{`&Envelope{`, s := strings.Join([]string{`&Envelope{`,
`Timestamp:` + strings.Replace(strings.Replace(this.Timestamp.String(), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`, `Timestamp:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Timestamp), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`,
`Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`,
`Topic:` + fmt.Sprintf("%v", this.Topic) + `,`, `Topic:` + fmt.Sprintf("%v", this.Topic) + `,`,
`Event:` + strings.Replace(fmt.Sprintf("%v", this.Event), "Any", "types.Any", 1) + `,`, `Event:` + strings.Replace(fmt.Sprintf("%v", this.Event), "Any", "types.Any", 1) + `,`,
@ -1262,6 +1301,7 @@ func (m *Envelope) Unmarshal(dAtA []byte) error {
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
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1293,10 +1333,8 @@ func skipEvents(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1317,55 +1355,30 @@ func skipEvents(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthEvents return 0, ErrInvalidLengthEvents
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthEvents
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEvents
}
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 := skipEvents(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthEvents
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupEvents
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthEvents
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow") ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -12,8 +12,11 @@ import (
github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types"
types1 "github.com/gogo/protobuf/types" types1 "github.com/gogo/protobuf/types"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
time "time" time "time"
@ -29,7 +32,7 @@ var _ = time.Kitchen
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type Image struct { type Image struct {
// Name provides a unique name for the image. // Name provides a unique name for the image.
@ -66,7 +69,7 @@ func (m *Image) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Image.Marshal(b, m, deterministic) return xxx_messageInfo_Image.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -105,7 +108,7 @@ func (m *GetImageRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, err
return xxx_messageInfo_GetImageRequest.Marshal(b, m, deterministic) return xxx_messageInfo_GetImageRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -144,7 +147,7 @@ func (m *GetImageResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, er
return xxx_messageInfo_GetImageResponse.Marshal(b, m, deterministic) return xxx_messageInfo_GetImageResponse.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -183,7 +186,7 @@ func (m *CreateImageRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte,
return xxx_messageInfo_CreateImageRequest.Marshal(b, m, deterministic) return xxx_messageInfo_CreateImageRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -222,7 +225,7 @@ func (m *CreateImageResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte,
return xxx_messageInfo_CreateImageResponse.Marshal(b, m, deterministic) return xxx_messageInfo_CreateImageResponse.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -267,7 +270,7 @@ func (m *UpdateImageRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte,
return xxx_messageInfo_UpdateImageRequest.Marshal(b, m, deterministic) return xxx_messageInfo_UpdateImageRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -306,7 +309,7 @@ func (m *UpdateImageResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte,
return xxx_messageInfo_UpdateImageResponse.Marshal(b, m, deterministic) return xxx_messageInfo_UpdateImageResponse.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -355,7 +358,7 @@ func (m *ListImagesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, e
return xxx_messageInfo_ListImagesRequest.Marshal(b, m, deterministic) return xxx_messageInfo_ListImagesRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -394,7 +397,7 @@ func (m *ListImagesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte,
return xxx_messageInfo_ListImagesResponse.Marshal(b, m, deterministic) return xxx_messageInfo_ListImagesResponse.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -438,7 +441,7 @@ func (m *DeleteImageRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte,
return xxx_messageInfo_DeleteImageRequest.Marshal(b, m, deterministic) return xxx_messageInfo_DeleteImageRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -618,6 +621,26 @@ type ImagesServer interface {
Delete(context.Context, *DeleteImageRequest) (*types1.Empty, error) Delete(context.Context, *DeleteImageRequest) (*types1.Empty, error)
} }
// UnimplementedImagesServer can be embedded to have forward compatible implementations.
type UnimplementedImagesServer struct {
}
func (*UnimplementedImagesServer) Get(ctx context.Context, req *GetImageRequest) (*GetImageResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
}
func (*UnimplementedImagesServer) List(ctx context.Context, req *ListImagesRequest) (*ListImagesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
}
func (*UnimplementedImagesServer) Create(ctx context.Context, req *CreateImageRequest) (*CreateImageResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
}
func (*UnimplementedImagesServer) Update(ctx context.Context, req *UpdateImageRequest) (*UpdateImageResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Update not implemented")
}
func (*UnimplementedImagesServer) Delete(ctx context.Context, req *DeleteImageRequest) (*types1.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented")
}
func RegisterImagesServer(s *grpc.Server, srv ImagesServer) { func RegisterImagesServer(s *grpc.Server, srv ImagesServer) {
s.RegisterService(&_Images_serviceDesc, srv) s.RegisterService(&_Images_serviceDesc, srv)
} }
@ -744,7 +767,7 @@ var _Images_serviceDesc = grpc.ServiceDesc{
func (m *Image) Marshal() (dAtA []byte, err error) { func (m *Image) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -752,67 +775,78 @@ func (m *Image) Marshal() (dAtA []byte, err error) {
} }
func (m *Image) MarshalTo(dAtA []byte) (int, error) { func (m *Image) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Image) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Name) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintImages(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
} }
n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UpdatedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdatedAt):])
if err1 != nil {
return 0, err1
}
i -= n1
i = encodeVarintImages(dAtA, i, uint64(n1))
i--
dAtA[i] = 0x42
n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt):])
if err2 != nil {
return 0, err2
}
i -= n2
i = encodeVarintImages(dAtA, i, uint64(n2))
i--
dAtA[i] = 0x3a
{
size, err := m.Target.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintImages(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
if len(m.Labels) > 0 { if len(m.Labels) > 0 {
for k, _ := range m.Labels { for k := range m.Labels {
dAtA[i] = 0x12
i++
v := m.Labels[k] v := m.Labels[k]
mapSize := 1 + len(k) + sovImages(uint64(len(k))) + 1 + len(v) + sovImages(uint64(len(v))) baseI := i
i = encodeVarintImages(dAtA, i, uint64(mapSize)) i -= len(v)
dAtA[i] = 0xa copy(dAtA[i:], v)
i++
i = encodeVarintImages(dAtA, i, uint64(len(k)))
i += copy(dAtA[i:], k)
dAtA[i] = 0x12
i++
i = encodeVarintImages(dAtA, i, uint64(len(v))) i = encodeVarintImages(dAtA, i, uint64(len(v)))
i += copy(dAtA[i:], v) i--
dAtA[i] = 0x12
i -= len(k)
copy(dAtA[i:], k)
i = encodeVarintImages(dAtA, i, uint64(len(k)))
i--
dAtA[i] = 0xa
i = encodeVarintImages(dAtA, i, uint64(baseI-i))
i--
dAtA[i] = 0x12
} }
} }
dAtA[i] = 0x1a if len(m.Name) > 0 {
i++ i -= len(m.Name)
i = encodeVarintImages(dAtA, i, uint64(m.Target.Size())) copy(dAtA[i:], m.Name)
n1, err := m.Target.MarshalTo(dAtA[i:]) i = encodeVarintImages(dAtA, i, uint64(len(m.Name)))
if err != nil { i--
return 0, err dAtA[i] = 0xa
} }
i += n1 return len(dAtA) - i, nil
dAtA[i] = 0x3a
i++
i = encodeVarintImages(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt)))
n2, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i:])
if err != nil {
return 0, err
}
i += n2
dAtA[i] = 0x42
i++
i = encodeVarintImages(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdatedAt)))
n3, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UpdatedAt, dAtA[i:])
if err != nil {
return 0, err
}
i += n3
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
} }
func (m *GetImageRequest) Marshal() (dAtA []byte, err error) { func (m *GetImageRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -820,26 +854,33 @@ func (m *GetImageRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *GetImageRequest) MarshalTo(dAtA []byte) (int, error) { func (m *GetImageRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *GetImageRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Name) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintImages(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if len(m.Name) > 0 {
i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintImages(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *GetImageResponse) Marshal() (dAtA []byte, err error) { func (m *GetImageResponse) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -847,30 +888,38 @@ func (m *GetImageResponse) Marshal() (dAtA []byte, err error) {
} }
func (m *GetImageResponse) MarshalTo(dAtA []byte) (int, error) { func (m *GetImageResponse) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *GetImageResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Image != nil {
dAtA[i] = 0xa
i++
i = encodeVarintImages(dAtA, i, uint64(m.Image.Size()))
n4, err := m.Image.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n4
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if m.Image != nil {
{
size, err := m.Image.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintImages(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *CreateImageRequest) Marshal() (dAtA []byte, err error) { func (m *CreateImageRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -878,28 +927,36 @@ func (m *CreateImageRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *CreateImageRequest) MarshalTo(dAtA []byte) (int, error) { func (m *CreateImageRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *CreateImageRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
dAtA[i] = 0xa
i++
i = encodeVarintImages(dAtA, i, uint64(m.Image.Size()))
n5, err := m.Image.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n5
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil {
size, err := m.Image.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintImages(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
} }
func (m *CreateImageResponse) Marshal() (dAtA []byte, err error) { func (m *CreateImageResponse) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -907,28 +964,36 @@ func (m *CreateImageResponse) Marshal() (dAtA []byte, err error) {
} }
func (m *CreateImageResponse) MarshalTo(dAtA []byte) (int, error) { func (m *CreateImageResponse) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *CreateImageResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
dAtA[i] = 0xa
i++
i = encodeVarintImages(dAtA, i, uint64(m.Image.Size()))
n6, err := m.Image.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n6
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil {
size, err := m.Image.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintImages(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
} }
func (m *UpdateImageRequest) Marshal() (dAtA []byte, err error) { func (m *UpdateImageRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -936,38 +1001,48 @@ func (m *UpdateImageRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *UpdateImageRequest) MarshalTo(dAtA []byte) (int, error) { func (m *UpdateImageRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *UpdateImageRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
dAtA[i] = 0xa if m.XXX_unrecognized != nil {
i++ i -= len(m.XXX_unrecognized)
i = encodeVarintImages(dAtA, i, uint64(m.Image.Size())) copy(dAtA[i:], m.XXX_unrecognized)
n7, err := m.Image.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
} }
i += n7
if m.UpdateMask != nil { if m.UpdateMask != nil {
{
size, err := m.UpdateMask.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintImages(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12 dAtA[i] = 0x12
i++ }
i = encodeVarintImages(dAtA, i, uint64(m.UpdateMask.Size())) {
n8, err := m.UpdateMask.MarshalTo(dAtA[i:]) size, err := m.Image.MarshalToSizedBuffer(dAtA[:i])
if err != nil { if err != nil {
return 0, err return 0, err
} }
i += n8 i -= size
i = encodeVarintImages(dAtA, i, uint64(size))
} }
if m.XXX_unrecognized != nil { i--
i += copy(dAtA[i:], m.XXX_unrecognized) dAtA[i] = 0xa
} return len(dAtA) - i, nil
return i, nil
} }
func (m *UpdateImageResponse) Marshal() (dAtA []byte, err error) { func (m *UpdateImageResponse) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -975,28 +1050,36 @@ func (m *UpdateImageResponse) Marshal() (dAtA []byte, err error) {
} }
func (m *UpdateImageResponse) MarshalTo(dAtA []byte) (int, error) { func (m *UpdateImageResponse) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *UpdateImageResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
dAtA[i] = 0xa
i++
i = encodeVarintImages(dAtA, i, uint64(m.Image.Size()))
n9, err := m.Image.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n9
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil {
size, err := m.Image.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintImages(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
} }
func (m *ListImagesRequest) Marshal() (dAtA []byte, err error) { func (m *ListImagesRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1004,35 +1087,35 @@ func (m *ListImagesRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *ListImagesRequest) MarshalTo(dAtA []byte) (int, error) { func (m *ListImagesRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ListImagesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.Filters) > 0 { if len(m.Filters) > 0 {
for _, s := range m.Filters { for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Filters[iNdEx])
copy(dAtA[i:], m.Filters[iNdEx])
i = encodeVarintImages(dAtA, i, uint64(len(m.Filters[iNdEx])))
i--
dAtA[i] = 0xa dAtA[i] = 0xa
i++
l = len(s)
for l >= 1<<7 {
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
l >>= 7
i++
}
dAtA[i] = uint8(l)
i++
i += copy(dAtA[i:], s)
} }
} }
if m.XXX_unrecognized != nil { return len(dAtA) - i, nil
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
} }
func (m *ListImagesResponse) Marshal() (dAtA []byte, err error) { func (m *ListImagesResponse) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1040,32 +1123,40 @@ func (m *ListImagesResponse) Marshal() (dAtA []byte, err error) {
} }
func (m *ListImagesResponse) MarshalTo(dAtA []byte) (int, error) { func (m *ListImagesResponse) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ListImagesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.Images) > 0 { if len(m.Images) > 0 {
for _, msg := range m.Images { for iNdEx := len(m.Images) - 1; iNdEx >= 0; iNdEx-- {
dAtA[i] = 0xa {
i++ size, err := m.Images[iNdEx].MarshalToSizedBuffer(dAtA[:i])
i = encodeVarintImages(dAtA, i, uint64(msg.Size())) if err != nil {
n, err := msg.MarshalTo(dAtA[i:]) return 0, err
if err != nil { }
return 0, err i -= size
i = encodeVarintImages(dAtA, i, uint64(size))
} }
i += n i--
dAtA[i] = 0xa
} }
} }
if m.XXX_unrecognized != nil { return len(dAtA) - i, nil
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
} }
func (m *DeleteImageRequest) Marshal() (dAtA []byte, err error) { func (m *DeleteImageRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1073,40 +1164,49 @@ func (m *DeleteImageRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *DeleteImageRequest) MarshalTo(dAtA []byte) (int, error) { func (m *DeleteImageRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *DeleteImageRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Name) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintImages(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
} }
if m.Sync { if m.Sync {
dAtA[i] = 0x10 i--
i++
if m.Sync { if m.Sync {
dAtA[i] = 1 dAtA[i] = 1
} else { } else {
dAtA[i] = 0 dAtA[i] = 0
} }
i++ i--
dAtA[i] = 0x10
} }
if m.XXX_unrecognized != nil { if len(m.Name) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintImages(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func encodeVarintImages(dAtA []byte, offset int, v uint64) int { func encodeVarintImages(dAtA []byte, offset int, v uint64) int {
offset -= sovImages(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *Image) Size() (n int) { func (m *Image) Size() (n int) {
if m == nil { if m == nil {
@ -1286,14 +1386,7 @@ func (m *DeleteImageRequest) Size() (n int) {
} }
func sovImages(x uint64) (n int) { func sovImages(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozImages(x uint64) (n int) { func sozImages(x uint64) (n int) {
return sovImages(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovImages(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -1315,9 +1408,9 @@ func (this *Image) String() string {
s := strings.Join([]string{`&Image{`, s := strings.Join([]string{`&Image{`,
`Name:` + fmt.Sprintf("%v", this.Name) + `,`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`,
`Labels:` + mapStringForLabels + `,`, `Labels:` + mapStringForLabels + `,`,
`Target:` + strings.Replace(strings.Replace(this.Target.String(), "Descriptor", "types.Descriptor", 1), `&`, ``, 1) + `,`, `Target:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Target), "Descriptor", "types.Descriptor", 1), `&`, ``, 1) + `,`,
`CreatedAt:` + strings.Replace(strings.Replace(this.CreatedAt.String(), "Timestamp", "types1.Timestamp", 1), `&`, ``, 1) + `,`, `CreatedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.CreatedAt), "Timestamp", "types1.Timestamp", 1), `&`, ``, 1) + `,`,
`UpdatedAt:` + strings.Replace(strings.Replace(this.UpdatedAt.String(), "Timestamp", "types1.Timestamp", 1), `&`, ``, 1) + `,`, `UpdatedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UpdatedAt), "Timestamp", "types1.Timestamp", 1), `&`, ``, 1) + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`, `}`,
}, "") }, "")
@ -1339,7 +1432,7 @@ func (this *GetImageResponse) String() string {
return "nil" return "nil"
} }
s := strings.Join([]string{`&GetImageResponse{`, s := strings.Join([]string{`&GetImageResponse{`,
`Image:` + strings.Replace(fmt.Sprintf("%v", this.Image), "Image", "Image", 1) + `,`, `Image:` + strings.Replace(this.Image.String(), "Image", "Image", 1) + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`, `}`,
}, "") }, "")
@ -1405,8 +1498,13 @@ func (this *ListImagesResponse) String() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
repeatedStringForImages := "[]Image{"
for _, f := range this.Images {
repeatedStringForImages += strings.Replace(strings.Replace(f.String(), "Image", "Image", 1), `&`, ``, 1) + ","
}
repeatedStringForImages += "}"
s := strings.Join([]string{`&ListImagesResponse{`, s := strings.Join([]string{`&ListImagesResponse{`,
`Images:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Images), "Image", "Image", 1), `&`, ``, 1) + `,`, `Images:` + repeatedStringForImages + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`, `}`,
}, "") }, "")
@ -2587,6 +2685,7 @@ func (m *DeleteImageRequest) Unmarshal(dAtA []byte) error {
func skipImages(dAtA []byte) (n int, err error) { func skipImages(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -2618,10 +2717,8 @@ func skipImages(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -2642,55 +2739,30 @@ func skipImages(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthImages return 0, ErrInvalidLengthImages
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthImages
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowImages
}
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 := skipImages(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthImages
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupImages
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthImages
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthImages = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthImages = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowImages = fmt.Errorf("proto: integer overflow") ErrIntOverflowImages = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupImages = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -12,8 +12,11 @@ import (
github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys"
types1 "github.com/gogo/protobuf/types" types1 "github.com/gogo/protobuf/types"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -27,7 +30,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type Plugin struct { type Plugin struct {
// Type defines the type of plugin. // Type defines the type of plugin.
@ -85,7 +88,7 @@ func (m *Plugin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Plugin.Marshal(b, m, deterministic) return xxx_messageInfo_Plugin.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -134,7 +137,7 @@ func (m *PluginsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro
return xxx_messageInfo_PluginsRequest.Marshal(b, m, deterministic) return xxx_messageInfo_PluginsRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -173,7 +176,7 @@ func (m *PluginsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, err
return xxx_messageInfo_PluginsResponse.Marshal(b, m, deterministic) return xxx_messageInfo_PluginsResponse.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -212,7 +215,7 @@ func (m *ServerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro
return xxx_messageInfo_ServerResponse.Marshal(b, m, deterministic) return xxx_messageInfo_ServerResponse.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -340,6 +343,17 @@ type IntrospectionServer interface {
Server(context.Context, *types1.Empty) (*ServerResponse, error) Server(context.Context, *types1.Empty) (*ServerResponse, error)
} }
// UnimplementedIntrospectionServer can be embedded to have forward compatible implementations.
type UnimplementedIntrospectionServer struct {
}
func (*UnimplementedIntrospectionServer) Plugins(ctx context.Context, req *PluginsRequest) (*PluginsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Plugins not implemented")
}
func (*UnimplementedIntrospectionServer) Server(ctx context.Context, req *types1.Empty) (*ServerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Server not implemented")
}
func RegisterIntrospectionServer(s *grpc.Server, srv IntrospectionServer) { func RegisterIntrospectionServer(s *grpc.Server, srv IntrospectionServer) {
s.RegisterService(&_Introspection_serviceDesc, srv) s.RegisterService(&_Introspection_serviceDesc, srv)
} }
@ -400,7 +414,7 @@ var _Introspection_serviceDesc = grpc.ServiceDesc{
func (m *Plugin) Marshal() (dAtA []byte, err error) { func (m *Plugin) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -408,101 +422,103 @@ func (m *Plugin) Marshal() (dAtA []byte, err error) {
} }
func (m *Plugin) MarshalTo(dAtA []byte) (int, error) { func (m *Plugin) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Plugin) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Type) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintIntrospection(dAtA, i, uint64(len(m.Type)))
i += copy(dAtA[i:], m.Type)
} }
if len(m.ID) > 0 { if m.InitErr != nil {
dAtA[i] = 0x12 {
i++ size, err := m.InitErr.MarshalToSizedBuffer(dAtA[:i])
i = encodeVarintIntrospection(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ID)
}
if len(m.Requires) > 0 {
for _, s := range m.Requires {
dAtA[i] = 0x1a
i++
l = len(s)
for l >= 1<<7 {
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
l >>= 7
i++
}
dAtA[i] = uint8(l)
i++
i += copy(dAtA[i:], s)
}
}
if len(m.Platforms) > 0 {
for _, msg := range m.Platforms {
dAtA[i] = 0x22
i++
i = encodeVarintIntrospection(dAtA, i, uint64(msg.Size()))
n, err := msg.MarshalTo(dAtA[i:])
if err != nil { if err != nil {
return 0, err return 0, err
} }
i += n i -= size
i = encodeVarintIntrospection(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x3a
}
if len(m.Capabilities) > 0 {
for iNdEx := len(m.Capabilities) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Capabilities[iNdEx])
copy(dAtA[i:], m.Capabilities[iNdEx])
i = encodeVarintIntrospection(dAtA, i, uint64(len(m.Capabilities[iNdEx])))
i--
dAtA[i] = 0x32
} }
} }
if len(m.Exports) > 0 { if len(m.Exports) > 0 {
for k, _ := range m.Exports { for k := range m.Exports {
dAtA[i] = 0x2a
i++
v := m.Exports[k] v := m.Exports[k]
mapSize := 1 + len(k) + sovIntrospection(uint64(len(k))) + 1 + len(v) + sovIntrospection(uint64(len(v))) baseI := i
i = encodeVarintIntrospection(dAtA, i, uint64(mapSize)) i -= len(v)
dAtA[i] = 0xa copy(dAtA[i:], v)
i++
i = encodeVarintIntrospection(dAtA, i, uint64(len(k)))
i += copy(dAtA[i:], k)
dAtA[i] = 0x12
i++
i = encodeVarintIntrospection(dAtA, i, uint64(len(v))) i = encodeVarintIntrospection(dAtA, i, uint64(len(v)))
i += copy(dAtA[i:], v) i--
dAtA[i] = 0x12
i -= len(k)
copy(dAtA[i:], k)
i = encodeVarintIntrospection(dAtA, i, uint64(len(k)))
i--
dAtA[i] = 0xa
i = encodeVarintIntrospection(dAtA, i, uint64(baseI-i))
i--
dAtA[i] = 0x2a
} }
} }
if len(m.Capabilities) > 0 { if len(m.Platforms) > 0 {
for _, s := range m.Capabilities { for iNdEx := len(m.Platforms) - 1; iNdEx >= 0; iNdEx-- {
dAtA[i] = 0x32 {
i++ size, err := m.Platforms[iNdEx].MarshalToSizedBuffer(dAtA[:i])
l = len(s) if err != nil {
for l >= 1<<7 { return 0, err
dAtA[i] = uint8(uint64(l)&0x7f | 0x80) }
l >>= 7 i -= size
i++ i = encodeVarintIntrospection(dAtA, i, uint64(size))
} }
dAtA[i] = uint8(l) i--
i++ dAtA[i] = 0x22
i += copy(dAtA[i:], s)
} }
} }
if m.InitErr != nil { if len(m.Requires) > 0 {
dAtA[i] = 0x3a for iNdEx := len(m.Requires) - 1; iNdEx >= 0; iNdEx-- {
i++ i -= len(m.Requires[iNdEx])
i = encodeVarintIntrospection(dAtA, i, uint64(m.InitErr.Size())) copy(dAtA[i:], m.Requires[iNdEx])
n1, err := m.InitErr.MarshalTo(dAtA[i:]) i = encodeVarintIntrospection(dAtA, i, uint64(len(m.Requires[iNdEx])))
if err != nil { i--
return 0, err dAtA[i] = 0x1a
} }
i += n1
} }
if m.XXX_unrecognized != nil { if len(m.ID) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.ID)
copy(dAtA[i:], m.ID)
i = encodeVarintIntrospection(dAtA, i, uint64(len(m.ID)))
i--
dAtA[i] = 0x12
} }
return i, nil if len(m.Type) > 0 {
i -= len(m.Type)
copy(dAtA[i:], m.Type)
i = encodeVarintIntrospection(dAtA, i, uint64(len(m.Type)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *PluginsRequest) Marshal() (dAtA []byte, err error) { func (m *PluginsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -510,35 +526,35 @@ func (m *PluginsRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *PluginsRequest) MarshalTo(dAtA []byte) (int, error) { func (m *PluginsRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *PluginsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.Filters) > 0 { if len(m.Filters) > 0 {
for _, s := range m.Filters { for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Filters[iNdEx])
copy(dAtA[i:], m.Filters[iNdEx])
i = encodeVarintIntrospection(dAtA, i, uint64(len(m.Filters[iNdEx])))
i--
dAtA[i] = 0xa dAtA[i] = 0xa
i++
l = len(s)
for l >= 1<<7 {
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
l >>= 7
i++
}
dAtA[i] = uint8(l)
i++
i += copy(dAtA[i:], s)
} }
} }
if m.XXX_unrecognized != nil { return len(dAtA) - i, nil
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
} }
func (m *PluginsResponse) Marshal() (dAtA []byte, err error) { func (m *PluginsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -546,32 +562,40 @@ func (m *PluginsResponse) Marshal() (dAtA []byte, err error) {
} }
func (m *PluginsResponse) MarshalTo(dAtA []byte) (int, error) { func (m *PluginsResponse) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *PluginsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.Plugins) > 0 { if len(m.Plugins) > 0 {
for _, msg := range m.Plugins { for iNdEx := len(m.Plugins) - 1; iNdEx >= 0; iNdEx-- {
dAtA[i] = 0xa {
i++ size, err := m.Plugins[iNdEx].MarshalToSizedBuffer(dAtA[:i])
i = encodeVarintIntrospection(dAtA, i, uint64(msg.Size())) if err != nil {
n, err := msg.MarshalTo(dAtA[i:]) return 0, err
if err != nil { }
return 0, err i -= size
i = encodeVarintIntrospection(dAtA, i, uint64(size))
} }
i += n i--
dAtA[i] = 0xa
} }
} }
if m.XXX_unrecognized != nil { return len(dAtA) - i, nil
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
} }
func (m *ServerResponse) Marshal() (dAtA []byte, err error) { func (m *ServerResponse) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -579,30 +603,39 @@ func (m *ServerResponse) Marshal() (dAtA []byte, err error) {
} }
func (m *ServerResponse) MarshalTo(dAtA []byte) (int, error) { func (m *ServerResponse) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ServerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.UUID) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintIntrospection(dAtA, i, uint64(len(m.UUID)))
i += copy(dAtA[i:], m.UUID)
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if len(m.UUID) > 0 {
i -= len(m.UUID)
copy(dAtA[i:], m.UUID)
i = encodeVarintIntrospection(dAtA, i, uint64(len(m.UUID)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func encodeVarintIntrospection(dAtA []byte, offset int, v uint64) int { func encodeVarintIntrospection(dAtA []byte, offset int, v uint64) int {
offset -= sovIntrospection(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *Plugin) Size() (n int) { func (m *Plugin) Size() (n int) {
if m == nil { if m == nil {
@ -707,14 +740,7 @@ func (m *ServerResponse) Size() (n int) {
} }
func sovIntrospection(x uint64) (n int) { func sovIntrospection(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozIntrospection(x uint64) (n int) { func sozIntrospection(x uint64) (n int) {
return sovIntrospection(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovIntrospection(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -723,6 +749,11 @@ func (this *Plugin) String() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
repeatedStringForPlatforms := "[]Platform{"
for _, f := range this.Platforms {
repeatedStringForPlatforms += fmt.Sprintf("%v", f) + ","
}
repeatedStringForPlatforms += "}"
keysForExports := make([]string, 0, len(this.Exports)) keysForExports := make([]string, 0, len(this.Exports))
for k, _ := range this.Exports { for k, _ := range this.Exports {
keysForExports = append(keysForExports, k) keysForExports = append(keysForExports, k)
@ -737,7 +768,7 @@ func (this *Plugin) String() string {
`Type:` + fmt.Sprintf("%v", this.Type) + `,`, `Type:` + fmt.Sprintf("%v", this.Type) + `,`,
`ID:` + fmt.Sprintf("%v", this.ID) + `,`, `ID:` + fmt.Sprintf("%v", this.ID) + `,`,
`Requires:` + fmt.Sprintf("%v", this.Requires) + `,`, `Requires:` + fmt.Sprintf("%v", this.Requires) + `,`,
`Platforms:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Platforms), "Platform", "types.Platform", 1), `&`, ``, 1) + `,`, `Platforms:` + repeatedStringForPlatforms + `,`,
`Exports:` + mapStringForExports + `,`, `Exports:` + mapStringForExports + `,`,
`Capabilities:` + fmt.Sprintf("%v", this.Capabilities) + `,`, `Capabilities:` + fmt.Sprintf("%v", this.Capabilities) + `,`,
`InitErr:` + strings.Replace(fmt.Sprintf("%v", this.InitErr), "Status", "rpc.Status", 1) + `,`, `InitErr:` + strings.Replace(fmt.Sprintf("%v", this.InitErr), "Status", "rpc.Status", 1) + `,`,
@ -761,8 +792,13 @@ func (this *PluginsResponse) String() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
repeatedStringForPlugins := "[]Plugin{"
for _, f := range this.Plugins {
repeatedStringForPlugins += strings.Replace(strings.Replace(f.String(), "Plugin", "Plugin", 1), `&`, ``, 1) + ","
}
repeatedStringForPlugins += "}"
s := strings.Join([]string{`&PluginsResponse{`, s := strings.Join([]string{`&PluginsResponse{`,
`Plugins:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Plugins), "Plugin", "Plugin", 1), `&`, ``, 1) + `,`, `Plugins:` + repeatedStringForPlugins + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`, `}`,
}, "") }, "")
@ -1429,6 +1465,7 @@ func (m *ServerResponse) Unmarshal(dAtA []byte) error {
func skipIntrospection(dAtA []byte) (n int, err error) { func skipIntrospection(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1460,10 +1497,8 @@ func skipIntrospection(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1484,55 +1519,30 @@ func skipIntrospection(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthIntrospection return 0, ErrInvalidLengthIntrospection
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthIntrospection
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowIntrospection
}
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 := skipIntrospection(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthIntrospection
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupIntrospection
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthIntrospection
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthIntrospection = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthIntrospection = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowIntrospection = fmt.Errorf("proto: integer overflow") ErrIntOverflowIntrospection = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupIntrospection = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -11,8 +11,11 @@ import (
github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types"
types "github.com/gogo/protobuf/types" types "github.com/gogo/protobuf/types"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
time "time" time "time"
@ -28,7 +31,7 @@ var _ = time.Kitchen
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// Lease is an object which retains resources while it exists. // Lease is an object which retains resources while it exists.
type Lease struct { type Lease struct {
@ -53,7 +56,7 @@ func (m *Lease) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Lease.Marshal(b, m, deterministic) return xxx_messageInfo_Lease.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -95,7 +98,7 @@ func (m *CreateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error
return xxx_messageInfo_CreateRequest.Marshal(b, m, deterministic) return xxx_messageInfo_CreateRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -134,7 +137,7 @@ func (m *CreateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro
return xxx_messageInfo_CreateResponse.Marshal(b, m, deterministic) return xxx_messageInfo_CreateResponse.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -178,7 +181,7 @@ func (m *DeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error
return xxx_messageInfo_DeleteRequest.Marshal(b, m, deterministic) return xxx_messageInfo_DeleteRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -217,7 +220,7 @@ func (m *ListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return xxx_messageInfo_ListRequest.Marshal(b, m, deterministic) return xxx_messageInfo_ListRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -256,7 +259,7 @@ func (m *ListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return xxx_messageInfo_ListResponse.Marshal(b, m, deterministic) return xxx_messageInfo_ListResponse.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -299,7 +302,7 @@ func (m *Resource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Resource.Marshal(b, m, deterministic) return xxx_messageInfo_Resource.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -339,7 +342,7 @@ func (m *AddResourceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte,
return xxx_messageInfo_AddResourceRequest.Marshal(b, m, deterministic) return xxx_messageInfo_AddResourceRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -379,7 +382,7 @@ func (m *DeleteResourceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byt
return xxx_messageInfo_DeleteResourceRequest.Marshal(b, m, deterministic) return xxx_messageInfo_DeleteResourceRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -418,7 +421,7 @@ func (m *ListResourcesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte
return xxx_messageInfo_ListResourcesRequest.Marshal(b, m, deterministic) return xxx_messageInfo_ListResourcesRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -457,7 +460,7 @@ func (m *ListResourcesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byt
return xxx_messageInfo_ListResourcesResponse.Marshal(b, m, deterministic) return xxx_messageInfo_ListResourcesResponse.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -653,6 +656,29 @@ type LeasesServer interface {
ListResources(context.Context, *ListResourcesRequest) (*ListResourcesResponse, error) ListResources(context.Context, *ListResourcesRequest) (*ListResourcesResponse, error)
} }
// UnimplementedLeasesServer can be embedded to have forward compatible implementations.
type UnimplementedLeasesServer struct {
}
func (*UnimplementedLeasesServer) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
}
func (*UnimplementedLeasesServer) Delete(ctx context.Context, req *DeleteRequest) (*types.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented")
}
func (*UnimplementedLeasesServer) List(ctx context.Context, req *ListRequest) (*ListResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
}
func (*UnimplementedLeasesServer) AddResource(ctx context.Context, req *AddResourceRequest) (*types.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddResource not implemented")
}
func (*UnimplementedLeasesServer) DeleteResource(ctx context.Context, req *DeleteResourceRequest) (*types.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteResource not implemented")
}
func (*UnimplementedLeasesServer) ListResources(ctx context.Context, req *ListResourcesRequest) (*ListResourcesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListResources not implemented")
}
func RegisterLeasesServer(s *grpc.Server, srv LeasesServer) { func RegisterLeasesServer(s *grpc.Server, srv LeasesServer) {
s.RegisterService(&_Leases_serviceDesc, srv) s.RegisterService(&_Leases_serviceDesc, srv)
} }
@ -801,7 +827,7 @@ var _Leases_serviceDesc = grpc.ServiceDesc{
func (m *Lease) Marshal() (dAtA []byte, err error) { func (m *Lease) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -809,51 +835,60 @@ func (m *Lease) Marshal() (dAtA []byte, err error) {
} }
func (m *Lease) MarshalTo(dAtA []byte) (int, error) { func (m *Lease) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Lease) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ID) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintLeases(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ID)
} }
dAtA[i] = 0x12
i++
i = encodeVarintLeases(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt)))
n1, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i:])
if err != nil {
return 0, err
}
i += n1
if len(m.Labels) > 0 { if len(m.Labels) > 0 {
for k, _ := range m.Labels { for k := range m.Labels {
dAtA[i] = 0x1a
i++
v := m.Labels[k] v := m.Labels[k]
mapSize := 1 + len(k) + sovLeases(uint64(len(k))) + 1 + len(v) + sovLeases(uint64(len(v))) baseI := i
i = encodeVarintLeases(dAtA, i, uint64(mapSize)) i -= len(v)
dAtA[i] = 0xa copy(dAtA[i:], v)
i++
i = encodeVarintLeases(dAtA, i, uint64(len(k)))
i += copy(dAtA[i:], k)
dAtA[i] = 0x12
i++
i = encodeVarintLeases(dAtA, i, uint64(len(v))) i = encodeVarintLeases(dAtA, i, uint64(len(v)))
i += copy(dAtA[i:], v) i--
dAtA[i] = 0x12
i -= len(k)
copy(dAtA[i:], k)
i = encodeVarintLeases(dAtA, i, uint64(len(k)))
i--
dAtA[i] = 0xa
i = encodeVarintLeases(dAtA, i, uint64(baseI-i))
i--
dAtA[i] = 0x1a
} }
} }
if m.XXX_unrecognized != nil { n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt):])
i += copy(dAtA[i:], m.XXX_unrecognized) if err1 != nil {
return 0, err1
} }
return i, nil i -= n1
i = encodeVarintLeases(dAtA, i, uint64(n1))
i--
dAtA[i] = 0x12
if len(m.ID) > 0 {
i -= len(m.ID)
copy(dAtA[i:], m.ID)
i = encodeVarintLeases(dAtA, i, uint64(len(m.ID)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *CreateRequest) Marshal() (dAtA []byte, err error) { func (m *CreateRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -861,43 +896,52 @@ func (m *CreateRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *CreateRequest) MarshalTo(dAtA []byte) (int, error) { func (m *CreateRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *CreateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ID) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintLeases(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ID)
} }
if len(m.Labels) > 0 { if len(m.Labels) > 0 {
for k, _ := range m.Labels { for k := range m.Labels {
dAtA[i] = 0x1a
i++
v := m.Labels[k] v := m.Labels[k]
mapSize := 1 + len(k) + sovLeases(uint64(len(k))) + 1 + len(v) + sovLeases(uint64(len(v))) baseI := i
i = encodeVarintLeases(dAtA, i, uint64(mapSize)) i -= len(v)
dAtA[i] = 0xa copy(dAtA[i:], v)
i++
i = encodeVarintLeases(dAtA, i, uint64(len(k)))
i += copy(dAtA[i:], k)
dAtA[i] = 0x12
i++
i = encodeVarintLeases(dAtA, i, uint64(len(v))) i = encodeVarintLeases(dAtA, i, uint64(len(v)))
i += copy(dAtA[i:], v) i--
dAtA[i] = 0x12
i -= len(k)
copy(dAtA[i:], k)
i = encodeVarintLeases(dAtA, i, uint64(len(k)))
i--
dAtA[i] = 0xa
i = encodeVarintLeases(dAtA, i, uint64(baseI-i))
i--
dAtA[i] = 0x1a
} }
} }
if m.XXX_unrecognized != nil { if len(m.ID) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.ID)
copy(dAtA[i:], m.ID)
i = encodeVarintLeases(dAtA, i, uint64(len(m.ID)))
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func (m *CreateResponse) Marshal() (dAtA []byte, err error) { func (m *CreateResponse) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -905,30 +949,38 @@ func (m *CreateResponse) Marshal() (dAtA []byte, err error) {
} }
func (m *CreateResponse) MarshalTo(dAtA []byte) (int, error) { func (m *CreateResponse) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *CreateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Lease != nil {
dAtA[i] = 0xa
i++
i = encodeVarintLeases(dAtA, i, uint64(m.Lease.Size()))
n2, err := m.Lease.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n2
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if m.Lease != nil {
{
size, err := m.Lease.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintLeases(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *DeleteRequest) Marshal() (dAtA []byte, err error) { func (m *DeleteRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -936,36 +988,43 @@ func (m *DeleteRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *DeleteRequest) MarshalTo(dAtA []byte) (int, error) { func (m *DeleteRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ID) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintLeases(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ID)
} }
if m.Sync { if m.Sync {
dAtA[i] = 0x10 i--
i++
if m.Sync { if m.Sync {
dAtA[i] = 1 dAtA[i] = 1
} else { } else {
dAtA[i] = 0 dAtA[i] = 0
} }
i++ i--
dAtA[i] = 0x10
} }
if m.XXX_unrecognized != nil { if len(m.ID) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.ID)
copy(dAtA[i:], m.ID)
i = encodeVarintLeases(dAtA, i, uint64(len(m.ID)))
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func (m *ListRequest) Marshal() (dAtA []byte, err error) { func (m *ListRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -973,35 +1032,35 @@ func (m *ListRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *ListRequest) MarshalTo(dAtA []byte) (int, error) { func (m *ListRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.Filters) > 0 { if len(m.Filters) > 0 {
for _, s := range m.Filters { for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Filters[iNdEx])
copy(dAtA[i:], m.Filters[iNdEx])
i = encodeVarintLeases(dAtA, i, uint64(len(m.Filters[iNdEx])))
i--
dAtA[i] = 0xa dAtA[i] = 0xa
i++
l = len(s)
for l >= 1<<7 {
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
l >>= 7
i++
}
dAtA[i] = uint8(l)
i++
i += copy(dAtA[i:], s)
} }
} }
if m.XXX_unrecognized != nil { return len(dAtA) - i, nil
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
} }
func (m *ListResponse) Marshal() (dAtA []byte, err error) { func (m *ListResponse) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1009,32 +1068,40 @@ func (m *ListResponse) Marshal() (dAtA []byte, err error) {
} }
func (m *ListResponse) MarshalTo(dAtA []byte) (int, error) { func (m *ListResponse) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.Leases) > 0 { if len(m.Leases) > 0 {
for _, msg := range m.Leases { for iNdEx := len(m.Leases) - 1; iNdEx >= 0; iNdEx-- {
dAtA[i] = 0xa {
i++ size, err := m.Leases[iNdEx].MarshalToSizedBuffer(dAtA[:i])
i = encodeVarintLeases(dAtA, i, uint64(msg.Size())) if err != nil {
n, err := msg.MarshalTo(dAtA[i:]) return 0, err
if err != nil { }
return 0, err i -= size
i = encodeVarintLeases(dAtA, i, uint64(size))
} }
i += n i--
dAtA[i] = 0xa
} }
} }
if m.XXX_unrecognized != nil { return len(dAtA) - i, nil
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
} }
func (m *Resource) Marshal() (dAtA []byte, err error) { func (m *Resource) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1042,32 +1109,40 @@ func (m *Resource) Marshal() (dAtA []byte, err error) {
} }
func (m *Resource) MarshalTo(dAtA []byte) (int, error) { func (m *Resource) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Resource) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ID) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintLeases(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ID)
} }
if len(m.Type) > 0 { if len(m.Type) > 0 {
dAtA[i] = 0x12 i -= len(m.Type)
i++ copy(dAtA[i:], m.Type)
i = encodeVarintLeases(dAtA, i, uint64(len(m.Type))) i = encodeVarintLeases(dAtA, i, uint64(len(m.Type)))
i += copy(dAtA[i:], m.Type) i--
dAtA[i] = 0x12
} }
if m.XXX_unrecognized != nil { if len(m.ID) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.ID)
copy(dAtA[i:], m.ID)
i = encodeVarintLeases(dAtA, i, uint64(len(m.ID)))
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func (m *AddResourceRequest) Marshal() (dAtA []byte, err error) { func (m *AddResourceRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1075,34 +1150,43 @@ func (m *AddResourceRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *AddResourceRequest) MarshalTo(dAtA []byte) (int, error) { func (m *AddResourceRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *AddResourceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ID) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintLeases(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ID)
}
dAtA[i] = 0x12
i++
i = encodeVarintLeases(dAtA, i, uint64(m.Resource.Size()))
n3, err := m.Resource.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n3
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil {
size, err := m.Resource.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintLeases(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
if len(m.ID) > 0 {
i -= len(m.ID)
copy(dAtA[i:], m.ID)
i = encodeVarintLeases(dAtA, i, uint64(len(m.ID)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *DeleteResourceRequest) Marshal() (dAtA []byte, err error) { func (m *DeleteResourceRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1110,34 +1194,43 @@ func (m *DeleteResourceRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *DeleteResourceRequest) MarshalTo(dAtA []byte) (int, error) { func (m *DeleteResourceRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *DeleteResourceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ID) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintLeases(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ID)
}
dAtA[i] = 0x12
i++
i = encodeVarintLeases(dAtA, i, uint64(m.Resource.Size()))
n4, err := m.Resource.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n4
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil {
size, err := m.Resource.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintLeases(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
if len(m.ID) > 0 {
i -= len(m.ID)
copy(dAtA[i:], m.ID)
i = encodeVarintLeases(dAtA, i, uint64(len(m.ID)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *ListResourcesRequest) Marshal() (dAtA []byte, err error) { func (m *ListResourcesRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1145,26 +1238,33 @@ func (m *ListResourcesRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *ListResourcesRequest) MarshalTo(dAtA []byte) (int, error) { func (m *ListResourcesRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ListResourcesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ID) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintLeases(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ID)
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if len(m.ID) > 0 {
i -= len(m.ID)
copy(dAtA[i:], m.ID)
i = encodeVarintLeases(dAtA, i, uint64(len(m.ID)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *ListResourcesResponse) Marshal() (dAtA []byte, err error) { func (m *ListResourcesResponse) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1172,36 +1272,46 @@ func (m *ListResourcesResponse) Marshal() (dAtA []byte, err error) {
} }
func (m *ListResourcesResponse) MarshalTo(dAtA []byte) (int, error) { func (m *ListResourcesResponse) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ListResourcesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.Resources) > 0 { if len(m.Resources) > 0 {
for _, msg := range m.Resources { for iNdEx := len(m.Resources) - 1; iNdEx >= 0; iNdEx-- {
dAtA[i] = 0xa {
i++ size, err := m.Resources[iNdEx].MarshalToSizedBuffer(dAtA[:i])
i = encodeVarintLeases(dAtA, i, uint64(msg.Size())) if err != nil {
n, err := msg.MarshalTo(dAtA[i:]) return 0, err
if err != nil { }
return 0, err i -= size
i = encodeVarintLeases(dAtA, i, uint64(size))
} }
i += n i--
dAtA[i] = 0xa
} }
} }
if m.XXX_unrecognized != nil { return len(dAtA) - i, nil
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
} }
func encodeVarintLeases(dAtA []byte, offset int, v uint64) int { func encodeVarintLeases(dAtA []byte, offset int, v uint64) int {
offset -= sovLeases(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *Lease) Size() (n int) { func (m *Lease) Size() (n int) {
if m == nil { if m == nil {
@ -1415,14 +1525,7 @@ func (m *ListResourcesResponse) Size() (n int) {
} }
func sovLeases(x uint64) (n int) { func sovLeases(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozLeases(x uint64) (n int) { func sozLeases(x uint64) (n int) {
return sovLeases(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovLeases(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -1443,7 +1546,7 @@ func (this *Lease) String() string {
mapStringForLabels += "}" mapStringForLabels += "}"
s := strings.Join([]string{`&Lease{`, s := strings.Join([]string{`&Lease{`,
`ID:` + fmt.Sprintf("%v", this.ID) + `,`, `ID:` + fmt.Sprintf("%v", this.ID) + `,`,
`CreatedAt:` + strings.Replace(strings.Replace(this.CreatedAt.String(), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`, `CreatedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.CreatedAt), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`,
`Labels:` + mapStringForLabels + `,`, `Labels:` + mapStringForLabels + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`, `}`,
@ -1477,7 +1580,7 @@ func (this *CreateResponse) String() string {
return "nil" return "nil"
} }
s := strings.Join([]string{`&CreateResponse{`, s := strings.Join([]string{`&CreateResponse{`,
`Lease:` + strings.Replace(fmt.Sprintf("%v", this.Lease), "Lease", "Lease", 1) + `,`, `Lease:` + strings.Replace(this.Lease.String(), "Lease", "Lease", 1) + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`, `}`,
}, "") }, "")
@ -1510,8 +1613,13 @@ func (this *ListResponse) String() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
repeatedStringForLeases := "[]*Lease{"
for _, f := range this.Leases {
repeatedStringForLeases += strings.Replace(f.String(), "Lease", "Lease", 1) + ","
}
repeatedStringForLeases += "}"
s := strings.Join([]string{`&ListResponse{`, s := strings.Join([]string{`&ListResponse{`,
`Leases:` + strings.Replace(fmt.Sprintf("%v", this.Leases), "Lease", "Lease", 1) + `,`, `Leases:` + repeatedStringForLeases + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`, `}`,
}, "") }, "")
@ -1568,8 +1676,13 @@ func (this *ListResourcesResponse) String() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
repeatedStringForResources := "[]Resource{"
for _, f := range this.Resources {
repeatedStringForResources += strings.Replace(strings.Replace(f.String(), "Resource", "Resource", 1), `&`, ``, 1) + ","
}
repeatedStringForResources += "}"
s := strings.Join([]string{`&ListResourcesResponse{`, s := strings.Join([]string{`&ListResourcesResponse{`,
`Resources:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Resources), "Resource", "Resource", 1), `&`, ``, 1) + `,`, `Resources:` + repeatedStringForResources + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`, `}`,
}, "") }, "")
@ -2945,6 +3058,7 @@ func (m *ListResourcesResponse) Unmarshal(dAtA []byte) error {
func skipLeases(dAtA []byte) (n int, err error) { func skipLeases(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -2976,10 +3090,8 @@ func skipLeases(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -3000,55 +3112,30 @@ func skipLeases(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthLeases return 0, ErrInvalidLengthLeases
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthLeases
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowLeases
}
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 := skipLeases(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthLeases
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupLeases
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthLeases
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthLeases = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthLeases = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowLeases = fmt.Errorf("proto: integer overflow") ErrIntOverflowLeases = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupLeases = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -10,8 +10,11 @@ import (
github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys"
types "github.com/gogo/protobuf/types" types "github.com/gogo/protobuf/types"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -25,7 +28,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type Namespace struct { type Namespace struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
@ -54,7 +57,7 @@ func (m *Namespace) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Namespace.Marshal(b, m, deterministic) return xxx_messageInfo_Namespace.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -93,7 +96,7 @@ func (m *GetNamespaceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte,
return xxx_messageInfo_GetNamespaceRequest.Marshal(b, m, deterministic) return xxx_messageInfo_GetNamespaceRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -132,7 +135,7 @@ func (m *GetNamespaceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte
return xxx_messageInfo_GetNamespaceResponse.Marshal(b, m, deterministic) return xxx_messageInfo_GetNamespaceResponse.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -171,7 +174,7 @@ func (m *ListNamespacesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byt
return xxx_messageInfo_ListNamespacesRequest.Marshal(b, m, deterministic) return xxx_messageInfo_ListNamespacesRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -210,7 +213,7 @@ func (m *ListNamespacesResponse) XXX_Marshal(b []byte, deterministic bool) ([]by
return xxx_messageInfo_ListNamespacesResponse.Marshal(b, m, deterministic) return xxx_messageInfo_ListNamespacesResponse.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -249,7 +252,7 @@ func (m *CreateNamespaceRequest) XXX_Marshal(b []byte, deterministic bool) ([]by
return xxx_messageInfo_CreateNamespaceRequest.Marshal(b, m, deterministic) return xxx_messageInfo_CreateNamespaceRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -288,7 +291,7 @@ func (m *CreateNamespaceResponse) XXX_Marshal(b []byte, deterministic bool) ([]b
return xxx_messageInfo_CreateNamespaceResponse.Marshal(b, m, deterministic) return xxx_messageInfo_CreateNamespaceResponse.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -342,7 +345,7 @@ func (m *UpdateNamespaceRequest) XXX_Marshal(b []byte, deterministic bool) ([]by
return xxx_messageInfo_UpdateNamespaceRequest.Marshal(b, m, deterministic) return xxx_messageInfo_UpdateNamespaceRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -381,7 +384,7 @@ func (m *UpdateNamespaceResponse) XXX_Marshal(b []byte, deterministic bool) ([]b
return xxx_messageInfo_UpdateNamespaceResponse.Marshal(b, m, deterministic) return xxx_messageInfo_UpdateNamespaceResponse.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -420,7 +423,7 @@ func (m *DeleteNamespaceRequest) XXX_Marshal(b []byte, deterministic bool) ([]by
return xxx_messageInfo_DeleteNamespaceRequest.Marshal(b, m, deterministic) return xxx_messageInfo_DeleteNamespaceRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -577,6 +580,26 @@ type NamespacesServer interface {
Delete(context.Context, *DeleteNamespaceRequest) (*types.Empty, error) Delete(context.Context, *DeleteNamespaceRequest) (*types.Empty, error)
} }
// UnimplementedNamespacesServer can be embedded to have forward compatible implementations.
type UnimplementedNamespacesServer struct {
}
func (*UnimplementedNamespacesServer) Get(ctx context.Context, req *GetNamespaceRequest) (*GetNamespaceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
}
func (*UnimplementedNamespacesServer) List(ctx context.Context, req *ListNamespacesRequest) (*ListNamespacesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
}
func (*UnimplementedNamespacesServer) Create(ctx context.Context, req *CreateNamespaceRequest) (*CreateNamespaceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
}
func (*UnimplementedNamespacesServer) Update(ctx context.Context, req *UpdateNamespaceRequest) (*UpdateNamespaceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Update not implemented")
}
func (*UnimplementedNamespacesServer) Delete(ctx context.Context, req *DeleteNamespaceRequest) (*types.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented")
}
func RegisterNamespacesServer(s *grpc.Server, srv NamespacesServer) { func RegisterNamespacesServer(s *grpc.Server, srv NamespacesServer) {
s.RegisterService(&_Namespaces_serviceDesc, srv) s.RegisterService(&_Namespaces_serviceDesc, srv)
} }
@ -703,7 +726,7 @@ var _Namespaces_serviceDesc = grpc.ServiceDesc{
func (m *Namespace) Marshal() (dAtA []byte, err error) { func (m *Namespace) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -711,43 +734,52 @@ func (m *Namespace) Marshal() (dAtA []byte, err error) {
} }
func (m *Namespace) MarshalTo(dAtA []byte) (int, error) { func (m *Namespace) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Namespace) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Name) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintNamespace(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
} }
if len(m.Labels) > 0 { if len(m.Labels) > 0 {
for k, _ := range m.Labels { for k := range m.Labels {
dAtA[i] = 0x12
i++
v := m.Labels[k] v := m.Labels[k]
mapSize := 1 + len(k) + sovNamespace(uint64(len(k))) + 1 + len(v) + sovNamespace(uint64(len(v))) baseI := i
i = encodeVarintNamespace(dAtA, i, uint64(mapSize)) i -= len(v)
dAtA[i] = 0xa copy(dAtA[i:], v)
i++
i = encodeVarintNamespace(dAtA, i, uint64(len(k)))
i += copy(dAtA[i:], k)
dAtA[i] = 0x12
i++
i = encodeVarintNamespace(dAtA, i, uint64(len(v))) i = encodeVarintNamespace(dAtA, i, uint64(len(v)))
i += copy(dAtA[i:], v) i--
dAtA[i] = 0x12
i -= len(k)
copy(dAtA[i:], k)
i = encodeVarintNamespace(dAtA, i, uint64(len(k)))
i--
dAtA[i] = 0xa
i = encodeVarintNamespace(dAtA, i, uint64(baseI-i))
i--
dAtA[i] = 0x12
} }
} }
if m.XXX_unrecognized != nil { if len(m.Name) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintNamespace(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func (m *GetNamespaceRequest) Marshal() (dAtA []byte, err error) { func (m *GetNamespaceRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -755,26 +787,33 @@ func (m *GetNamespaceRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *GetNamespaceRequest) MarshalTo(dAtA []byte) (int, error) { func (m *GetNamespaceRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *GetNamespaceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Name) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintNamespace(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if len(m.Name) > 0 {
i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintNamespace(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *GetNamespaceResponse) Marshal() (dAtA []byte, err error) { func (m *GetNamespaceResponse) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -782,28 +821,36 @@ func (m *GetNamespaceResponse) Marshal() (dAtA []byte, err error) {
} }
func (m *GetNamespaceResponse) MarshalTo(dAtA []byte) (int, error) { func (m *GetNamespaceResponse) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *GetNamespaceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
dAtA[i] = 0xa
i++
i = encodeVarintNamespace(dAtA, i, uint64(m.Namespace.Size()))
n1, err := m.Namespace.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n1
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil {
size, err := m.Namespace.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintNamespace(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
} }
func (m *ListNamespacesRequest) Marshal() (dAtA []byte, err error) { func (m *ListNamespacesRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -811,26 +858,33 @@ func (m *ListNamespacesRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *ListNamespacesRequest) MarshalTo(dAtA []byte) (int, error) { func (m *ListNamespacesRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ListNamespacesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Filter) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintNamespace(dAtA, i, uint64(len(m.Filter)))
i += copy(dAtA[i:], m.Filter)
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if len(m.Filter) > 0 {
i -= len(m.Filter)
copy(dAtA[i:], m.Filter)
i = encodeVarintNamespace(dAtA, i, uint64(len(m.Filter)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *ListNamespacesResponse) Marshal() (dAtA []byte, err error) { func (m *ListNamespacesResponse) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -838,32 +892,40 @@ func (m *ListNamespacesResponse) Marshal() (dAtA []byte, err error) {
} }
func (m *ListNamespacesResponse) MarshalTo(dAtA []byte) (int, error) { func (m *ListNamespacesResponse) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ListNamespacesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.Namespaces) > 0 { if len(m.Namespaces) > 0 {
for _, msg := range m.Namespaces { for iNdEx := len(m.Namespaces) - 1; iNdEx >= 0; iNdEx-- {
dAtA[i] = 0xa {
i++ size, err := m.Namespaces[iNdEx].MarshalToSizedBuffer(dAtA[:i])
i = encodeVarintNamespace(dAtA, i, uint64(msg.Size())) if err != nil {
n, err := msg.MarshalTo(dAtA[i:]) return 0, err
if err != nil { }
return 0, err i -= size
i = encodeVarintNamespace(dAtA, i, uint64(size))
} }
i += n i--
dAtA[i] = 0xa
} }
} }
if m.XXX_unrecognized != nil { return len(dAtA) - i, nil
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
} }
func (m *CreateNamespaceRequest) Marshal() (dAtA []byte, err error) { func (m *CreateNamespaceRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -871,28 +933,36 @@ func (m *CreateNamespaceRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *CreateNamespaceRequest) MarshalTo(dAtA []byte) (int, error) { func (m *CreateNamespaceRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *CreateNamespaceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
dAtA[i] = 0xa
i++
i = encodeVarintNamespace(dAtA, i, uint64(m.Namespace.Size()))
n2, err := m.Namespace.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n2
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil {
size, err := m.Namespace.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintNamespace(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
} }
func (m *CreateNamespaceResponse) Marshal() (dAtA []byte, err error) { func (m *CreateNamespaceResponse) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -900,28 +970,36 @@ func (m *CreateNamespaceResponse) Marshal() (dAtA []byte, err error) {
} }
func (m *CreateNamespaceResponse) MarshalTo(dAtA []byte) (int, error) { func (m *CreateNamespaceResponse) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *CreateNamespaceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
dAtA[i] = 0xa
i++
i = encodeVarintNamespace(dAtA, i, uint64(m.Namespace.Size()))
n3, err := m.Namespace.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n3
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil {
size, err := m.Namespace.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintNamespace(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
} }
func (m *UpdateNamespaceRequest) Marshal() (dAtA []byte, err error) { func (m *UpdateNamespaceRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -929,38 +1007,48 @@ func (m *UpdateNamespaceRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *UpdateNamespaceRequest) MarshalTo(dAtA []byte) (int, error) { func (m *UpdateNamespaceRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *UpdateNamespaceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
dAtA[i] = 0xa if m.XXX_unrecognized != nil {
i++ i -= len(m.XXX_unrecognized)
i = encodeVarintNamespace(dAtA, i, uint64(m.Namespace.Size())) copy(dAtA[i:], m.XXX_unrecognized)
n4, err := m.Namespace.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
} }
i += n4
if m.UpdateMask != nil { if m.UpdateMask != nil {
{
size, err := m.UpdateMask.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintNamespace(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12 dAtA[i] = 0x12
i++ }
i = encodeVarintNamespace(dAtA, i, uint64(m.UpdateMask.Size())) {
n5, err := m.UpdateMask.MarshalTo(dAtA[i:]) size, err := m.Namespace.MarshalToSizedBuffer(dAtA[:i])
if err != nil { if err != nil {
return 0, err return 0, err
} }
i += n5 i -= size
i = encodeVarintNamespace(dAtA, i, uint64(size))
} }
if m.XXX_unrecognized != nil { i--
i += copy(dAtA[i:], m.XXX_unrecognized) dAtA[i] = 0xa
} return len(dAtA) - i, nil
return i, nil
} }
func (m *UpdateNamespaceResponse) Marshal() (dAtA []byte, err error) { func (m *UpdateNamespaceResponse) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -968,28 +1056,36 @@ func (m *UpdateNamespaceResponse) Marshal() (dAtA []byte, err error) {
} }
func (m *UpdateNamespaceResponse) MarshalTo(dAtA []byte) (int, error) { func (m *UpdateNamespaceResponse) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *UpdateNamespaceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
dAtA[i] = 0xa
i++
i = encodeVarintNamespace(dAtA, i, uint64(m.Namespace.Size()))
n6, err := m.Namespace.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n6
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil {
size, err := m.Namespace.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintNamespace(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
} }
func (m *DeleteNamespaceRequest) Marshal() (dAtA []byte, err error) { func (m *DeleteNamespaceRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -997,30 +1093,39 @@ func (m *DeleteNamespaceRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *DeleteNamespaceRequest) MarshalTo(dAtA []byte) (int, error) { func (m *DeleteNamespaceRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *DeleteNamespaceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Name) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintNamespace(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if len(m.Name) > 0 {
i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintNamespace(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func encodeVarintNamespace(dAtA []byte, offset int, v uint64) int { func encodeVarintNamespace(dAtA []byte, offset int, v uint64) int {
offset -= sovNamespace(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *Namespace) Size() (n int) { func (m *Namespace) Size() (n int) {
if m == nil { if m == nil {
@ -1187,14 +1292,7 @@ func (m *DeleteNamespaceRequest) Size() (n int) {
} }
func sovNamespace(x uint64) (n int) { func sovNamespace(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozNamespace(x uint64) (n int) { func sozNamespace(x uint64) (n int) {
return sovNamespace(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovNamespace(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -1258,8 +1356,13 @@ func (this *ListNamespacesResponse) String() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
repeatedStringForNamespaces := "[]Namespace{"
for _, f := range this.Namespaces {
repeatedStringForNamespaces += strings.Replace(strings.Replace(f.String(), "Namespace", "Namespace", 1), `&`, ``, 1) + ","
}
repeatedStringForNamespaces += "}"
s := strings.Join([]string{`&ListNamespacesResponse{`, s := strings.Join([]string{`&ListNamespacesResponse{`,
`Namespaces:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Namespaces), "Namespace", "Namespace", 1), `&`, ``, 1) + `,`, `Namespaces:` + repeatedStringForNamespaces + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`, `}`,
}, "") }, "")
@ -2362,6 +2465,7 @@ func (m *DeleteNamespaceRequest) Unmarshal(dAtA []byte) error {
func skipNamespace(dAtA []byte) (n int, err error) { func skipNamespace(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -2393,10 +2497,8 @@ func skipNamespace(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -2417,55 +2519,30 @@ func skipNamespace(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthNamespace return 0, ErrInvalidLengthNamespace
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthNamespace
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowNamespace
}
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 := skipNamespace(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthNamespace
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupNamespace
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthNamespace
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthNamespace = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthNamespace = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowNamespace = fmt.Errorf("proto: integer overflow") ErrIntOverflowNamespace = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupNamespace = fmt.Errorf("proto: unexpected end of group")
) )

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,7 @@ import (
types "github.com/gogo/protobuf/types" types "github.com/gogo/protobuf/types"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
time "time" time "time"
@ -28,7 +29,7 @@ var _ = time.Kitchen
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type ForwardRequest struct { type ForwardRequest struct {
Envelope *Envelope `protobuf:"bytes,1,opt,name=envelope,proto3" json:"envelope,omitempty"` Envelope *Envelope `protobuf:"bytes,1,opt,name=envelope,proto3" json:"envelope,omitempty"`
@ -50,7 +51,7 @@ func (m *ForwardRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro
return xxx_messageInfo_ForwardRequest.Marshal(b, m, deterministic) return xxx_messageInfo_ForwardRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -92,7 +93,7 @@ func (m *Envelope) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Envelope.Marshal(b, m, deterministic) return xxx_messageInfo_Envelope.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -179,7 +180,7 @@ func (m *Envelope) Field(fieldpath []string) (string, bool) {
func (m *ForwardRequest) Marshal() (dAtA []byte, err error) { func (m *ForwardRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -187,30 +188,38 @@ func (m *ForwardRequest) Marshal() (dAtA []byte, err error) {
} }
func (m *ForwardRequest) MarshalTo(dAtA []byte) (int, error) { func (m *ForwardRequest) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ForwardRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Envelope != nil {
dAtA[i] = 0xa
i++
i = encodeVarintEvents(dAtA, i, uint64(m.Envelope.Size()))
n1, err := m.Envelope.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n1
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if m.Envelope != nil {
{
size, err := m.Envelope.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintEvents(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *Envelope) Marshal() (dAtA []byte, err error) { func (m *Envelope) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -218,54 +227,66 @@ func (m *Envelope) Marshal() (dAtA []byte, err error) {
} }
func (m *Envelope) MarshalTo(dAtA []byte) (int, error) { func (m *Envelope) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Envelope) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
dAtA[i] = 0xa if m.XXX_unrecognized != nil {
i++ i -= len(m.XXX_unrecognized)
i = encodeVarintEvents(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp))) copy(dAtA[i:], m.XXX_unrecognized)
n2, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i:])
if err != nil {
return 0, err
}
i += n2
if len(m.Namespace) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintEvents(dAtA, i, uint64(len(m.Namespace)))
i += copy(dAtA[i:], m.Namespace)
}
if len(m.Topic) > 0 {
dAtA[i] = 0x1a
i++
i = encodeVarintEvents(dAtA, i, uint64(len(m.Topic)))
i += copy(dAtA[i:], m.Topic)
} }
if m.Event != nil { if m.Event != nil {
dAtA[i] = 0x22 {
i++ size, err := m.Event.MarshalToSizedBuffer(dAtA[:i])
i = encodeVarintEvents(dAtA, i, uint64(m.Event.Size())) if err != nil {
n3, err := m.Event.MarshalTo(dAtA[i:]) return 0, err
if err != nil { }
return 0, err i -= size
i = encodeVarintEvents(dAtA, i, uint64(size))
} }
i += n3 i--
dAtA[i] = 0x22
} }
if m.XXX_unrecognized != nil { if len(m.Topic) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Topic)
copy(dAtA[i:], m.Topic)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Topic)))
i--
dAtA[i] = 0x1a
} }
return i, nil if len(m.Namespace) > 0 {
i -= len(m.Namespace)
copy(dAtA[i:], m.Namespace)
i = encodeVarintEvents(dAtA, i, uint64(len(m.Namespace)))
i--
dAtA[i] = 0x12
}
n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):])
if err3 != nil {
return 0, err3
}
i -= n3
i = encodeVarintEvents(dAtA, i, uint64(n3))
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
} }
func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { func encodeVarintEvents(dAtA []byte, offset int, v uint64) int {
offset -= sovEvents(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *ForwardRequest) Size() (n int) { func (m *ForwardRequest) Size() (n int) {
if m == nil { if m == nil {
@ -310,14 +331,7 @@ func (m *Envelope) Size() (n int) {
} }
func sovEvents(x uint64) (n int) { func sovEvents(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozEvents(x uint64) (n int) { func sozEvents(x uint64) (n int) {
return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -327,7 +341,7 @@ func (this *ForwardRequest) String() string {
return "nil" return "nil"
} }
s := strings.Join([]string{`&ForwardRequest{`, s := strings.Join([]string{`&ForwardRequest{`,
`Envelope:` + strings.Replace(fmt.Sprintf("%v", this.Envelope), "Envelope", "Envelope", 1) + `,`, `Envelope:` + strings.Replace(this.Envelope.String(), "Envelope", "Envelope", 1) + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`, `}`,
}, "") }, "")
@ -338,7 +352,7 @@ func (this *Envelope) String() string {
return "nil" return "nil"
} }
s := strings.Join([]string{`&Envelope{`, s := strings.Join([]string{`&Envelope{`,
`Timestamp:` + strings.Replace(strings.Replace(this.Timestamp.String(), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`, `Timestamp:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Timestamp), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`,
`Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`,
`Topic:` + fmt.Sprintf("%v", this.Topic) + `,`, `Topic:` + fmt.Sprintf("%v", this.Topic) + `,`,
`Event:` + strings.Replace(fmt.Sprintf("%v", this.Event), "Any", "types.Any", 1) + `,`, `Event:` + strings.Replace(fmt.Sprintf("%v", this.Event), "Any", "types.Any", 1) + `,`,
@ -669,6 +683,7 @@ func (m *Envelope) Unmarshal(dAtA []byte) error {
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
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -700,10 +715,8 @@ func skipEvents(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -724,55 +737,30 @@ func skipEvents(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthEvents return 0, ErrInvalidLengthEvents
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthEvents
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEvents
}
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 := skipEvents(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthEvents
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupEvents
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthEvents
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow") ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -9,8 +9,11 @@ import (
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
types "github.com/gogo/protobuf/types" types "github.com/gogo/protobuf/types"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -24,7 +27,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type VersionResponse struct { type VersionResponse struct {
Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
@ -47,7 +50,7 @@ func (m *VersionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, err
return xxx_messageInfo_VersionResponse.Marshal(b, m, deterministic) return xxx_messageInfo_VersionResponse.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -131,6 +134,14 @@ type VersionServer interface {
Version(context.Context, *types.Empty) (*VersionResponse, error) Version(context.Context, *types.Empty) (*VersionResponse, error)
} }
// UnimplementedVersionServer can be embedded to have forward compatible implementations.
type UnimplementedVersionServer struct {
}
func (*UnimplementedVersionServer) Version(ctx context.Context, req *types.Empty) (*VersionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Version not implemented")
}
func RegisterVersionServer(s *grpc.Server, srv VersionServer) { func RegisterVersionServer(s *grpc.Server, srv VersionServer) {
s.RegisterService(&_Version_serviceDesc, srv) s.RegisterService(&_Version_serviceDesc, srv)
} }
@ -169,7 +180,7 @@ var _Version_serviceDesc = grpc.ServiceDesc{
func (m *VersionResponse) Marshal() (dAtA []byte, err error) { func (m *VersionResponse) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -177,36 +188,46 @@ func (m *VersionResponse) Marshal() (dAtA []byte, err error) {
} }
func (m *VersionResponse) MarshalTo(dAtA []byte) (int, error) { func (m *VersionResponse) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *VersionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Version) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintVersion(dAtA, i, uint64(len(m.Version)))
i += copy(dAtA[i:], m.Version)
} }
if len(m.Revision) > 0 { if len(m.Revision) > 0 {
dAtA[i] = 0x12 i -= len(m.Revision)
i++ copy(dAtA[i:], m.Revision)
i = encodeVarintVersion(dAtA, i, uint64(len(m.Revision))) i = encodeVarintVersion(dAtA, i, uint64(len(m.Revision)))
i += copy(dAtA[i:], m.Revision) i--
dAtA[i] = 0x12
} }
if m.XXX_unrecognized != nil { if len(m.Version) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Version)
copy(dAtA[i:], m.Version)
i = encodeVarintVersion(dAtA, i, uint64(len(m.Version)))
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func encodeVarintVersion(dAtA []byte, offset int, v uint64) int { func encodeVarintVersion(dAtA []byte, offset int, v uint64) int {
offset -= sovVersion(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *VersionResponse) Size() (n int) { func (m *VersionResponse) Size() (n int) {
if m == nil { if m == nil {
@ -229,14 +250,7 @@ func (m *VersionResponse) Size() (n int) {
} }
func sovVersion(x uint64) (n int) { func sovVersion(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozVersion(x uint64) (n int) { func sozVersion(x uint64) (n int) {
return sovVersion(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovVersion(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -382,6 +396,7 @@ func (m *VersionResponse) Unmarshal(dAtA []byte) error {
func skipVersion(dAtA []byte) (n int, err error) { func skipVersion(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -413,10 +428,8 @@ func skipVersion(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -437,55 +450,30 @@ func skipVersion(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthVersion return 0, ErrInvalidLengthVersion
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthVersion
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowVersion
}
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 := skipVersion(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthVersion
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupVersion
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthVersion
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthVersion = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthVersion = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowVersion = fmt.Errorf("proto: integer overflow") ErrIntOverflowVersion = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupVersion = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -10,6 +10,7 @@ import (
github_com_opencontainers_go_digest "github.com/opencontainers/go-digest" github_com_opencontainers_go_digest "github.com/opencontainers/go-digest"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -23,7 +24,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// Descriptor describes a blob in a content store. // Descriptor describes a blob in a content store.
// //
@ -53,7 +54,7 @@ func (m *Descriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Descriptor.Marshal(b, m, deterministic) return xxx_messageInfo_Descriptor.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -108,7 +109,7 @@ var fileDescriptor_37f958df3707db9e = []byte{
func (m *Descriptor) Marshal() (dAtA []byte, err error) { func (m *Descriptor) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -116,58 +117,70 @@ func (m *Descriptor) Marshal() (dAtA []byte, err error) {
} }
func (m *Descriptor) MarshalTo(dAtA []byte) (int, error) { func (m *Descriptor) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Descriptor) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.MediaType) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintDescriptor(dAtA, i, uint64(len(m.MediaType)))
i += copy(dAtA[i:], m.MediaType)
}
if len(m.Digest) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintDescriptor(dAtA, i, uint64(len(m.Digest)))
i += copy(dAtA[i:], m.Digest)
}
if m.Size_ != 0 {
dAtA[i] = 0x18
i++
i = encodeVarintDescriptor(dAtA, i, uint64(m.Size_))
} }
if len(m.Annotations) > 0 { if len(m.Annotations) > 0 {
for k, _ := range m.Annotations { for k := range m.Annotations {
dAtA[i] = 0x2a
i++
v := m.Annotations[k] v := m.Annotations[k]
mapSize := 1 + len(k) + sovDescriptor(uint64(len(k))) + 1 + len(v) + sovDescriptor(uint64(len(v))) baseI := i
i = encodeVarintDescriptor(dAtA, i, uint64(mapSize)) i -= len(v)
dAtA[i] = 0xa copy(dAtA[i:], v)
i++
i = encodeVarintDescriptor(dAtA, i, uint64(len(k)))
i += copy(dAtA[i:], k)
dAtA[i] = 0x12
i++
i = encodeVarintDescriptor(dAtA, i, uint64(len(v))) i = encodeVarintDescriptor(dAtA, i, uint64(len(v)))
i += copy(dAtA[i:], v) i--
dAtA[i] = 0x12
i -= len(k)
copy(dAtA[i:], k)
i = encodeVarintDescriptor(dAtA, i, uint64(len(k)))
i--
dAtA[i] = 0xa
i = encodeVarintDescriptor(dAtA, i, uint64(baseI-i))
i--
dAtA[i] = 0x2a
} }
} }
if m.XXX_unrecognized != nil { if m.Size_ != 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i = encodeVarintDescriptor(dAtA, i, uint64(m.Size_))
i--
dAtA[i] = 0x18
} }
return i, nil if len(m.Digest) > 0 {
i -= len(m.Digest)
copy(dAtA[i:], m.Digest)
i = encodeVarintDescriptor(dAtA, i, uint64(len(m.Digest)))
i--
dAtA[i] = 0x12
}
if len(m.MediaType) > 0 {
i -= len(m.MediaType)
copy(dAtA[i:], m.MediaType)
i = encodeVarintDescriptor(dAtA, i, uint64(len(m.MediaType)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func encodeVarintDescriptor(dAtA []byte, offset int, v uint64) int { func encodeVarintDescriptor(dAtA []byte, offset int, v uint64) int {
offset -= sovDescriptor(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *Descriptor) Size() (n int) { func (m *Descriptor) Size() (n int) {
if m == nil { if m == nil {
@ -201,14 +214,7 @@ func (m *Descriptor) Size() (n int) {
} }
func sovDescriptor(x uint64) (n int) { func sovDescriptor(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozDescriptor(x uint64) (n int) { func sozDescriptor(x uint64) (n int) {
return sovDescriptor(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovDescriptor(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -512,6 +518,7 @@ func (m *Descriptor) Unmarshal(dAtA []byte) error {
func skipDescriptor(dAtA []byte) (n int, err error) { func skipDescriptor(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -543,10 +550,8 @@ func skipDescriptor(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -567,55 +572,30 @@ func skipDescriptor(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthDescriptor return 0, ErrInvalidLengthDescriptor
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthDescriptor
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowDescriptor
}
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 := skipDescriptor(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthDescriptor
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupDescriptor
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthDescriptor
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthDescriptor = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthDescriptor = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowDescriptor = fmt.Errorf("proto: integer overflow") ErrIntOverflowDescriptor = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupDescriptor = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -10,6 +10,7 @@ import (
types "github.com/gogo/protobuf/types" types "github.com/gogo/protobuf/types"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
time "time" time "time"
@ -25,7 +26,7 @@ var _ = time.Kitchen
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type Metric struct { type Metric struct {
Timestamp time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,stdtime" json:"timestamp"` Timestamp time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,stdtime" json:"timestamp"`
@ -49,7 +50,7 @@ func (m *Metric) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Metric.Marshal(b, m, deterministic) return xxx_messageInfo_Metric.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -100,7 +101,7 @@ var fileDescriptor_8d594d87edf6e6bc = []byte{
func (m *Metric) Marshal() (dAtA []byte, err error) { func (m *Metric) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -108,48 +109,59 @@ func (m *Metric) Marshal() (dAtA []byte, err error) {
} }
func (m *Metric) MarshalTo(dAtA []byte) (int, error) { func (m *Metric) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Metric) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
dAtA[i] = 0xa if m.XXX_unrecognized != nil {
i++ i -= len(m.XXX_unrecognized)
i = encodeVarintMetrics(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp))) copy(dAtA[i:], m.XXX_unrecognized)
n1, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i:])
if err != nil {
return 0, err
}
i += n1
if len(m.ID) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintMetrics(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ID)
} }
if m.Data != nil { if m.Data != nil {
dAtA[i] = 0x1a {
i++ size, err := m.Data.MarshalToSizedBuffer(dAtA[:i])
i = encodeVarintMetrics(dAtA, i, uint64(m.Data.Size())) if err != nil {
n2, err := m.Data.MarshalTo(dAtA[i:]) return 0, err
if err != nil { }
return 0, err i -= size
i = encodeVarintMetrics(dAtA, i, uint64(size))
} }
i += n2 i--
dAtA[i] = 0x1a
} }
if m.XXX_unrecognized != nil { if len(m.ID) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.ID)
copy(dAtA[i:], m.ID)
i = encodeVarintMetrics(dAtA, i, uint64(len(m.ID)))
i--
dAtA[i] = 0x12
} }
return i, nil n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):])
if err2 != nil {
return 0, err2
}
i -= n2
i = encodeVarintMetrics(dAtA, i, uint64(n2))
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
} }
func encodeVarintMetrics(dAtA []byte, offset int, v uint64) int { func encodeVarintMetrics(dAtA []byte, offset int, v uint64) int {
offset -= sovMetrics(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *Metric) Size() (n int) { func (m *Metric) Size() (n int) {
if m == nil { if m == nil {
@ -174,14 +186,7 @@ func (m *Metric) Size() (n int) {
} }
func sovMetrics(x uint64) (n int) { func sovMetrics(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozMetrics(x uint64) (n int) { func sozMetrics(x uint64) (n int) {
return sovMetrics(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovMetrics(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -191,7 +196,7 @@ func (this *Metric) String() string {
return "nil" return "nil"
} }
s := strings.Join([]string{`&Metric{`, s := strings.Join([]string{`&Metric{`,
`Timestamp:` + strings.Replace(strings.Replace(this.Timestamp.String(), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`, `Timestamp:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Timestamp), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`,
`ID:` + fmt.Sprintf("%v", this.ID) + `,`, `ID:` + fmt.Sprintf("%v", this.ID) + `,`,
`Data:` + strings.Replace(fmt.Sprintf("%v", this.Data), "Any", "types.Any", 1) + `,`, `Data:` + strings.Replace(fmt.Sprintf("%v", this.Data), "Any", "types.Any", 1) + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
@ -365,6 +370,7 @@ func (m *Metric) Unmarshal(dAtA []byte) error {
func skipMetrics(dAtA []byte) (n int, err error) { func skipMetrics(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -396,10 +402,8 @@ func skipMetrics(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -420,55 +424,30 @@ func skipMetrics(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthMetrics return 0, ErrInvalidLengthMetrics
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthMetrics
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowMetrics
}
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 := skipMetrics(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthMetrics
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupMetrics
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthMetrics
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthMetrics = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthMetrics = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowMetrics = fmt.Errorf("proto: integer overflow") ErrIntOverflowMetrics = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupMetrics = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -8,6 +8,7 @@ import (
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -21,7 +22,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// Mount describes mounts for a container. // Mount describes mounts for a container.
// //
@ -58,7 +59,7 @@ func (m *Mount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Mount.Marshal(b, m, deterministic) return xxx_messageInfo_Mount.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -105,7 +106,7 @@ var fileDescriptor_920196890d4a7b9f = []byte{
func (m *Mount) Marshal() (dAtA []byte, err error) { func (m *Mount) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -113,57 +114,62 @@ func (m *Mount) Marshal() (dAtA []byte, err error) {
} }
func (m *Mount) MarshalTo(dAtA []byte) (int, error) { func (m *Mount) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Mount) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Type) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintMount(dAtA, i, uint64(len(m.Type)))
i += copy(dAtA[i:], m.Type)
}
if len(m.Source) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintMount(dAtA, i, uint64(len(m.Source)))
i += copy(dAtA[i:], m.Source)
}
if len(m.Target) > 0 {
dAtA[i] = 0x1a
i++
i = encodeVarintMount(dAtA, i, uint64(len(m.Target)))
i += copy(dAtA[i:], m.Target)
} }
if len(m.Options) > 0 { if len(m.Options) > 0 {
for _, s := range m.Options { for iNdEx := len(m.Options) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Options[iNdEx])
copy(dAtA[i:], m.Options[iNdEx])
i = encodeVarintMount(dAtA, i, uint64(len(m.Options[iNdEx])))
i--
dAtA[i] = 0x22 dAtA[i] = 0x22
i++
l = len(s)
for l >= 1<<7 {
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
l >>= 7
i++
}
dAtA[i] = uint8(l)
i++
i += copy(dAtA[i:], s)
} }
} }
if m.XXX_unrecognized != nil { if len(m.Target) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Target)
copy(dAtA[i:], m.Target)
i = encodeVarintMount(dAtA, i, uint64(len(m.Target)))
i--
dAtA[i] = 0x1a
} }
return i, nil if len(m.Source) > 0 {
i -= len(m.Source)
copy(dAtA[i:], m.Source)
i = encodeVarintMount(dAtA, i, uint64(len(m.Source)))
i--
dAtA[i] = 0x12
}
if len(m.Type) > 0 {
i -= len(m.Type)
copy(dAtA[i:], m.Type)
i = encodeVarintMount(dAtA, i, uint64(len(m.Type)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func encodeVarintMount(dAtA []byte, offset int, v uint64) int { func encodeVarintMount(dAtA []byte, offset int, v uint64) int {
offset -= sovMount(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *Mount) Size() (n int) { func (m *Mount) Size() (n int) {
if m == nil { if m == nil {
@ -196,14 +202,7 @@ func (m *Mount) Size() (n int) {
} }
func sovMount(x uint64) (n int) { func sovMount(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozMount(x uint64) (n int) { func sozMount(x uint64) (n int) {
return sovMount(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovMount(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -415,6 +414,7 @@ func (m *Mount) Unmarshal(dAtA []byte) error {
func skipMount(dAtA []byte) (n int, err error) { func skipMount(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -446,10 +446,8 @@ func skipMount(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -470,55 +468,30 @@ func skipMount(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthMount return 0, ErrInvalidLengthMount
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthMount
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowMount
}
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 := skipMount(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthMount
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupMount
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthMount
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthMount = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthMount = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowMount = fmt.Errorf("proto: integer overflow") ErrIntOverflowMount = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupMount = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -8,6 +8,7 @@ import (
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -21,7 +22,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// Platform follows the structure of the OCI platform specification, from // Platform follows the structure of the OCI platform specification, from
// descriptors. // descriptors.
@ -47,7 +48,7 @@ func (m *Platform) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Platform.Marshal(b, m, deterministic) return xxx_messageInfo_Platform.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -94,7 +95,7 @@ var fileDescriptor_24ba7a4b83e2367e = []byte{
func (m *Platform) Marshal() (dAtA []byte, err error) { func (m *Platform) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -102,42 +103,53 @@ func (m *Platform) Marshal() (dAtA []byte, err error) {
} }
func (m *Platform) MarshalTo(dAtA []byte) (int, error) { func (m *Platform) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Platform) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.OS) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintPlatform(dAtA, i, uint64(len(m.OS)))
i += copy(dAtA[i:], m.OS)
}
if len(m.Architecture) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintPlatform(dAtA, i, uint64(len(m.Architecture)))
i += copy(dAtA[i:], m.Architecture)
} }
if len(m.Variant) > 0 { if len(m.Variant) > 0 {
dAtA[i] = 0x1a i -= len(m.Variant)
i++ copy(dAtA[i:], m.Variant)
i = encodeVarintPlatform(dAtA, i, uint64(len(m.Variant))) i = encodeVarintPlatform(dAtA, i, uint64(len(m.Variant)))
i += copy(dAtA[i:], m.Variant) i--
dAtA[i] = 0x1a
} }
if m.XXX_unrecognized != nil { if len(m.Architecture) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Architecture)
copy(dAtA[i:], m.Architecture)
i = encodeVarintPlatform(dAtA, i, uint64(len(m.Architecture)))
i--
dAtA[i] = 0x12
} }
return i, nil if len(m.OS) > 0 {
i -= len(m.OS)
copy(dAtA[i:], m.OS)
i = encodeVarintPlatform(dAtA, i, uint64(len(m.OS)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func encodeVarintPlatform(dAtA []byte, offset int, v uint64) int { func encodeVarintPlatform(dAtA []byte, offset int, v uint64) int {
offset -= sovPlatform(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *Platform) Size() (n int) { func (m *Platform) Size() (n int) {
if m == nil { if m == nil {
@ -164,14 +176,7 @@ func (m *Platform) Size() (n int) {
} }
func sovPlatform(x uint64) (n int) { func sovPlatform(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozPlatform(x uint64) (n int) { func sozPlatform(x uint64) (n int) {
return sovPlatform(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovPlatform(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -350,6 +355,7 @@ func (m *Platform) Unmarshal(dAtA []byte) error {
func skipPlatform(dAtA []byte) (n int, err error) { func skipPlatform(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -381,10 +387,8 @@ func skipPlatform(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -405,55 +409,30 @@ func skipPlatform(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthPlatform return 0, ErrInvalidLengthPlatform
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthPlatform
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowPlatform
}
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 := skipPlatform(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthPlatform
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupPlatform
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthPlatform
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthPlatform = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthPlatform = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowPlatform = fmt.Errorf("proto: integer overflow") ErrIntOverflowPlatform = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupPlatform = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -10,6 +10,7 @@ import (
types "github.com/gogo/protobuf/types" types "github.com/gogo/protobuf/types"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
time "time" time "time"
@ -25,7 +26,7 @@ var _ = time.Kitchen
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type Status int32 type Status int32
@ -93,7 +94,7 @@ func (m *Process) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Process.Marshal(b, m, deterministic) return xxx_messageInfo_Process.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -137,7 +138,7 @@ func (m *ProcessInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return xxx_messageInfo_ProcessInfo.Marshal(b, m, deterministic) return xxx_messageInfo_ProcessInfo.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -208,7 +209,7 @@ var fileDescriptor_391ef18c8ab0dc16 = []byte{
func (m *Process) Marshal() (dAtA []byte, err error) { func (m *Process) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -216,83 +217,94 @@ func (m *Process) Marshal() (dAtA []byte, err error) {
} }
func (m *Process) MarshalTo(dAtA []byte) (int, error) { func (m *Process) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Process) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ContainerID) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
i += copy(dAtA[i:], m.ContainerID)
} }
if len(m.ID) > 0 { n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt):])
dAtA[i] = 0x12 if err1 != nil {
i++ return 0, err1
i = encodeVarintTask(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ID)
} }
if m.Pid != 0 { i -= n1
dAtA[i] = 0x18 i = encodeVarintTask(dAtA, i, uint64(n1))
i++ i--
i = encodeVarintTask(dAtA, i, uint64(m.Pid)) dAtA[i] = 0x52
} if m.ExitStatus != 0 {
if m.Status != 0 { i = encodeVarintTask(dAtA, i, uint64(m.ExitStatus))
dAtA[i] = 0x20 i--
i++ dAtA[i] = 0x48
i = encodeVarintTask(dAtA, i, uint64(m.Status))
}
if len(m.Stdin) > 0 {
dAtA[i] = 0x2a
i++
i = encodeVarintTask(dAtA, i, uint64(len(m.Stdin)))
i += copy(dAtA[i:], m.Stdin)
}
if len(m.Stdout) > 0 {
dAtA[i] = 0x32
i++
i = encodeVarintTask(dAtA, i, uint64(len(m.Stdout)))
i += copy(dAtA[i:], m.Stdout)
}
if len(m.Stderr) > 0 {
dAtA[i] = 0x3a
i++
i = encodeVarintTask(dAtA, i, uint64(len(m.Stderr)))
i += copy(dAtA[i:], m.Stderr)
} }
if m.Terminal { if m.Terminal {
dAtA[i] = 0x40 i--
i++
if m.Terminal { if m.Terminal {
dAtA[i] = 1 dAtA[i] = 1
} else { } else {
dAtA[i] = 0 dAtA[i] = 0
} }
i++ i--
dAtA[i] = 0x40
} }
if m.ExitStatus != 0 { if len(m.Stderr) > 0 {
dAtA[i] = 0x48 i -= len(m.Stderr)
i++ copy(dAtA[i:], m.Stderr)
i = encodeVarintTask(dAtA, i, uint64(m.ExitStatus)) i = encodeVarintTask(dAtA, i, uint64(len(m.Stderr)))
i--
dAtA[i] = 0x3a
} }
dAtA[i] = 0x52 if len(m.Stdout) > 0 {
i++ i -= len(m.Stdout)
i = encodeVarintTask(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt))) copy(dAtA[i:], m.Stdout)
n1, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i:]) i = encodeVarintTask(dAtA, i, uint64(len(m.Stdout)))
if err != nil { i--
return 0, err dAtA[i] = 0x32
} }
i += n1 if len(m.Stdin) > 0 {
if m.XXX_unrecognized != nil { i -= len(m.Stdin)
i += copy(dAtA[i:], m.XXX_unrecognized) copy(dAtA[i:], m.Stdin)
i = encodeVarintTask(dAtA, i, uint64(len(m.Stdin)))
i--
dAtA[i] = 0x2a
} }
return i, nil if m.Status != 0 {
i = encodeVarintTask(dAtA, i, uint64(m.Status))
i--
dAtA[i] = 0x20
}
if m.Pid != 0 {
i = encodeVarintTask(dAtA, i, uint64(m.Pid))
i--
dAtA[i] = 0x18
}
if len(m.ID) > 0 {
i -= len(m.ID)
copy(dAtA[i:], m.ID)
i = encodeVarintTask(dAtA, i, uint64(len(m.ID)))
i--
dAtA[i] = 0x12
}
if len(m.ContainerID) > 0 {
i -= len(m.ContainerID)
copy(dAtA[i:], m.ContainerID)
i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *ProcessInfo) Marshal() (dAtA []byte, err error) { func (m *ProcessInfo) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -300,39 +312,49 @@ func (m *ProcessInfo) Marshal() (dAtA []byte, err error) {
} }
func (m *ProcessInfo) MarshalTo(dAtA []byte) (int, error) { func (m *ProcessInfo) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ProcessInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Pid != 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0x8 i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintTask(dAtA, i, uint64(m.Pid))
} }
if m.Info != nil { if m.Info != nil {
dAtA[i] = 0x12 {
i++ size, err := m.Info.MarshalToSizedBuffer(dAtA[:i])
i = encodeVarintTask(dAtA, i, uint64(m.Info.Size())) if err != nil {
n2, err := m.Info.MarshalTo(dAtA[i:]) return 0, err
if err != nil { }
return 0, err i -= size
i = encodeVarintTask(dAtA, i, uint64(size))
} }
i += n2 i--
dAtA[i] = 0x12
} }
if m.XXX_unrecognized != nil { if m.Pid != 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i = encodeVarintTask(dAtA, i, uint64(m.Pid))
i--
dAtA[i] = 0x8
} }
return i, nil return len(dAtA) - i, nil
} }
func encodeVarintTask(dAtA []byte, offset int, v uint64) int { func encodeVarintTask(dAtA []byte, offset int, v uint64) int {
offset -= sovTask(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *Process) Size() (n int) { func (m *Process) Size() (n int) {
if m == nil { if m == nil {
@ -400,14 +422,7 @@ func (m *ProcessInfo) Size() (n int) {
} }
func sovTask(x uint64) (n int) { func sovTask(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozTask(x uint64) (n int) { func sozTask(x uint64) (n int) {
return sovTask(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovTask(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -426,7 +441,7 @@ func (this *Process) String() string {
`Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`, `Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`,
`Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`,
`ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`,
`ExitedAt:` + strings.Replace(strings.Replace(this.ExitedAt.String(), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`, `ExitedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ExitedAt), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`, `}`,
}, "") }, "")
@ -888,6 +903,7 @@ func (m *ProcessInfo) Unmarshal(dAtA []byte) error {
func skipTask(dAtA []byte) (n int, err error) { func skipTask(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -919,10 +935,8 @@ func skipTask(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -943,55 +957,30 @@ func skipTask(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthTask return 0, ErrInvalidLengthTask
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthTask
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTask
}
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 := skipTask(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthTask
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupTask
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthTask
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthTask = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthTask = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowTask = fmt.Errorf("proto: integer overflow") ErrIntOverflowTask = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupTask = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -64,6 +64,7 @@ import (
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors" "github.com/pkg/errors"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/backoff"
"google.golang.org/grpc/health/grpc_health_v1" "google.golang.org/grpc/health/grpc_health_v1"
) )
@ -110,11 +111,16 @@ func New(address string, opts ...ClientOpt) (*Client, error) {
c.services = *copts.services c.services = *copts.services
} }
if address != "" { if address != "" {
backoffConfig := backoff.DefaultConfig
backoffConfig.MaxDelay = 3 * time.Second
connParams := grpc.ConnectParams{
Backoff: backoffConfig,
}
gopts := []grpc.DialOption{ gopts := []grpc.DialOption{
grpc.WithBlock(), grpc.WithBlock(),
grpc.WithInsecure(), grpc.WithInsecure(),
grpc.FailOnNonTempDialError(true), grpc.FailOnNonTempDialError(true),
grpc.WithBackoffMaxDelay(3 * time.Second), grpc.WithConnectParams(connParams),
grpc.WithContextDialer(dialer.ContextDialer), grpc.WithContextDialer(dialer.ContextDialer),
// TODO(stevvooe): We may need to allow configuration of this on the client. // TODO(stevvooe): We may need to allow configuration of this on the client.

View File

@ -32,6 +32,7 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/urfave/cli" "github.com/urfave/cli"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/backoff"
) )
var publishCommand = cli.Command{ var publishCommand = cli.Command{
@ -92,12 +93,17 @@ func connectEvents(address string) (eventsapi.EventsClient, error) {
} }
func connect(address string, d func(gocontext.Context, string) (net.Conn, error)) (*grpc.ClientConn, error) { func connect(address string, d func(gocontext.Context, string) (net.Conn, error)) (*grpc.ClientConn, error) {
backoffConfig := backoff.DefaultConfig
backoffConfig.MaxDelay = 3 * time.Second
connParams := grpc.ConnectParams{
Backoff: backoffConfig,
}
gopts := []grpc.DialOption{ gopts := []grpc.DialOption{
grpc.WithBlock(), grpc.WithBlock(),
grpc.WithInsecure(), grpc.WithInsecure(),
grpc.WithContextDialer(d), grpc.WithContextDialer(d),
grpc.FailOnNonTempDialError(true), grpc.FailOnNonTempDialError(true),
grpc.WithBackoffMaxDelay(3 * time.Second), grpc.WithConnectParams(connParams),
} }
ctx, cancel := gocontext.WithTimeout(gocontext.Background(), 2*time.Second) ctx, cancel := gocontext.WithTimeout(gocontext.Background(), 2*time.Second)
defer cancel() defer cancel()

View File

@ -19,7 +19,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
var E_FieldpathAll = &proto.ExtensionDesc{ var E_FieldpathAll = &proto.ExtensionDesc{
ExtendedType: (*descriptor.FileOptions)(nil), ExtendedType: (*descriptor.FileOptions)(nil),

View File

@ -8,6 +8,7 @@ import (
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -21,7 +22,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type RuncOptions struct { type RuncOptions struct {
Runtime string `protobuf:"bytes,1,opt,name=runtime,proto3" json:"runtime,omitempty"` Runtime string `protobuf:"bytes,1,opt,name=runtime,proto3" json:"runtime,omitempty"`
@ -46,7 +47,7 @@ func (m *RuncOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return xxx_messageInfo_RuncOptions.Marshal(b, m, deterministic) return xxx_messageInfo_RuncOptions.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -97,7 +98,7 @@ func (m *CreateOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error
return xxx_messageInfo_CreateOptions.Marshal(b, m, deterministic) return xxx_messageInfo_CreateOptions.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -144,7 +145,7 @@ func (m *CheckpointOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, e
return xxx_messageInfo_CheckpointOptions.Marshal(b, m, deterministic) return xxx_messageInfo_CheckpointOptions.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -183,7 +184,7 @@ func (m *ProcessDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro
return xxx_messageInfo_ProcessDetails.Marshal(b, m, deterministic) return xxx_messageInfo_ProcessDetails.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -258,7 +259,7 @@ var fileDescriptor_d20e2ba8b3cc58b9 = []byte{
func (m *RuncOptions) Marshal() (dAtA []byte, err error) { func (m *RuncOptions) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -266,48 +267,57 @@ func (m *RuncOptions) Marshal() (dAtA []byte, err error) {
} }
func (m *RuncOptions) MarshalTo(dAtA []byte) (int, error) { func (m *RuncOptions) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *RuncOptions) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Runtime) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintRunc(dAtA, i, uint64(len(m.Runtime)))
i += copy(dAtA[i:], m.Runtime)
}
if len(m.RuntimeRoot) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintRunc(dAtA, i, uint64(len(m.RuntimeRoot)))
i += copy(dAtA[i:], m.RuntimeRoot)
}
if len(m.CriuPath) > 0 {
dAtA[i] = 0x1a
i++
i = encodeVarintRunc(dAtA, i, uint64(len(m.CriuPath)))
i += copy(dAtA[i:], m.CriuPath)
} }
if m.SystemdCgroup { if m.SystemdCgroup {
dAtA[i] = 0x20 i--
i++
if m.SystemdCgroup { if m.SystemdCgroup {
dAtA[i] = 1 dAtA[i] = 1
} else { } else {
dAtA[i] = 0 dAtA[i] = 0
} }
i++ i--
dAtA[i] = 0x20
} }
if m.XXX_unrecognized != nil { if len(m.CriuPath) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.CriuPath)
copy(dAtA[i:], m.CriuPath)
i = encodeVarintRunc(dAtA, i, uint64(len(m.CriuPath)))
i--
dAtA[i] = 0x1a
} }
return i, nil if len(m.RuntimeRoot) > 0 {
i -= len(m.RuntimeRoot)
copy(dAtA[i:], m.RuntimeRoot)
i = encodeVarintRunc(dAtA, i, uint64(len(m.RuntimeRoot)))
i--
dAtA[i] = 0x12
}
if len(m.Runtime) > 0 {
i -= len(m.Runtime)
copy(dAtA[i:], m.Runtime)
i = encodeVarintRunc(dAtA, i, uint64(len(m.Runtime)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *CreateOptions) Marshal() (dAtA []byte, err error) { func (m *CreateOptions) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -315,129 +325,133 @@ func (m *CreateOptions) Marshal() (dAtA []byte, err error) {
} }
func (m *CreateOptions) MarshalTo(dAtA []byte) (int, error) { func (m *CreateOptions) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *CreateOptions) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.NoPivotRoot { if m.XXX_unrecognized != nil {
dAtA[i] = 0x8 i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
if m.NoPivotRoot {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
} }
if m.OpenTcp { if len(m.CriuImagePath) > 0 {
dAtA[i] = 0x10 i -= len(m.CriuImagePath)
i++ copy(dAtA[i:], m.CriuImagePath)
if m.OpenTcp { i = encodeVarintRunc(dAtA, i, uint64(len(m.CriuImagePath)))
dAtA[i] = 1 i--
} else { dAtA[i] = 0x6a
dAtA[i] = 0
}
i++
} }
if m.ExternalUnixSockets { if len(m.CriuWorkPath) > 0 {
dAtA[i] = 0x18 i -= len(m.CriuWorkPath)
i++ copy(dAtA[i:], m.CriuWorkPath)
if m.ExternalUnixSockets { i = encodeVarintRunc(dAtA, i, uint64(len(m.CriuWorkPath)))
dAtA[i] = 1 i--
} else { dAtA[i] = 0x62
dAtA[i] = 0
}
i++
} }
if m.Terminal { if m.IoGid != 0 {
dAtA[i] = 0x20 i = encodeVarintRunc(dAtA, i, uint64(m.IoGid))
i++ i--
if m.Terminal { dAtA[i] = 0x58
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
} }
if m.FileLocks { if m.IoUid != 0 {
dAtA[i] = 0x28 i = encodeVarintRunc(dAtA, i, uint64(m.IoUid))
i++ i--
if m.FileLocks { dAtA[i] = 0x50
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
} }
if len(m.EmptyNamespaces) > 0 { if len(m.ShimCgroup) > 0 {
for _, s := range m.EmptyNamespaces { i -= len(m.ShimCgroup)
dAtA[i] = 0x32 copy(dAtA[i:], m.ShimCgroup)
i++ i = encodeVarintRunc(dAtA, i, uint64(len(m.ShimCgroup)))
l = len(s) i--
for l >= 1<<7 { dAtA[i] = 0x4a
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
l >>= 7
i++
}
dAtA[i] = uint8(l)
i++
i += copy(dAtA[i:], s)
}
}
if len(m.CgroupsMode) > 0 {
dAtA[i] = 0x3a
i++
i = encodeVarintRunc(dAtA, i, uint64(len(m.CgroupsMode)))
i += copy(dAtA[i:], m.CgroupsMode)
} }
if m.NoNewKeyring { if m.NoNewKeyring {
dAtA[i] = 0x40 i--
i++
if m.NoNewKeyring { if m.NoNewKeyring {
dAtA[i] = 1 dAtA[i] = 1
} else { } else {
dAtA[i] = 0 dAtA[i] = 0
} }
i++ i--
dAtA[i] = 0x40
} }
if len(m.ShimCgroup) > 0 { if len(m.CgroupsMode) > 0 {
dAtA[i] = 0x4a i -= len(m.CgroupsMode)
i++ copy(dAtA[i:], m.CgroupsMode)
i = encodeVarintRunc(dAtA, i, uint64(len(m.ShimCgroup))) i = encodeVarintRunc(dAtA, i, uint64(len(m.CgroupsMode)))
i += copy(dAtA[i:], m.ShimCgroup) i--
dAtA[i] = 0x3a
} }
if m.IoUid != 0 { if len(m.EmptyNamespaces) > 0 {
dAtA[i] = 0x50 for iNdEx := len(m.EmptyNamespaces) - 1; iNdEx >= 0; iNdEx-- {
i++ i -= len(m.EmptyNamespaces[iNdEx])
i = encodeVarintRunc(dAtA, i, uint64(m.IoUid)) copy(dAtA[i:], m.EmptyNamespaces[iNdEx])
i = encodeVarintRunc(dAtA, i, uint64(len(m.EmptyNamespaces[iNdEx])))
i--
dAtA[i] = 0x32
}
} }
if m.IoGid != 0 { if m.FileLocks {
dAtA[i] = 0x58 i--
i++ if m.FileLocks {
i = encodeVarintRunc(dAtA, i, uint64(m.IoGid)) dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x28
} }
if len(m.CriuWorkPath) > 0 { if m.Terminal {
dAtA[i] = 0x62 i--
i++ if m.Terminal {
i = encodeVarintRunc(dAtA, i, uint64(len(m.CriuWorkPath))) dAtA[i] = 1
i += copy(dAtA[i:], m.CriuWorkPath) } else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x20
} }
if len(m.CriuImagePath) > 0 { if m.ExternalUnixSockets {
dAtA[i] = 0x6a i--
i++ if m.ExternalUnixSockets {
i = encodeVarintRunc(dAtA, i, uint64(len(m.CriuImagePath))) dAtA[i] = 1
i += copy(dAtA[i:], m.CriuImagePath) } else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x18
} }
if m.XXX_unrecognized != nil { if m.OpenTcp {
i += copy(dAtA[i:], m.XXX_unrecognized) i--
if m.OpenTcp {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x10
} }
return i, nil if m.NoPivotRoot {
i--
if m.NoPivotRoot {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
} }
func (m *CheckpointOptions) Marshal() (dAtA []byte, err error) { func (m *CheckpointOptions) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -445,103 +459,106 @@ func (m *CheckpointOptions) Marshal() (dAtA []byte, err error) {
} }
func (m *CheckpointOptions) MarshalTo(dAtA []byte) (int, error) { func (m *CheckpointOptions) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *CheckpointOptions) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Exit { if m.XXX_unrecognized != nil {
dAtA[i] = 0x8 i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
if m.Exit {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
} }
if m.OpenTcp { if len(m.ImagePath) > 0 {
dAtA[i] = 0x10 i -= len(m.ImagePath)
i++ copy(dAtA[i:], m.ImagePath)
if m.OpenTcp { i = encodeVarintRunc(dAtA, i, uint64(len(m.ImagePath)))
dAtA[i] = 1 i--
} else { dAtA[i] = 0x4a
dAtA[i] = 0
}
i++
} }
if m.ExternalUnixSockets { if len(m.WorkPath) > 0 {
dAtA[i] = 0x18 i -= len(m.WorkPath)
i++ copy(dAtA[i:], m.WorkPath)
if m.ExternalUnixSockets { i = encodeVarintRunc(dAtA, i, uint64(len(m.WorkPath)))
dAtA[i] = 1 i--
} else { dAtA[i] = 0x42
dAtA[i] = 0
}
i++
} }
if m.Terminal { if len(m.CgroupsMode) > 0 {
dAtA[i] = 0x20 i -= len(m.CgroupsMode)
i++ copy(dAtA[i:], m.CgroupsMode)
if m.Terminal { i = encodeVarintRunc(dAtA, i, uint64(len(m.CgroupsMode)))
dAtA[i] = 1 i--
} else { dAtA[i] = 0x3a
dAtA[i] = 0 }
if len(m.EmptyNamespaces) > 0 {
for iNdEx := len(m.EmptyNamespaces) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.EmptyNamespaces[iNdEx])
copy(dAtA[i:], m.EmptyNamespaces[iNdEx])
i = encodeVarintRunc(dAtA, i, uint64(len(m.EmptyNamespaces[iNdEx])))
i--
dAtA[i] = 0x32
} }
i++
} }
if m.FileLocks { if m.FileLocks {
dAtA[i] = 0x28 i--
i++
if m.FileLocks { if m.FileLocks {
dAtA[i] = 1 dAtA[i] = 1
} else { } else {
dAtA[i] = 0 dAtA[i] = 0
} }
i++ i--
dAtA[i] = 0x28
} }
if len(m.EmptyNamespaces) > 0 { if m.Terminal {
for _, s := range m.EmptyNamespaces { i--
dAtA[i] = 0x32 if m.Terminal {
i++ dAtA[i] = 1
l = len(s) } else {
for l >= 1<<7 { dAtA[i] = 0
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
l >>= 7
i++
}
dAtA[i] = uint8(l)
i++
i += copy(dAtA[i:], s)
} }
i--
dAtA[i] = 0x20
} }
if len(m.CgroupsMode) > 0 { if m.ExternalUnixSockets {
dAtA[i] = 0x3a i--
i++ if m.ExternalUnixSockets {
i = encodeVarintRunc(dAtA, i, uint64(len(m.CgroupsMode))) dAtA[i] = 1
i += copy(dAtA[i:], m.CgroupsMode) } else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x18
} }
if len(m.WorkPath) > 0 { if m.OpenTcp {
dAtA[i] = 0x42 i--
i++ if m.OpenTcp {
i = encodeVarintRunc(dAtA, i, uint64(len(m.WorkPath))) dAtA[i] = 1
i += copy(dAtA[i:], m.WorkPath) } else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x10
} }
if len(m.ImagePath) > 0 { if m.Exit {
dAtA[i] = 0x4a i--
i++ if m.Exit {
i = encodeVarintRunc(dAtA, i, uint64(len(m.ImagePath))) dAtA[i] = 1
i += copy(dAtA[i:], m.ImagePath) } else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x8
} }
if m.XXX_unrecognized != nil { return len(dAtA) - i, nil
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
} }
func (m *ProcessDetails) Marshal() (dAtA []byte, err error) { func (m *ProcessDetails) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -549,30 +566,39 @@ func (m *ProcessDetails) Marshal() (dAtA []byte, err error) {
} }
func (m *ProcessDetails) MarshalTo(dAtA []byte) (int, error) { func (m *ProcessDetails) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ProcessDetails) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ExecID) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintRunc(dAtA, i, uint64(len(m.ExecID)))
i += copy(dAtA[i:], m.ExecID)
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if len(m.ExecID) > 0 {
i -= len(m.ExecID)
copy(dAtA[i:], m.ExecID)
i = encodeVarintRunc(dAtA, i, uint64(len(m.ExecID)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func encodeVarintRunc(dAtA []byte, offset int, v uint64) int { func encodeVarintRunc(dAtA []byte, offset int, v uint64) int {
offset -= sovRunc(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *RuncOptions) Size() (n int) { func (m *RuncOptions) Size() (n int) {
if m == nil { if m == nil {
@ -721,14 +747,7 @@ func (m *ProcessDetails) Size() (n int) {
} }
func sovRunc(x uint64) (n int) { func sovRunc(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozRunc(x uint64) (n int) { func sozRunc(x uint64) (n int) {
return sovRunc(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovRunc(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -1721,6 +1740,7 @@ func (m *ProcessDetails) Unmarshal(dAtA []byte) error {
func skipRunc(dAtA []byte) (n int, err error) { func skipRunc(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1752,10 +1772,8 @@ func skipRunc(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1776,55 +1794,30 @@ func skipRunc(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthRunc return 0, ErrInvalidLengthRunc
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthRunc
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowRunc
}
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 := skipRunc(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthRunc
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupRunc
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthRunc
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthRunc = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthRunc = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowRunc = fmt.Errorf("proto: integer overflow") ErrIntOverflowRunc = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupRunc = fmt.Errorf("proto: unexpected end of group")
) )

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,7 @@ import (
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -21,7 +22,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type Options struct { type Options struct {
// disable pivot root when creating a container // disable pivot root when creating a container
@ -64,7 +65,7 @@ func (m *Options) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Options.Marshal(b, m, deterministic) return xxx_messageInfo_Options.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -120,7 +121,7 @@ func (m *CheckpointOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, e
return xxx_messageInfo_CheckpointOptions.Marshal(b, m, deterministic) return xxx_messageInfo_CheckpointOptions.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -160,7 +161,7 @@ func (m *ProcessDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro
return xxx_messageInfo_ProcessDetails.Marshal(b, m, deterministic) return xxx_messageInfo_ProcessDetails.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -233,7 +234,7 @@ var fileDescriptor_4e5440d739e9a863 = []byte{
func (m *Options) Marshal() (dAtA []byte, err error) { func (m *Options) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -241,96 +242,108 @@ func (m *Options) Marshal() (dAtA []byte, err error) {
} }
func (m *Options) MarshalTo(dAtA []byte) (int, error) { func (m *Options) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Options) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.NoPivotRoot { if m.XXX_unrecognized != nil {
dAtA[i] = 0x8 i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
if m.NoPivotRoot {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
} }
if m.NoNewKeyring { if len(m.CriuWorkPath) > 0 {
dAtA[i] = 0x10 i -= len(m.CriuWorkPath)
i++ copy(dAtA[i:], m.CriuWorkPath)
if m.NoNewKeyring { i = encodeVarintOci(dAtA, i, uint64(len(m.CriuWorkPath)))
dAtA[i] = 1 i--
} else { dAtA[i] = 0x5a
dAtA[i] = 0
}
i++
} }
if len(m.ShimCgroup) > 0 { if len(m.CriuImagePath) > 0 {
dAtA[i] = 0x1a i -= len(m.CriuImagePath)
i++ copy(dAtA[i:], m.CriuImagePath)
i = encodeVarintOci(dAtA, i, uint64(len(m.ShimCgroup))) i = encodeVarintOci(dAtA, i, uint64(len(m.CriuImagePath)))
i += copy(dAtA[i:], m.ShimCgroup) i--
} dAtA[i] = 0x52
if m.IoUid != 0 {
dAtA[i] = 0x20
i++
i = encodeVarintOci(dAtA, i, uint64(m.IoUid))
}
if m.IoGid != 0 {
dAtA[i] = 0x28
i++
i = encodeVarintOci(dAtA, i, uint64(m.IoGid))
}
if len(m.BinaryName) > 0 {
dAtA[i] = 0x32
i++
i = encodeVarintOci(dAtA, i, uint64(len(m.BinaryName)))
i += copy(dAtA[i:], m.BinaryName)
}
if len(m.Root) > 0 {
dAtA[i] = 0x3a
i++
i = encodeVarintOci(dAtA, i, uint64(len(m.Root)))
i += copy(dAtA[i:], m.Root)
}
if len(m.CriuPath) > 0 {
dAtA[i] = 0x42
i++
i = encodeVarintOci(dAtA, i, uint64(len(m.CriuPath)))
i += copy(dAtA[i:], m.CriuPath)
} }
if m.SystemdCgroup { if m.SystemdCgroup {
dAtA[i] = 0x48 i--
i++
if m.SystemdCgroup { if m.SystemdCgroup {
dAtA[i] = 1 dAtA[i] = 1
} else { } else {
dAtA[i] = 0 dAtA[i] = 0
} }
i++ i--
dAtA[i] = 0x48
} }
if len(m.CriuImagePath) > 0 { if len(m.CriuPath) > 0 {
dAtA[i] = 0x52 i -= len(m.CriuPath)
i++ copy(dAtA[i:], m.CriuPath)
i = encodeVarintOci(dAtA, i, uint64(len(m.CriuImagePath))) i = encodeVarintOci(dAtA, i, uint64(len(m.CriuPath)))
i += copy(dAtA[i:], m.CriuImagePath) i--
dAtA[i] = 0x42
} }
if len(m.CriuWorkPath) > 0 { if len(m.Root) > 0 {
dAtA[i] = 0x5a i -= len(m.Root)
i++ copy(dAtA[i:], m.Root)
i = encodeVarintOci(dAtA, i, uint64(len(m.CriuWorkPath))) i = encodeVarintOci(dAtA, i, uint64(len(m.Root)))
i += copy(dAtA[i:], m.CriuWorkPath) i--
dAtA[i] = 0x3a
} }
if m.XXX_unrecognized != nil { if len(m.BinaryName) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.BinaryName)
copy(dAtA[i:], m.BinaryName)
i = encodeVarintOci(dAtA, i, uint64(len(m.BinaryName)))
i--
dAtA[i] = 0x32
} }
return i, nil if m.IoGid != 0 {
i = encodeVarintOci(dAtA, i, uint64(m.IoGid))
i--
dAtA[i] = 0x28
}
if m.IoUid != 0 {
i = encodeVarintOci(dAtA, i, uint64(m.IoUid))
i--
dAtA[i] = 0x20
}
if len(m.ShimCgroup) > 0 {
i -= len(m.ShimCgroup)
copy(dAtA[i:], m.ShimCgroup)
i = encodeVarintOci(dAtA, i, uint64(len(m.ShimCgroup)))
i--
dAtA[i] = 0x1a
}
if m.NoNewKeyring {
i--
if m.NoNewKeyring {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x10
}
if m.NoPivotRoot {
i--
if m.NoPivotRoot {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
} }
func (m *CheckpointOptions) Marshal() (dAtA []byte, err error) { func (m *CheckpointOptions) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -338,103 +351,106 @@ func (m *CheckpointOptions) Marshal() (dAtA []byte, err error) {
} }
func (m *CheckpointOptions) MarshalTo(dAtA []byte) (int, error) { func (m *CheckpointOptions) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *CheckpointOptions) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Exit { if m.XXX_unrecognized != nil {
dAtA[i] = 0x8 i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
if m.Exit {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
} }
if m.OpenTcp { if len(m.WorkPath) > 0 {
dAtA[i] = 0x10 i -= len(m.WorkPath)
i++ copy(dAtA[i:], m.WorkPath)
if m.OpenTcp { i = encodeVarintOci(dAtA, i, uint64(len(m.WorkPath)))
dAtA[i] = 1 i--
} else { dAtA[i] = 0x4a
dAtA[i] = 0
}
i++
} }
if m.ExternalUnixSockets { if len(m.ImagePath) > 0 {
dAtA[i] = 0x18 i -= len(m.ImagePath)
i++ copy(dAtA[i:], m.ImagePath)
if m.ExternalUnixSockets { i = encodeVarintOci(dAtA, i, uint64(len(m.ImagePath)))
dAtA[i] = 1 i--
} else { dAtA[i] = 0x42
dAtA[i] = 0
}
i++
} }
if m.Terminal { if len(m.CgroupsMode) > 0 {
dAtA[i] = 0x20 i -= len(m.CgroupsMode)
i++ copy(dAtA[i:], m.CgroupsMode)
if m.Terminal { i = encodeVarintOci(dAtA, i, uint64(len(m.CgroupsMode)))
dAtA[i] = 1 i--
} else { dAtA[i] = 0x3a
dAtA[i] = 0 }
if len(m.EmptyNamespaces) > 0 {
for iNdEx := len(m.EmptyNamespaces) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.EmptyNamespaces[iNdEx])
copy(dAtA[i:], m.EmptyNamespaces[iNdEx])
i = encodeVarintOci(dAtA, i, uint64(len(m.EmptyNamespaces[iNdEx])))
i--
dAtA[i] = 0x32
} }
i++
} }
if m.FileLocks { if m.FileLocks {
dAtA[i] = 0x28 i--
i++
if m.FileLocks { if m.FileLocks {
dAtA[i] = 1 dAtA[i] = 1
} else { } else {
dAtA[i] = 0 dAtA[i] = 0
} }
i++ i--
dAtA[i] = 0x28
} }
if len(m.EmptyNamespaces) > 0 { if m.Terminal {
for _, s := range m.EmptyNamespaces { i--
dAtA[i] = 0x32 if m.Terminal {
i++ dAtA[i] = 1
l = len(s) } else {
for l >= 1<<7 { dAtA[i] = 0
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
l >>= 7
i++
}
dAtA[i] = uint8(l)
i++
i += copy(dAtA[i:], s)
} }
i--
dAtA[i] = 0x20
} }
if len(m.CgroupsMode) > 0 { if m.ExternalUnixSockets {
dAtA[i] = 0x3a i--
i++ if m.ExternalUnixSockets {
i = encodeVarintOci(dAtA, i, uint64(len(m.CgroupsMode))) dAtA[i] = 1
i += copy(dAtA[i:], m.CgroupsMode) } else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x18
} }
if len(m.ImagePath) > 0 { if m.OpenTcp {
dAtA[i] = 0x42 i--
i++ if m.OpenTcp {
i = encodeVarintOci(dAtA, i, uint64(len(m.ImagePath))) dAtA[i] = 1
i += copy(dAtA[i:], m.ImagePath) } else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x10
} }
if len(m.WorkPath) > 0 { if m.Exit {
dAtA[i] = 0x4a i--
i++ if m.Exit {
i = encodeVarintOci(dAtA, i, uint64(len(m.WorkPath))) dAtA[i] = 1
i += copy(dAtA[i:], m.WorkPath) } else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x8
} }
if m.XXX_unrecognized != nil { return len(dAtA) - i, nil
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
} }
func (m *ProcessDetails) Marshal() (dAtA []byte, err error) { func (m *ProcessDetails) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -442,30 +458,39 @@ func (m *ProcessDetails) Marshal() (dAtA []byte, err error) {
} }
func (m *ProcessDetails) MarshalTo(dAtA []byte) (int, error) { func (m *ProcessDetails) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ProcessDetails) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.ExecID) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintOci(dAtA, i, uint64(len(m.ExecID)))
i += copy(dAtA[i:], m.ExecID)
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if len(m.ExecID) > 0 {
i -= len(m.ExecID)
copy(dAtA[i:], m.ExecID)
i = encodeVarintOci(dAtA, i, uint64(len(m.ExecID)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func encodeVarintOci(dAtA []byte, offset int, v uint64) int { func encodeVarintOci(dAtA []byte, offset int, v uint64) int {
offset -= sovOci(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *Options) Size() (n int) { func (m *Options) Size() (n int) {
if m == nil { if m == nil {
@ -580,14 +605,7 @@ func (m *ProcessDetails) Size() (n int) {
} }
func sovOci(x uint64) (n int) { func sovOci(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozOci(x uint64) (n int) { func sozOci(x uint64) (n int) {
return sovOci(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovOci(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -1366,6 +1384,7 @@ func (m *ProcessDetails) Unmarshal(dAtA []byte) error {
func skipOci(dAtA []byte) (n int, err error) { func skipOci(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1397,10 +1416,8 @@ func skipOci(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1421,55 +1438,30 @@ func skipOci(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthOci return 0, ErrInvalidLengthOci
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthOci
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowOci
}
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 := skipOci(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthOci
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupOci
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthOci
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthOci = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthOci = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowOci = fmt.Errorf("proto: integer overflow") ErrIntOverflowOci = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupOci = fmt.Errorf("proto: unexpected end of group")
) )

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@
# #
set -eu -o pipefail set -eu -o pipefail
PROTOBUF_VERSION=3.7.0 PROTOBUF_VERSION=3.11.4
GOARCH=$(go env GOARCH) GOARCH=$(go env GOARCH)
GOOS=$(go env GOOS) GOOS=$(go env GOOS)
PROTOBUF_DIR=$(mktemp -d) PROTOBUF_DIR=$(mktemp -d)

View File

@ -52,6 +52,7 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
bolt "go.etcd.io/bbolt" bolt "go.etcd.io/bbolt"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/backoff"
"google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials"
) )
@ -456,9 +457,14 @@ func (pc *proxyClients) getClient(address string) (*grpc.ClientConn, error) {
return c, nil return c, nil
} }
backoffConfig := backoff.DefaultConfig
backoffConfig.MaxDelay = 3 * time.Second
connParams := grpc.ConnectParams{
Backoff: backoffConfig,
}
gopts := []grpc.DialOption{ gopts := []grpc.DialOption{
grpc.WithInsecure(), grpc.WithInsecure(),
grpc.WithBackoffMaxDelay(3 * time.Second), grpc.WithConnectParams(connParams),
grpc.WithContextDialer(dialer.ContextDialer), grpc.WithContextDialer(dialer.ContextDialer),
// TODO(stevvooe): We may need to allow configuration of this on the client. // TODO(stevvooe): We may need to allow configuration of this on the client.

View File

@ -15,12 +15,12 @@ github.com/docker/go-events 9461782956ad83b30282bf90e31f
github.com/docker/go-metrics b619b3592b65de4f087d9f16863a7e6ff905973c # v0.0.1 github.com/docker/go-metrics b619b3592b65de4f087d9f16863a7e6ff905973c # v0.0.1
github.com/docker/go-units 519db1ee28dcc9fd2474ae59fca29a810482bfb1 # v0.4.0 github.com/docker/go-units 519db1ee28dcc9fd2474ae59fca29a810482bfb1 # v0.4.0
github.com/godbus/dbus/v5 37bf87eef99d69c4f1d3528bd66e3a87dc201472 # v5.0.3 github.com/godbus/dbus/v5 37bf87eef99d69c4f1d3528bd66e3a87dc201472 # v5.0.3
github.com/gogo/googleapis d31c731455cb061f42baff3bda55bad0118b126b # v1.2.0 github.com/gogo/googleapis 01e0f9cca9b92166042241267ee2a5cdf5cff46c # v1.3.2
github.com/gogo/protobuf ba06b47c162d49f2af050fb4c75bcbc86a159d5c # v1.2.1 github.com/gogo/protobuf 5628607bb4c51c3157aacc3a50f0ab707582b805 # v1.3.1
github.com/golang/protobuf aa810b61a9c79d51363740d207bb46cf8e620ed5 # v1.2.0 github.com/golang/protobuf d23c5127dc24889085f8ccea5c9d560a57a879d8 # v1.3.3
github.com/google/go-cmp 3af367b6b30c263d47e8895973edcca9a49cf029 # v0.2.0 github.com/google/go-cmp 3af367b6b30c263d47e8895973edcca9a49cf029 # v0.2.0
github.com/google/uuid 0cd6bf5da1e1c83f8b45653022c74f71af0538a4 # v1.1.1 github.com/google/uuid 0cd6bf5da1e1c83f8b45653022c74f71af0538a4 # v1.1.1
github.com/grpc-ecosystem/go-grpc-prometheus 6b7015e65d366bf3f19b2b2a000a831940f0f7e0 github.com/grpc-ecosystem/go-grpc-prometheus c225b8c3b01faf2899099b768856a9e916e5087b # v1.2.0
github.com/hashicorp/errwrap 8a6fb523712970c966eefc6b39ed2c5e74880354 # v1.0.0 github.com/hashicorp/errwrap 8a6fb523712970c966eefc6b39ed2c5e74880354 # v1.0.0
github.com/hashicorp/go-multierror 886a7fbe3eb1c874d46f623bfa70af45f425b3d1 # v1.0.0 github.com/hashicorp/go-multierror 886a7fbe3eb1c874d46f623bfa70af45f425b3d1 # v1.0.0
github.com/hashicorp/golang-lru 7f827b33c0f158ec5dfbba01bb0b14a4541fd81d # v0.5.3 github.com/hashicorp/golang-lru 7f827b33c0f158ec5dfbba01bb0b14a4541fd81d # v0.5.3
@ -48,8 +48,8 @@ golang.org/x/net f3200d17e092c607f615320ecaad
golang.org/x/sync 42b317875d0fa942474b76e1b46a6060d720ae6e golang.org/x/sync 42b317875d0fa942474b76e1b46a6060d720ae6e
golang.org/x/sys c990c680b611ac1aeb7d8f2af94a825f98d69720 https://github.com/golang/sys golang.org/x/sys c990c680b611ac1aeb7d8f2af94a825f98d69720 https://github.com/golang/sys
golang.org/x/text 19e51611da83d6be54ddafce4a4af510cb3e9ea4 golang.org/x/text 19e51611da83d6be54ddafce4a4af510cb3e9ea4
google.golang.org/genproto d80a6e20e776b0b17a324d0ba1ab50a39c8e8944 google.golang.org/genproto e50cd9704f63023d62cd06a1994b98227fc4d21a
google.golang.org/grpc 39e8a7b072a67ca2a75f57fa2e0d50995f5b22f6 # v1.23.1 google.golang.org/grpc f495f5b15ae7ccda3b38c53a1bfcde4c1a58a2bc # v1.27.1
gotest.tools 1083505acf35a0bd8a696b26837e1fb3187a7a83 # v2.3.0 gotest.tools 1083505acf35a0bd8a696b26837e1fb3187a7a83 # v2.3.0
# cri dependencies # cri dependencies

View File

@ -2,4 +2,4 @@ module github.com/gogo/googleapis
go 1.12 go 1.12
require github.com/gogo/protobuf v1.2.1 require github.com/gogo/protobuf v1.3.1

View File

@ -19,7 +19,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// The canonical error codes for Google APIs. // The canonical error codes for Google APIs.
// //

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,7 @@ import (
types "github.com/gogo/protobuf/types" types "github.com/gogo/protobuf/types"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -23,7 +24,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// The `Status` type defines a logical error model that is suitable for // The `Status` type defines a logical error model that is suitable for
// different programming environments, including REST APIs and RPC APIs. It is // different programming environments, including REST APIs and RPC APIs. It is
@ -108,7 +109,7 @@ func (m *Status) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Status.Marshal(b, m, deterministic) return xxx_messageInfo_Status.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -295,7 +296,7 @@ func valueToGoStringStatus(v interface{}, typ string) string {
func (m *Status) Marshal() (dAtA []byte, err error) { func (m *Status) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -303,47 +304,58 @@ func (m *Status) Marshal() (dAtA []byte, err error) {
} }
func (m *Status) MarshalTo(dAtA []byte) (int, error) { func (m *Status) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Status) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Code != 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0x8 i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintStatus(dAtA, i, uint64(m.Code))
}
if len(m.Message) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintStatus(dAtA, i, uint64(len(m.Message)))
i += copy(dAtA[i:], m.Message)
} }
if len(m.Details) > 0 { if len(m.Details) > 0 {
for _, msg := range m.Details { for iNdEx := len(m.Details) - 1; iNdEx >= 0; iNdEx-- {
dAtA[i] = 0x1a {
i++ size, err := m.Details[iNdEx].MarshalToSizedBuffer(dAtA[:i])
i = encodeVarintStatus(dAtA, i, uint64(msg.Size())) if err != nil {
n, err := msg.MarshalTo(dAtA[i:]) return 0, err
if err != nil { }
return 0, err i -= size
i = encodeVarintStatus(dAtA, i, uint64(size))
} }
i += n i--
dAtA[i] = 0x1a
} }
} }
if m.XXX_unrecognized != nil { if len(m.Message) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Message)
copy(dAtA[i:], m.Message)
i = encodeVarintStatus(dAtA, i, uint64(len(m.Message)))
i--
dAtA[i] = 0x12
} }
return i, nil if m.Code != 0 {
i = encodeVarintStatus(dAtA, i, uint64(m.Code))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
} }
func encodeVarintStatus(dAtA []byte, offset int, v uint64) int { func encodeVarintStatus(dAtA []byte, offset int, v uint64) int {
offset -= sovStatus(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func NewPopulatedStatus(r randyStatus, easy bool) *Status { func NewPopulatedStatus(r randyStatus, easy bool) *Status {
this := &Status{} this := &Status{}
@ -352,7 +364,7 @@ func NewPopulatedStatus(r randyStatus, easy bool) *Status {
this.Code *= -1 this.Code *= -1
} }
this.Message = string(randStringStatus(r)) this.Message = string(randStringStatus(r))
if r.Intn(10) != 0 { if r.Intn(5) != 0 {
v1 := r.Intn(5) v1 := r.Intn(5)
this.Details = make([]*types.Any, v1) this.Details = make([]*types.Any, v1)
for i := 0; i < v1; i++ { for i := 0; i < v1; i++ {
@ -463,14 +475,7 @@ func (m *Status) Size() (n int) {
} }
func sovStatus(x uint64) (n int) { func sovStatus(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozStatus(x uint64) (n int) { func sozStatus(x uint64) (n int) {
return sovStatus(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovStatus(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -479,10 +484,15 @@ func (this *Status) String() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
repeatedStringForDetails := "[]*Any{"
for _, f := range this.Details {
repeatedStringForDetails += strings.Replace(fmt.Sprintf("%v", f), "Any", "types.Any", 1) + ","
}
repeatedStringForDetails += "}"
s := strings.Join([]string{`&Status{`, s := strings.Join([]string{`&Status{`,
`Code:` + fmt.Sprintf("%v", this.Code) + `,`, `Code:` + fmt.Sprintf("%v", this.Code) + `,`,
`Message:` + fmt.Sprintf("%v", this.Message) + `,`, `Message:` + fmt.Sprintf("%v", this.Message) + `,`,
`Details:` + strings.Replace(fmt.Sprintf("%v", this.Details), "Any", "types.Any", 1) + `,`, `Details:` + repeatedStringForDetails + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`, `}`,
}, "") }, "")
@ -638,6 +648,7 @@ func (m *Status) Unmarshal(dAtA []byte) error {
func skipStatus(dAtA []byte) (n int, err error) { func skipStatus(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -669,10 +680,8 @@ func skipStatus(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -693,55 +702,30 @@ func skipStatus(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthStatus return 0, ErrInvalidLengthStatus
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthStatus
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowStatus
}
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 := skipStatus(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthStatus
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupStatus
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthStatus
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthStatus = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthStatus = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowStatus = fmt.Errorf("proto: integer overflow") ErrIntOverflowStatus = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupStatus = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -17,6 +17,18 @@ This code generation is used to achieve:
Keeping track of how up to date gogoprotobuf is relative to golang/protobuf is done in this Keeping track of how up to date gogoprotobuf is relative to golang/protobuf is done in this
<a href="https://github.com/gogo/protobuf/issues/191">issue</a> <a href="https://github.com/gogo/protobuf/issues/191">issue</a>
## Release v1.3.0
The project has updated to release v1.3.0. Check out the release notes <a href="https://github.com/gogo/protobuf/releases/tag/v1.3.0">here</a>.
With this new release comes a new internal library version. This means any newly generated *pb.go files generated with the v1.3.0 library will not be compatible with the old library version (v1.2.1). However, current *pb.go files (generated with v1.2.1) should still work with the new library.
Please make sure you manage your dependencies correctly when upgrading your project. If you are still using v1.2.1 and you update your dependencies, one of which could include a new *pb.go (generated with v1.3.0), you could get a compile time error.
Our upstream repo, golang/protobuf, also had to go through this process in order to update their library version.
Here is a link explaining <a href="https://github.com/golang/protobuf/issues/763#issuecomment-442434870">hermetic builds</a>.
## Users ## Users
These projects use gogoprotobuf: These projects use gogoprotobuf:
@ -49,6 +61,8 @@ These projects use gogoprotobuf:
- <a href="https://github.com/spacemeshos/go-spacemesh">go-spacemesh</a> - <a href="https://github.com/spacemeshos/go-spacemesh">go-spacemesh</a>
- <a href="https://github.com/weaveworks/cortex">cortex</a> - <a href="https://github.com/weaveworks/cortex/blob/fee02a59729d3771ef888f7bf0fd050e1197c56e/pkg/ingester/client/cortex.proto">sample proto file</a> - <a href="https://github.com/weaveworks/cortex">cortex</a> - <a href="https://github.com/weaveworks/cortex/blob/fee02a59729d3771ef888f7bf0fd050e1197c56e/pkg/ingester/client/cortex.proto">sample proto file</a>
- <a href="http://skywalking.apache.org/">Apache SkyWalking APM</a> - Istio telemetry receiver based on Mixer bypass protocol - <a href="http://skywalking.apache.org/">Apache SkyWalking APM</a> - Istio telemetry receiver based on Mixer bypass protocol
- <a href="https://github.com/hyperledger/burrow">Hyperledger Burrow</a> - a permissioned DLT framework
- <a href="https://github.com/iov-one/weave">IOV Weave</a> - a blockchain framework - <a href="https://github.com/iov-one/weave/tree/23f9856f1e316f93cb3d45d92c4c6a0c4810f6bf/spec/gogo">sample proto files</a>
Please let us know if you are using gogoprotobuf by posting on our <a href="https://groups.google.com/forum/#!topic/gogoprotobuf/Brw76BxmFpQ">GoogleGroup</a>. Please let us know if you are using gogoprotobuf by posting on our <a href="https://groups.google.com/forum/#!topic/gogoprotobuf/Brw76BxmFpQ">GoogleGroup</a>.

View File

@ -1,3 +1,6 @@
module github.com/gogo/protobuf module github.com/gogo/protobuf
require github.com/kisielk/errcheck v1.1.0 // indirect require (
github.com/kisielk/errcheck v1.2.0 // indirect
github.com/kisielk/gotool v1.0.0 // indirect
)

View File

@ -19,7 +19,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
var E_GoprotoEnumPrefix = &proto.ExtensionDesc{ var E_GoprotoEnumPrefix = &proto.ExtensionDesc{
ExtendedType: (*descriptor.EnumOptions)(nil), ExtendedType: (*descriptor.EnumOptions)(nil),

View File

@ -425,11 +425,65 @@ func (p *plugin) generateMessage(file *generator.FileDescriptor, message *genera
p.In() p.In()
p.P(`return -1`) p.P(`return -1`)
p.Out() p.Out()
p.P(`} else if c := this.`, fieldname, `.Compare(that1.`, fieldname, `); c != 0 {`) p.P(`} else {`)
p.In()
// Generate two type switches in order to compare the
// types of the oneofs. If they are of the same type
// call Compare, otherwise return 1 or -1.
p.P(`thisType := -1`)
p.P(`switch this.`, fieldname, `.(type) {`)
for i, subfield := range message.Field {
if *subfield.OneofIndex == *field.OneofIndex {
ccTypeName := p.OneOfTypeName(message, subfield)
p.P(`case *`, ccTypeName, `:`)
p.In()
p.P(`thisType = `, i)
p.Out()
}
}
p.P(`default:`)
p.In()
p.P(`panic(fmt.Sprintf("compare: unexpected type %T in oneof", this.`, fieldname, `))`)
p.Out()
p.P(`}`)
p.P(`that1Type := -1`)
p.P(`switch that1.`, fieldname, `.(type) {`)
for i, subfield := range message.Field {
if *subfield.OneofIndex == *field.OneofIndex {
ccTypeName := p.OneOfTypeName(message, subfield)
p.P(`case *`, ccTypeName, `:`)
p.In()
p.P(`that1Type = `, i)
p.Out()
}
}
p.P(`default:`)
p.In()
p.P(`panic(fmt.Sprintf("compare: unexpected type %T in oneof", that1.`, fieldname, `))`)
p.Out()
p.P(`}`)
p.P(`if thisType == that1Type {`)
p.In()
p.P(`if c := this.`, fieldname, `.Compare(that1.`, fieldname, `); c != 0 {`)
p.In() p.In()
p.P(`return c`) p.P(`return c`)
p.Out() p.Out()
p.P(`}`) p.P(`}`)
p.Out()
p.P(`} else if thisType < that1Type {`)
p.In()
p.P(`return -1`)
p.Out()
p.P(`} else if thisType > that1Type {`)
p.In()
p.P(`return 1`)
p.Out()
p.P(`}`)
p.Out()
p.P(`}`)
} else { } else {
p.generateField(file, message, field) p.generateField(file, message, field)
} }

View File

@ -238,10 +238,10 @@ func (p *gostring) Generate(file *generator.FileDescriptor) {
} else { } else {
goTyp, _ := p.GoType(message, field) goTyp, _ := p.GoType(message, field)
goTyp = strings.Replace(goTyp, "[]", "", 1) goTyp = strings.Replace(goTyp, "[]", "", 1)
p.P("vs := make([]*", goTyp, ", len(this.", fieldname, "))") p.P("vs := make([]", goTyp, ", len(this.", fieldname, "))")
p.P("for i := range vs {") p.P("for i := range vs {")
p.In() p.In()
p.P("vs[i] = &this.", fieldname, "[i]") p.P("vs[i] = this.", fieldname, "[i]")
p.Out() p.Out()
p.P("}") p.P("}")
p.P(`s = append(s, "`, fieldname, `: " + `, fmtPkg.Use(), `.Sprintf("%#v", vs) + ",\n")`) p.P(`s = append(s, "`, fieldname, `: " + `, fmtPkg.Use(), `.Sprintf("%#v", vs) + ",\n")`)

File diff suppressed because it is too large Load Diff

View File

@ -584,9 +584,9 @@ func (p *plugin) Generate(file *generator.FileDescriptor) {
p.GenerateField(file, message, field) p.GenerateField(file, message, field)
} else { } else {
if loopLevels[fieldIndex] > 0 { if loopLevels[fieldIndex] > 0 {
p.P(`if r.Intn(10) == 0 {`) p.P(`if r.Intn(5) == 0 {`)
} else { } else {
p.P(`if r.Intn(10) != 0 {`) p.P(`if r.Intn(5) != 0 {`)
} }
p.In() p.In()
p.GenerateField(file, message, field) p.GenerateField(file, message, field)

View File

@ -141,6 +141,7 @@ type size struct {
atleastOne bool atleastOne bool
localName string localName string
typesPkg generator.Single typesPkg generator.Single
bitsPkg generator.Single
} }
func NewSize() *size { func NewSize() *size {
@ -188,14 +189,7 @@ func keySize(fieldNumber int32, wireType int) int {
func (p *size) sizeVarint() { func (p *size) sizeVarint() {
p.P(` p.P(`
func sov`, p.localName, `(x uint64) (n int) { func sov`, p.localName, `(x uint64) (n int) {
for { return (`, p.bitsPkg.Use(), `.Len64(x | 1) + 6)/ 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
}`) }`)
} }
@ -589,6 +583,7 @@ func (p *size) Generate(file *generator.FileDescriptor) {
p.localName = generator.FileName(file) p.localName = generator.FileName(file)
p.typesPkg = p.NewImport("github.com/gogo/protobuf/types") p.typesPkg = p.NewImport("github.com/gogo/protobuf/types")
protoPkg := p.NewImport("github.com/gogo/protobuf/proto") protoPkg := p.NewImport("github.com/gogo/protobuf/proto")
p.bitsPkg = p.NewImport("math/bits")
if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) {
protoPkg = p.NewImport("github.com/golang/protobuf/proto") protoPkg = p.NewImport("github.com/golang/protobuf/proto")
} }

View File

@ -148,6 +148,47 @@ func (p *stringer) Generate(file *generator.FileDescriptor) {
p.P(`return "nil"`) p.P(`return "nil"`)
p.Out() p.Out()
p.P(`}`) p.P(`}`)
for _, field := range message.Field {
if p.IsMap(field) || !field.IsRepeated() {
continue
}
if (field.IsMessage() && !gogoproto.IsCustomType(field)) || p.IsGroup(field) {
nullable := gogoproto.IsNullable(field)
desc := p.ObjectNamed(field.GetTypeName())
msgname := p.TypeName(desc)
msgnames := strings.Split(msgname, ".")
typeName := msgnames[len(msgnames)-1]
fieldMessageDesc := file.GetMessage(msgname)
gogoStringer := false
if fieldMessageDesc != nil {
gogoStringer = gogoproto.IsStringer(file.FileDescriptorProto, fieldMessageDesc)
}
fieldname := p.GetFieldName(message, field)
stringfunc := fmtPkg.Use() + `.Sprintf("%v", f)`
if gogoStringer {
stringfunc = `f.String()`
}
repeatedName := `repeatedStringFor` + fieldname
if nullable {
p.P(repeatedName, ` := "[]*`, typeName, `{"`)
} else {
p.P(repeatedName, ` := "[]`, typeName, `{"`)
}
p.P(`for _, f := range `, `this.`, fieldname, ` {`)
p.In()
if nullable {
p.P(repeatedName, " += ", stringsPkg.Use(), `.Replace(`, stringfunc, `, "`, typeName, `","`, msgname, `"`, ", 1)", ` + ","`)
} else if gogoStringer {
p.P(repeatedName, " += ", stringsPkg.Use(), `.Replace(`, stringsPkg.Use(), `.Replace(`, stringfunc, `, "`, typeName, `","`, msgname, `"`, ", 1),`&`,``,1)", ` + ","`)
} else {
p.P(repeatedName, " += ", stringfunc, ` + ","`)
}
p.Out()
p.P(`}`)
p.P(repeatedName, ` += "}"`)
}
}
for _, field := range message.Field { for _, field := range message.Field {
if !p.IsMap(field) { if !p.IsMap(field) {
continue continue
@ -208,12 +249,22 @@ func (p *stringer) Generate(file *generator.FileDescriptor) {
msgname := p.TypeName(desc) msgname := p.TypeName(desc)
msgnames := strings.Split(msgname, ".") msgnames := strings.Split(msgname, ".")
typeName := msgnames[len(msgnames)-1] typeName := msgnames[len(msgnames)-1]
if nullable { fieldMessageDesc := file.GetMessage(msgname)
p.P("`", fieldname, ":`", ` + `, stringsPkg.Use(), `.Replace(`, fmtPkg.Use(), `.Sprintf("%v", this.`, fieldname, `), "`, typeName, `","`, msgname, `"`, ", 1) + `,", "`,") gogoStringer := false
if fieldMessageDesc != nil {
gogoStringer = gogoproto.IsStringer(file.FileDescriptorProto, fieldMessageDesc)
}
stringfunc := fmtPkg.Use() + `.Sprintf("%v", this.` + fieldname + `)`
if gogoStringer {
stringfunc = `this.` + fieldname + `.String()`
}
if nullable && !repeated {
p.P("`", fieldname, ":`", ` + `, stringsPkg.Use(), `.Replace(`, stringfunc, `, "`, typeName, `","`, msgname, `"`, ", 1) + `,", "`,")
} else if repeated { } else if repeated {
p.P("`", fieldname, ":`", ` + `, stringsPkg.Use(), `.Replace(`, stringsPkg.Use(), `.Replace(`, fmtPkg.Use(), `.Sprintf("%v", this.`, fieldname, `), "`, typeName, `","`, msgname, `"`, ", 1),`&`,``,1) + `,", "`,") repeatedName := `repeatedStringFor` + fieldname
p.P("`", fieldname, ":`", ` + `, repeatedName, " + `,", "`,")
} else { } else {
p.P("`", fieldname, ":`", ` + `, stringsPkg.Use(), `.Replace(`, stringsPkg.Use(), `.Replace(this.`, fieldname, `.String(), "`, typeName, `","`, msgname, `"`, ", 1),`&`,``,1) + `,", "`,") p.P("`", fieldname, ":`", ` + `, stringsPkg.Use(), `.Replace(`, stringsPkg.Use(), `.Replace(`, stringfunc, `, "`, typeName, `","`, msgname, `"`, ", 1),`&`,``,1) + `,", "`,")
} }
} else { } else {
if nullable && !repeated && !proto3 { if nullable && !repeated && !proto3 {

View File

@ -1578,6 +1578,7 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
p.P(`func skip` + p.localName + `(dAtA []byte) (n int, err error) { p.P(`func skip` + p.localName + `(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1609,10 +1610,8 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1633,57 +1632,32 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
return 0, ErrInvalidLength` + p.localName + ` return 0, ErrInvalidLength` + p.localName + `
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLength` + p.localName + `
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflow` + p.localName + `
}
if iNdEx >= l {
return 0, ` + p.ioPkg.Use() + `.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
innerWire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
innerWireType := int(innerWire & 0x7)
if innerWireType == 4 {
break
}
next, err := skip` + p.localName + `(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLength` + p.localName + `
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroup` + p.localName + `
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, ` + fmtPkg.Use() + `.Errorf("proto: illegal wireType %d", wireType) return 0, ` + fmtPkg.Use() + `.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLength` + p.localName + `
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, ` + p.ioPkg.Use() + `.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLength` + p.localName + ` = ` + fmtPkg.Use() + `.Errorf("proto: negative length found during unmarshaling") ErrInvalidLength` + p.localName + ` = ` + fmtPkg.Use() + `.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflow` + p.localName + ` = ` + fmtPkg.Use() + `.Errorf("proto: integer overflow") ErrIntOverflow` + p.localName + ` = ` + fmtPkg.Use() + `.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroup` + p.localName + ` = ` + fmtPkg.Use() + `.Errorf("proto: unexpected end of group")
) )
`) `)
} }

View File

@ -189,6 +189,8 @@ type Marshaler interface {
// prefixed by a varint-encoded length. // prefixed by a varint-encoded length.
func (p *Buffer) EncodeMessage(pb Message) error { func (p *Buffer) EncodeMessage(pb Message) error {
siz := Size(pb) siz := Size(pb)
sizVar := SizeVarint(uint64(siz))
p.grow(siz + sizVar)
p.EncodeVarint(uint64(siz)) p.EncodeVarint(uint64(siz))
return p.Marshal(pb) return p.Marshal(pb)
} }

View File

@ -527,6 +527,7 @@ func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) {
// SetExtension sets the specified extension of pb to the specified value. // SetExtension sets the specified extension of pb to the specified value.
func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error { func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error {
if epb, ok := pb.(extensionsBytes); ok { if epb, ok := pb.(extensionsBytes); ok {
ClearExtension(pb, extension)
newb, err := encodeExtension(extension, value) newb, err := encodeExtension(extension, value)
if err != nil { if err != nil {
return err return err

View File

@ -154,6 +154,10 @@ func EncodeInternalExtension(m extendableProto, data []byte) (n int, err error)
return EncodeExtensionMap(m.extensionsWrite(), data) return EncodeExtensionMap(m.extensionsWrite(), data)
} }
func EncodeInternalExtensionBackwards(m extendableProto, data []byte) (n int, err error) {
return EncodeExtensionMapBackwards(m.extensionsWrite(), data)
}
func EncodeExtensionMap(m map[int32]Extension, data []byte) (n int, err error) { func EncodeExtensionMap(m map[int32]Extension, data []byte) (n int, err error) {
o := 0 o := 0
for _, e := range m { for _, e := range m {
@ -169,6 +173,23 @@ func EncodeExtensionMap(m map[int32]Extension, data []byte) (n int, err error) {
return o, nil return o, nil
} }
func EncodeExtensionMapBackwards(m map[int32]Extension, data []byte) (n int, err error) {
o := 0
end := len(data)
for _, e := range m {
if err := e.Encode(); err != nil {
return 0, err
}
n := copy(data[end-len(e.enc):], e.enc)
if n != len(e.enc) {
return 0, io.ErrShortBuffer
}
end -= n
o += n
}
return o, nil
}
func GetRawExtension(m map[int32]Extension, id int32) ([]byte, error) { func GetRawExtension(m map[int32]Extension, id int32) ([]byte, error) {
e := m[id] e := m[id]
if err := e.Encode(); err != nil { if err := e.Encode(); err != nil {

View File

@ -948,13 +948,19 @@ func isProto3Zero(v reflect.Value) bool {
return false return false
} }
// ProtoPackageIsVersion2 is referenced from generated protocol buffer files const (
// to assert that that code is compatible with this version of the proto package. // ProtoPackageIsVersion3 is referenced from generated protocol buffer files
const GoGoProtoPackageIsVersion2 = true // to assert that that code is compatible with this version of the proto package.
GoGoProtoPackageIsVersion3 = true
// ProtoPackageIsVersion1 is referenced from generated protocol buffer files // ProtoPackageIsVersion2 is referenced from generated protocol buffer files
// to assert that that code is compatible with this version of the proto package. // to assert that that code is compatible with this version of the proto package.
const GoGoProtoPackageIsVersion1 = true GoGoProtoPackageIsVersion2 = true
// ProtoPackageIsVersion1 is referenced from generated protocol buffer files
// to assert that that code is compatible with this version of the proto package.
GoGoProtoPackageIsVersion1 = true
)
// InternalMessageInfo is a type used internally by generated .pb.go files. // InternalMessageInfo is a type used internally by generated .pb.go files.
// This type is not intended to be used by non-generated code. // This type is not intended to be used by non-generated code.

View File

@ -43,7 +43,6 @@ package proto
import ( import (
"fmt" "fmt"
"log" "log"
"os"
"reflect" "reflect"
"sort" "sort"
"strconv" "strconv"
@ -205,7 +204,7 @@ func (p *Properties) Parse(s string) {
// "bytes,49,opt,name=foo,def=hello!" // "bytes,49,opt,name=foo,def=hello!"
fields := strings.Split(s, ",") // breaks def=, but handled below. fields := strings.Split(s, ",") // breaks def=, but handled below.
if len(fields) < 2 { if len(fields) < 2 {
fmt.Fprintf(os.Stderr, "proto: tag has too few fields: %q\n", s) log.Printf("proto: tag has too few fields: %q", s)
return return
} }
@ -225,7 +224,7 @@ func (p *Properties) Parse(s string) {
p.WireType = WireBytes p.WireType = WireBytes
// no numeric converter for non-numeric types // no numeric converter for non-numeric types
default: default:
fmt.Fprintf(os.Stderr, "proto: tag has unknown wire type: %q\n", s) log.Printf("proto: tag has unknown wire type: %q", s)
return return
} }
@ -400,6 +399,15 @@ func GetProperties(t reflect.Type) *StructProperties {
return sprop return sprop
} }
type (
oneofFuncsIface interface {
XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{})
}
oneofWrappersIface interface {
XXX_OneofWrappers() []interface{}
}
)
// getPropertiesLocked requires that propertiesMu is held. // getPropertiesLocked requires that propertiesMu is held.
func getPropertiesLocked(t reflect.Type) *StructProperties { func getPropertiesLocked(t reflect.Type) *StructProperties {
if prop, ok := propertiesMap[t]; ok { if prop, ok := propertiesMap[t]; ok {
@ -441,37 +449,40 @@ func getPropertiesLocked(t reflect.Type) *StructProperties {
// Re-order prop.order. // Re-order prop.order.
sort.Sort(prop) sort.Sort(prop)
type oneofMessage interface { if isOneofMessage {
XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{})
}
if om, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); isOneofMessage && ok {
var oots []interface{} var oots []interface{}
_, _, _, oots = om.XXX_OneofFuncs() switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) {
case oneofFuncsIface:
// Interpret oneof metadata. _, _, _, oots = m.XXX_OneofFuncs()
prop.OneofTypes = make(map[string]*OneofProperties) case oneofWrappersIface:
for _, oot := range oots { oots = m.XXX_OneofWrappers()
oop := &OneofProperties{ }
Type: reflect.ValueOf(oot).Type(), // *T if len(oots) > 0 {
Prop: new(Properties), // Interpret oneof metadata.
} prop.OneofTypes = make(map[string]*OneofProperties)
sft := oop.Type.Elem().Field(0) for _, oot := range oots {
oop.Prop.Name = sft.Name oop := &OneofProperties{
oop.Prop.Parse(sft.Tag.Get("protobuf")) Type: reflect.ValueOf(oot).Type(), // *T
// There will be exactly one interface field that Prop: new(Properties),
// this new value is assignable to.
for i := 0; i < t.NumField(); i++ {
f := t.Field(i)
if f.Type.Kind() != reflect.Interface {
continue
} }
if !oop.Type.AssignableTo(f.Type) { sft := oop.Type.Elem().Field(0)
continue oop.Prop.Name = sft.Name
oop.Prop.Parse(sft.Tag.Get("protobuf"))
// There will be exactly one interface field that
// this new value is assignable to.
for i := 0; i < t.NumField(); i++ {
f := t.Field(i)
if f.Type.Kind() != reflect.Interface {
continue
}
if !oop.Type.AssignableTo(f.Type) {
continue
}
oop.Field = i
break
} }
oop.Field = i prop.OneofTypes[oop.Prop.OrigName] = oop
break
} }
prop.OneofTypes[oop.Prop.OrigName] = oop
} }
} }

View File

@ -389,8 +389,13 @@ func (u *marshalInfo) computeMarshalInfo() {
// get oneof implementers // get oneof implementers
var oneofImplementers []interface{} var oneofImplementers []interface{}
// gogo: isOneofMessage is needed for embedded oneof messages, without a marshaler and unmarshaler // gogo: isOneofMessage is needed for embedded oneof messages, without a marshaler and unmarshaler
if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok && isOneofMessage { if isOneofMessage {
_, _, _, oneofImplementers = m.XXX_OneofFuncs() switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) {
case oneofFuncsIface:
_, _, _, oneofImplementers = m.XXX_OneofFuncs()
case oneofWrappersIface:
oneofImplementers = m.XXX_OneofWrappers()
}
} }
// normal fields // normal fields
@ -519,10 +524,6 @@ func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofI
} }
} }
type oneofMessage interface {
XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{})
}
// wiretype returns the wire encoding of the type. // wiretype returns the wire encoding of the type.
func wiretype(encoding string) uint64 { func wiretype(encoding string) uint64 {
switch encoding { switch encoding {
@ -2968,7 +2969,9 @@ func (p *Buffer) Marshal(pb Message) error {
if m, ok := pb.(newMarshaler); ok { if m, ok := pb.(newMarshaler); ok {
siz := m.XXX_Size() siz := m.XXX_Size()
p.grow(siz) // make sure buf has enough capacity p.grow(siz) // make sure buf has enough capacity
p.buf, err = m.XXX_Marshal(p.buf, p.deterministic) pp := p.buf[len(p.buf) : len(p.buf) : len(p.buf)+siz]
pp, err = m.XXX_Marshal(pp, p.deterministic)
p.buf = append(p.buf, pp...)
return err return err
} }
if m, ok := pb.(Marshaler); ok { if m, ok := pb.(Marshaler); ok {

View File

@ -530,6 +530,25 @@ func (mi *mergeInfo) computeMergeInfo() {
} }
case reflect.Struct: case reflect.Struct:
switch { switch {
case isSlice && !isPointer: // E.g. []pb.T
mergeInfo := getMergeInfo(tf)
zero := reflect.Zero(tf)
mfi.merge = func(dst, src pointer) {
// TODO: Make this faster?
dstsp := dst.asPointerTo(f.Type)
dsts := dstsp.Elem()
srcs := src.asPointerTo(f.Type).Elem()
for i := 0; i < srcs.Len(); i++ {
dsts = reflect.Append(dsts, zero)
srcElement := srcs.Index(i).Addr()
dstElement := dsts.Index(dsts.Len() - 1).Addr()
mergeInfo.merge(valToPointer(dstElement), valToPointer(srcElement))
}
if dsts.IsNil() {
dsts = reflect.MakeSlice(f.Type, 0, 0)
}
dstsp.Elem().Set(dsts)
}
case !isPointer: case !isPointer:
mergeInfo := getMergeInfo(tf) mergeInfo := getMergeInfo(tf)
mfi.merge = func(dst, src pointer) { mfi.merge = func(dst, src pointer) {

View File

@ -371,15 +371,18 @@ func (u *unmarshalInfo) computeUnmarshalInfo() {
} }
// Find any types associated with oneof fields. // Find any types associated with oneof fields.
// TODO: XXX_OneofFuncs returns more info than we need. Get rid of some of it?
fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("XXX_OneofFuncs")
// gogo: len(oneofFields) > 0 is needed for embedded oneof messages, without a marshaler and unmarshaler // gogo: len(oneofFields) > 0 is needed for embedded oneof messages, without a marshaler and unmarshaler
if fn.IsValid() && len(oneofFields) > 0 { if len(oneofFields) > 0 {
res := fn.Call(nil)[3] // last return value from XXX_OneofFuncs: []interface{} var oneofImplementers []interface{}
for i := res.Len() - 1; i >= 0; i-- { switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) {
v := res.Index(i) // interface{} case oneofFuncsIface:
tptr := reflect.ValueOf(v.Interface()).Type() // *Msg_X _, _, _, oneofImplementers = m.XXX_OneofFuncs()
typ := tptr.Elem() // Msg_X case oneofWrappersIface:
oneofImplementers = m.XXX_OneofWrappers()
}
for _, v := range oneofImplementers {
tptr := reflect.TypeOf(v) // *Msg_X
typ := tptr.Elem() // Msg_X
f := typ.Field(0) // oneof implementers have one field f := typ.Field(0) // oneof implementers have one field
baseUnmarshal := fieldUnmarshaler(&f) baseUnmarshal := fieldUnmarshaler(&f)
@ -407,11 +410,12 @@ func (u *unmarshalInfo) computeUnmarshalInfo() {
u.setTag(fieldNum, of.field, unmarshal, 0, name) u.setTag(fieldNum, of.field, unmarshal, 0, name)
} }
} }
} }
} }
// Get extension ranges, if any. // Get extension ranges, if any.
fn = reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray") fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray")
if fn.IsValid() { if fn.IsValid() {
if !u.extensions.IsValid() && !u.oldExtensions.IsValid() && !u.bytesExtensions.IsValid() { if !u.extensions.IsValid() && !u.oldExtensions.IsValid() && !u.bytesExtensions.IsValid() {
panic("a message with extensions, but no extensions field in " + t.Name()) panic("a message with extensions, but no extensions field in " + t.Name())

View File

@ -476,6 +476,8 @@ func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error {
return nil return nil
} }
var textMarshalerType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem()
// writeAny writes an arbitrary field. // writeAny writes an arbitrary field.
func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error { func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error {
v = reflect.Indirect(v) v = reflect.Indirect(v)
@ -589,8 +591,8 @@ func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Propert
// mutating this value. // mutating this value.
v = v.Addr() v = v.Addr()
} }
if etm, ok := v.Interface().(encoding.TextMarshaler); ok { if v.Type().Implements(textMarshalerType) {
text, err := etm.MarshalText() text, err := v.Interface().(encoding.TextMarshaler).MarshalText()
if err != nil { if err != nil {
return err return err
} }

View File

@ -45,6 +45,7 @@
// flag "--${NAME}_out" is passed to protoc. // flag "--${NAME}_out" is passed to protoc.
syntax = "proto2"; syntax = "proto2";
package google.protobuf.compiler; package google.protobuf.compiler;
option java_package = "com.google.protobuf.compiler"; option java_package = "com.google.protobuf.compiler";
option java_outer_classname = "PluginProtos"; option java_outer_classname = "PluginProtos";

View File

@ -40,6 +40,7 @@
syntax = "proto2"; syntax = "proto2";
package google.protobuf; package google.protobuf;
option go_package = "descriptor"; option go_package = "descriptor";
option java_package = "com.google.protobuf"; option java_package = "com.google.protobuf";
option java_outer_classname = "DescriptorProtos"; option java_outer_classname = "DescriptorProtos";
@ -59,8 +60,8 @@ message FileDescriptorSet {
// Describes a complete .proto file. // Describes a complete .proto file.
message FileDescriptorProto { message FileDescriptorProto {
optional string name = 1; // file name, relative to root of source tree optional string name = 1; // file name, relative to root of source tree
optional string package = 2; // e.g. "foo", "foo.bar", etc. optional string package = 2; // e.g. "foo", "foo.bar", etc.
// Names of files imported by this file. // Names of files imported by this file.
repeated string dependency = 3; repeated string dependency = 3;
@ -100,8 +101,8 @@ message DescriptorProto {
repeated EnumDescriptorProto enum_type = 4; repeated EnumDescriptorProto enum_type = 4;
message ExtensionRange { message ExtensionRange {
optional int32 start = 1; optional int32 start = 1; // Inclusive.
optional int32 end = 2; optional int32 end = 2; // Exclusive.
optional ExtensionRangeOptions options = 3; optional ExtensionRangeOptions options = 3;
} }
@ -115,8 +116,8 @@ message DescriptorProto {
// fields or extension ranges in the same message. Reserved ranges may // fields or extension ranges in the same message. Reserved ranges may
// not overlap. // not overlap.
message ReservedRange { message ReservedRange {
optional int32 start = 1; // Inclusive. optional int32 start = 1; // Inclusive.
optional int32 end = 2; // Exclusive. optional int32 end = 2; // Exclusive.
} }
repeated ReservedRange reserved_range = 9; repeated ReservedRange reserved_range = 9;
// Reserved field names, which may not be used by fields in the same message. // Reserved field names, which may not be used by fields in the same message.
@ -137,42 +138,42 @@ message FieldDescriptorProto {
enum Type { enum Type {
// 0 is reserved for errors. // 0 is reserved for errors.
// Order is weird for historical reasons. // Order is weird for historical reasons.
TYPE_DOUBLE = 1; TYPE_DOUBLE = 1;
TYPE_FLOAT = 2; TYPE_FLOAT = 2;
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
// negative values are likely. // negative values are likely.
TYPE_INT64 = 3; TYPE_INT64 = 3;
TYPE_UINT64 = 4; TYPE_UINT64 = 4;
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
// negative values are likely. // negative values are likely.
TYPE_INT32 = 5; TYPE_INT32 = 5;
TYPE_FIXED64 = 6; TYPE_FIXED64 = 6;
TYPE_FIXED32 = 7; TYPE_FIXED32 = 7;
TYPE_BOOL = 8; TYPE_BOOL = 8;
TYPE_STRING = 9; TYPE_STRING = 9;
// Tag-delimited aggregate. // Tag-delimited aggregate.
// Group type is deprecated and not supported in proto3. However, Proto3 // Group type is deprecated and not supported in proto3. However, Proto3
// implementations should still be able to parse the group wire format and // implementations should still be able to parse the group wire format and
// treat group fields as unknown fields. // treat group fields as unknown fields.
TYPE_GROUP = 10; TYPE_GROUP = 10;
TYPE_MESSAGE = 11; // Length-delimited aggregate. TYPE_MESSAGE = 11; // Length-delimited aggregate.
// New in version 2. // New in version 2.
TYPE_BYTES = 12; TYPE_BYTES = 12;
TYPE_UINT32 = 13; TYPE_UINT32 = 13;
TYPE_ENUM = 14; TYPE_ENUM = 14;
TYPE_SFIXED32 = 15; TYPE_SFIXED32 = 15;
TYPE_SFIXED64 = 16; TYPE_SFIXED64 = 16;
TYPE_SINT32 = 17; // Uses ZigZag encoding. TYPE_SINT32 = 17; // Uses ZigZag encoding.
TYPE_SINT64 = 18; // Uses ZigZag encoding. TYPE_SINT64 = 18; // Uses ZigZag encoding.
}; }
enum Label { enum Label {
// 0 is reserved for errors // 0 is reserved for errors
LABEL_OPTIONAL = 1; LABEL_OPTIONAL = 1;
LABEL_REQUIRED = 2; LABEL_REQUIRED = 2;
LABEL_REPEATED = 3; LABEL_REPEATED = 3;
}; }
optional string name = 1; optional string name = 1;
optional int32 number = 3; optional int32 number = 3;
@ -234,8 +235,8 @@ message EnumDescriptorProto {
// is inclusive such that it can appropriately represent the entire int32 // is inclusive such that it can appropriately represent the entire int32
// domain. // domain.
message EnumReservedRange { message EnumReservedRange {
optional int32 start = 1; // Inclusive. optional int32 start = 1; // Inclusive.
optional int32 end = 2; // Inclusive. optional int32 end = 2; // Inclusive.
} }
// Range of reserved numeric values. Reserved numeric values may not be used // Range of reserved numeric values. Reserved numeric values may not be used
@ -276,9 +277,9 @@ message MethodDescriptorProto {
optional MethodOptions options = 4; optional MethodOptions options = 4;
// Identifies if client streams multiple client messages // Identifies if client streams multiple client messages
optional bool client_streaming = 5 [default=false]; optional bool client_streaming = 5 [default = false];
// Identifies if server streams multiple server messages // Identifies if server streams multiple server messages
optional bool server_streaming = 6 [default=false]; optional bool server_streaming = 6 [default = false];
} }
@ -314,7 +315,6 @@ message MethodDescriptorProto {
// If this turns out to be popular, a web service will be set up // If this turns out to be popular, a web service will be set up
// to automatically assign option numbers. // to automatically assign option numbers.
message FileOptions { message FileOptions {
// Sets the Java package where classes generated from this .proto will be // Sets the Java package where classes generated from this .proto will be
@ -337,7 +337,7 @@ message FileOptions {
// named by java_outer_classname. However, the outer class will still be // named by java_outer_classname. However, the outer class will still be
// generated to contain the file's getDescriptor() method as well as any // generated to contain the file's getDescriptor() method as well as any
// top-level extensions defined in the file. // top-level extensions defined in the file.
optional bool java_multiple_files = 10 [default=false]; optional bool java_multiple_files = 10 [default = false];
// This option does nothing. // This option does nothing.
optional bool java_generate_equals_and_hash = 20 [deprecated=true]; optional bool java_generate_equals_and_hash = 20 [deprecated=true];
@ -348,17 +348,17 @@ message FileOptions {
// Message reflection will do the same. // Message reflection will do the same.
// However, an extension field still accepts non-UTF-8 byte sequences. // However, an extension field still accepts non-UTF-8 byte sequences.
// This option has no effect on when used with the lite runtime. // This option has no effect on when used with the lite runtime.
optional bool java_string_check_utf8 = 27 [default=false]; optional bool java_string_check_utf8 = 27 [default = false];
// Generated classes can be optimized for speed or code size. // Generated classes can be optimized for speed or code size.
enum OptimizeMode { enum OptimizeMode {
SPEED = 1; // Generate complete code for parsing, serialization, SPEED = 1; // Generate complete code for parsing, serialization,
// etc. // etc.
CODE_SIZE = 2; // Use ReflectionOps to implement these methods. CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
} }
optional OptimizeMode optimize_for = 9 [default=SPEED]; optional OptimizeMode optimize_for = 9 [default = SPEED];
// Sets the Go package where structs generated from this .proto will be // Sets the Go package where structs generated from this .proto will be
// placed. If omitted, the Go package will be derived from the following: // placed. If omitted, the Go package will be derived from the following:
@ -369,6 +369,7 @@ message FileOptions {
// Should generic services be generated in each language? "Generic" services // Should generic services be generated in each language? "Generic" services
// are not specific to any particular RPC system. They are generated by the // are not specific to any particular RPC system. They are generated by the
// main code generators in each language (without additional plugins). // main code generators in each language (without additional plugins).
@ -379,20 +380,20 @@ message FileOptions {
// that generate code specific to your particular RPC system. Therefore, // that generate code specific to your particular RPC system. Therefore,
// these default to false. Old code which depends on generic services should // these default to false. Old code which depends on generic services should
// explicitly set them to true. // explicitly set them to true.
optional bool cc_generic_services = 16 [default=false]; optional bool cc_generic_services = 16 [default = false];
optional bool java_generic_services = 17 [default=false]; optional bool java_generic_services = 17 [default = false];
optional bool py_generic_services = 18 [default=false]; optional bool py_generic_services = 18 [default = false];
optional bool php_generic_services = 42 [default=false]; optional bool php_generic_services = 42 [default = false];
// Is this file deprecated? // Is this file deprecated?
// Depending on the target platform, this can emit Deprecated annotations // Depending on the target platform, this can emit Deprecated annotations
// for everything in the file, or it will be completely ignored; in the very // for everything in the file, or it will be completely ignored; in the very
// least, this is a formalization for deprecating files. // least, this is a formalization for deprecating files.
optional bool deprecated = 23 [default=false]; optional bool deprecated = 23 [default = false];
// Enables the use of arenas for the proto messages in this file. This applies // Enables the use of arenas for the proto messages in this file. This applies
// only to generated classes for C++. // only to generated classes for C++.
optional bool cc_enable_arenas = 31 [default=false]; optional bool cc_enable_arenas = 31 [default = false];
// Sets the objective c class prefix which is prepended to all objective c // Sets the objective c class prefix which is prepended to all objective c
@ -417,10 +418,9 @@ message FileOptions {
// determining the namespace. // determining the namespace.
optional string php_namespace = 41; optional string php_namespace = 41;
// Use this option to change the namespace of php generated metadata classes. // Use this option to change the namespace of php generated metadata classes.
// Default is empty. When this option is empty, the proto file name will be used // Default is empty. When this option is empty, the proto file name will be
// for determining the namespace. // used for determining the namespace.
optional string php_metadata_namespace = 44; optional string php_metadata_namespace = 44;
// Use this option to change the package of ruby generated classes. Default // Use this option to change the package of ruby generated classes. Default
@ -428,6 +428,7 @@ message FileOptions {
// determining the ruby package. // determining the ruby package.
optional string ruby_package = 45; optional string ruby_package = 45;
// The parser stores options it doesn't recognize here. // The parser stores options it doesn't recognize here.
// See the documentation for the "Options" section above. // See the documentation for the "Options" section above.
repeated UninterpretedOption uninterpreted_option = 999; repeated UninterpretedOption uninterpreted_option = 999;
@ -458,18 +459,18 @@ message MessageOptions {
// //
// Because this is an option, the above two restrictions are not enforced by // Because this is an option, the above two restrictions are not enforced by
// the protocol compiler. // the protocol compiler.
optional bool message_set_wire_format = 1 [default=false]; optional bool message_set_wire_format = 1 [default = false];
// Disables the generation of the standard "descriptor()" accessor, which can // Disables the generation of the standard "descriptor()" accessor, which can
// conflict with a field of the same name. This is meant to make migration // conflict with a field of the same name. This is meant to make migration
// from proto1 easier; new code should avoid fields named "descriptor". // from proto1 easier; new code should avoid fields named "descriptor".
optional bool no_standard_descriptor_accessor = 2 [default=false]; optional bool no_standard_descriptor_accessor = 2 [default = false];
// Is this message deprecated? // Is this message deprecated?
// Depending on the target platform, this can emit Deprecated annotations // Depending on the target platform, this can emit Deprecated annotations
// for the message, or it will be completely ignored; in the very least, // for the message, or it will be completely ignored; in the very least,
// this is a formalization for deprecating messages. // this is a formalization for deprecating messages.
optional bool deprecated = 3 [default=false]; optional bool deprecated = 3 [default = false];
// Whether the message is an automatically generated map entry type for the // Whether the message is an automatically generated map entry type for the
// maps field. // maps field.
@ -486,7 +487,7 @@ message MessageOptions {
// //
// Implementations may choose not to generate the map_entry=true message, but // Implementations may choose not to generate the map_entry=true message, but
// use a native map in the target language to hold the keys and values. // use a native map in the target language to hold the keys and values.
// The reflection APIs in such implementions still need to work as // The reflection APIs in such implementations still need to work as
// if the field is a repeated message field. // if the field is a repeated message field.
// //
// NOTE: Do not set the option in .proto files. Always use the maps syntax // NOTE: Do not set the option in .proto files. Always use the maps syntax
@ -497,6 +498,7 @@ message MessageOptions {
//reserved 8; // javalite_serializable //reserved 8; // javalite_serializable
//reserved 9; // javanano_as_lite //reserved 9; // javanano_as_lite
// The parser stores options it doesn't recognize here. See above. // The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999; repeated UninterpretedOption uninterpreted_option = 999;
@ -576,16 +578,16 @@ message FieldOptions {
// implementation must either *always* check its required fields, or *never* // implementation must either *always* check its required fields, or *never*
// check its required fields, regardless of whether or not the message has // check its required fields, regardless of whether or not the message has
// been parsed. // been parsed.
optional bool lazy = 5 [default=false]; optional bool lazy = 5 [default = false];
// Is this field deprecated? // Is this field deprecated?
// Depending on the target platform, this can emit Deprecated annotations // Depending on the target platform, this can emit Deprecated annotations
// for accessors, or it will be completely ignored; in the very least, this // for accessors, or it will be completely ignored; in the very least, this
// is a formalization for deprecating fields. // is a formalization for deprecating fields.
optional bool deprecated = 3 [default=false]; optional bool deprecated = 3 [default = false];
// For Google-internal migration only. Do not use. // For Google-internal migration only. Do not use.
optional bool weak = 10 [default=false]; optional bool weak = 10 [default = false];
// The parser stores options it doesn't recognize here. See above. // The parser stores options it doesn't recognize here. See above.
@ -615,7 +617,7 @@ message EnumOptions {
// Depending on the target platform, this can emit Deprecated annotations // Depending on the target platform, this can emit Deprecated annotations
// for the enum, or it will be completely ignored; in the very least, this // for the enum, or it will be completely ignored; in the very least, this
// is a formalization for deprecating enums. // is a formalization for deprecating enums.
optional bool deprecated = 3 [default=false]; optional bool deprecated = 3 [default = false];
//reserved 5; // javanano_as_lite //reserved 5; // javanano_as_lite
@ -631,7 +633,7 @@ message EnumValueOptions {
// Depending on the target platform, this can emit Deprecated annotations // Depending on the target platform, this can emit Deprecated annotations
// for the enum value, or it will be completely ignored; in the very least, // for the enum value, or it will be completely ignored; in the very least,
// this is a formalization for deprecating enum values. // this is a formalization for deprecating enum values.
optional bool deprecated = 1 [default=false]; optional bool deprecated = 1 [default = false];
// The parser stores options it doesn't recognize here. See above. // The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999; repeated UninterpretedOption uninterpreted_option = 999;
@ -651,7 +653,7 @@ message ServiceOptions {
// Depending on the target platform, this can emit Deprecated annotations // Depending on the target platform, this can emit Deprecated annotations
// for the service, or it will be completely ignored; in the very least, // for the service, or it will be completely ignored; in the very least,
// this is a formalization for deprecating services. // this is a formalization for deprecating services.
optional bool deprecated = 33 [default=false]; optional bool deprecated = 33 [default = false];
// The parser stores options it doesn't recognize here. See above. // The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999; repeated UninterpretedOption uninterpreted_option = 999;
@ -671,18 +673,18 @@ message MethodOptions {
// Depending on the target platform, this can emit Deprecated annotations // Depending on the target platform, this can emit Deprecated annotations
// for the method, or it will be completely ignored; in the very least, // for the method, or it will be completely ignored; in the very least,
// this is a formalization for deprecating methods. // this is a formalization for deprecating methods.
optional bool deprecated = 33 [default=false]; optional bool deprecated = 33 [default = false];
// Is this method side-effect-free (or safe in HTTP parlance), or idempotent, // Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
// or neither? HTTP based RPC implementation may choose GET verb for safe // or neither? HTTP based RPC implementation may choose GET verb for safe
// methods, and PUT verb for idempotent methods instead of the default POST. // methods, and PUT verb for idempotent methods instead of the default POST.
enum IdempotencyLevel { enum IdempotencyLevel {
IDEMPOTENCY_UNKNOWN = 0; IDEMPOTENCY_UNKNOWN = 0;
NO_SIDE_EFFECTS = 1; // implies idempotent NO_SIDE_EFFECTS = 1; // implies idempotent
IDEMPOTENT = 2; // idempotent, but may have side effects IDEMPOTENT = 2; // idempotent, but may have side effects
} }
optional IdempotencyLevel idempotency_level = optional IdempotencyLevel idempotency_level = 34
34 [default=IDEMPOTENCY_UNKNOWN]; [default = IDEMPOTENCY_UNKNOWN];
// The parser stores options it doesn't recognize here. See above. // The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999; repeated UninterpretedOption uninterpreted_option = 999;
@ -763,7 +765,7 @@ message SourceCodeInfo {
// beginning of the "extend" block and is shared by all extensions within // beginning of the "extend" block and is shared by all extensions within
// the block. // the block.
// - Just because a location's span is a subset of some other location's span // - Just because a location's span is a subset of some other location's span
// does not mean that it is a descendent. For example, a "group" defines // does not mean that it is a descendant. For example, a "group" defines
// both a type and a field in a single declaration. Thus, the locations // both a type and a field in a single declaration. Thus, the locations
// corresponding to the type and field and their components will overlap. // corresponding to the type and field and their components will overlap.
// - Code which tries to interpret locations should probably be designed to // - Code which tries to interpret locations should probably be designed to
@ -794,14 +796,14 @@ message SourceCodeInfo {
// [ 4, 3, 2, 7 ] // [ 4, 3, 2, 7 ]
// this path refers to the whole field declaration (from the beginning // this path refers to the whole field declaration (from the beginning
// of the label to the terminating semicolon). // of the label to the terminating semicolon).
repeated int32 path = 1 [packed=true]; repeated int32 path = 1 [packed = true];
// Always has exactly three or four elements: start line, start column, // Always has exactly three or four elements: start line, start column,
// end line (optional, otherwise assumed same as start line), end column. // end line (optional, otherwise assumed same as start line), end column.
// These are packed into a single field for efficiency. Note that line // These are packed into a single field for efficiency. Note that line
// and column numbers are zero-based -- typically you will want to add // and column numbers are zero-based -- typically you will want to add
// 1 to each before displaying to a user. // 1 to each before displaying to a user.
repeated int32 span = 2 [packed=true]; repeated int32 span = 2 [packed = true];
// If this SourceCodeInfo represents a complete declaration, these are any // If this SourceCodeInfo represents a complete declaration, these are any
// comments appearing before and after the declaration which appear to be // comments appearing before and after the declaration which appear to be
@ -866,7 +868,7 @@ message GeneratedCodeInfo {
message Annotation { message Annotation {
// Identifies the element in the original source .proto file. This field // Identifies the element in the original source .proto file. This field
// is formatted the same as SourceCodeInfo.Location.path. // is formatted the same as SourceCodeInfo.Location.path.
repeated int32 path = 1 [packed=true]; repeated int32 path = 1 [packed = true];
// Identifies the filesystem path to the original source .proto. // Identifies the filesystem path to the original source .proto.
optional string source_file = 2; optional string source_file = 2;

View File

@ -101,7 +101,6 @@ option objc_class_prefix = "GPB";
// //
// //
message Duration { message Duration {
// Signed seconds of the span of time. Must be from -315,576,000,000 // Signed seconds of the span of time. Must be from -315,576,000,000
// to +315,576,000,000 inclusive. Note: these bounds are computed from: // to +315,576,000,000 inclusive. Note: these bounds are computed from:
// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years

View File

@ -40,7 +40,6 @@ option java_outer_classname = "StructProto";
option java_multiple_files = true; option java_multiple_files = true;
option objc_class_prefix = "GPB"; option objc_class_prefix = "GPB";
// `Struct` represents a structured data value, consisting of fields // `Struct` represents a structured data value, consisting of fields
// which map to dynamically typed values. In some languages, `Struct` // which map to dynamically typed values. In some languages, `Struct`
// might be supported by a native representation. For example, in // might be supported by a native representation. For example, in

View File

@ -113,17 +113,18 @@ option objc_class_prefix = "GPB";
// 01:30 UTC on January 15, 2017. // 01:30 UTC on January 15, 2017.
// //
// In JavaScript, one can convert a Date object to this format using the // In JavaScript, one can convert a Date object to this format using the
// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) // standard
// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
// method. In Python, a standard `datetime.datetime` object can be converted // method. In Python, a standard `datetime.datetime` object can be converted
// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) // to this format using
// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
// can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( // the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
// the Joda Time's [`ISODateTimeFormat.dateTime()`](
// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D // http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
// ) to obtain a formatter capable of generating timestamps in this format. // ) to obtain a formatter capable of generating timestamps in this format.
// //
// //
message Timestamp { message Timestamp {
// Represents seconds of UTC time since Unix epoch // Represents seconds of UTC time since Unix epoch
// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
// 9999-12-31T23:59:59Z inclusive. // 9999-12-31T23:59:59Z inclusive.

View File

@ -64,44 +64,44 @@ message Field {
// Basic field types. // Basic field types.
enum Kind { enum Kind {
// Field type unknown. // Field type unknown.
TYPE_UNKNOWN = 0; TYPE_UNKNOWN = 0;
// Field type double. // Field type double.
TYPE_DOUBLE = 1; TYPE_DOUBLE = 1;
// Field type float. // Field type float.
TYPE_FLOAT = 2; TYPE_FLOAT = 2;
// Field type int64. // Field type int64.
TYPE_INT64 = 3; TYPE_INT64 = 3;
// Field type uint64. // Field type uint64.
TYPE_UINT64 = 4; TYPE_UINT64 = 4;
// Field type int32. // Field type int32.
TYPE_INT32 = 5; TYPE_INT32 = 5;
// Field type fixed64. // Field type fixed64.
TYPE_FIXED64 = 6; TYPE_FIXED64 = 6;
// Field type fixed32. // Field type fixed32.
TYPE_FIXED32 = 7; TYPE_FIXED32 = 7;
// Field type bool. // Field type bool.
TYPE_BOOL = 8; TYPE_BOOL = 8;
// Field type string. // Field type string.
TYPE_STRING = 9; TYPE_STRING = 9;
// Field type group. Proto2 syntax only, and deprecated. // Field type group. Proto2 syntax only, and deprecated.
TYPE_GROUP = 10; TYPE_GROUP = 10;
// Field type message. // Field type message.
TYPE_MESSAGE = 11; TYPE_MESSAGE = 11;
// Field type bytes. // Field type bytes.
TYPE_BYTES = 12; TYPE_BYTES = 12;
// Field type uint32. // Field type uint32.
TYPE_UINT32 = 13; TYPE_UINT32 = 13;
// Field type enum. // Field type enum.
TYPE_ENUM = 14; TYPE_ENUM = 14;
// Field type sfixed32. // Field type sfixed32.
TYPE_SFIXED32 = 15; TYPE_SFIXED32 = 15;
// Field type sfixed64. // Field type sfixed64.
TYPE_SFIXED64 = 16; TYPE_SFIXED64 = 16;
// Field type sint32. // Field type sint32.
TYPE_SINT32 = 17; TYPE_SINT32 = 17;
// Field type sint64. // Field type sint64.
TYPE_SINT64 = 18; TYPE_SINT64 = 18;
}; }
// Whether a field is optional, required, or repeated. // Whether a field is optional, required, or repeated.
enum Cardinality { enum Cardinality {

View File

@ -18,7 +18,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type FieldDescriptorProto_Type int32 type FieldDescriptorProto_Type int32
@ -1364,8 +1364,8 @@ type FileOptions struct {
// determining the namespace. // determining the namespace.
PhpNamespace *string `protobuf:"bytes,41,opt,name=php_namespace,json=phpNamespace" json:"php_namespace,omitempty"` PhpNamespace *string `protobuf:"bytes,41,opt,name=php_namespace,json=phpNamespace" json:"php_namespace,omitempty"`
// Use this option to change the namespace of php generated metadata classes. // Use this option to change the namespace of php generated metadata classes.
// Default is empty. When this option is empty, the proto file name will be used // Default is empty. When this option is empty, the proto file name will be
// for determining the namespace. // used for determining the namespace.
PhpMetadataNamespace *string `protobuf:"bytes,44,opt,name=php_metadata_namespace,json=phpMetadataNamespace" json:"php_metadata_namespace,omitempty"` PhpMetadataNamespace *string `protobuf:"bytes,44,opt,name=php_metadata_namespace,json=phpMetadataNamespace" json:"php_metadata_namespace,omitempty"`
// Use this option to change the package of ruby generated classes. Default // Use this option to change the package of ruby generated classes. Default
// is empty. When this option is not set, the package name will be used for // is empty. When this option is not set, the package name will be used for
@ -1615,7 +1615,7 @@ type MessageOptions struct {
// //
// Implementations may choose not to generate the map_entry=true message, but // Implementations may choose not to generate the map_entry=true message, but
// use a native map in the target language to hold the keys and values. // use a native map in the target language to hold the keys and values.
// The reflection APIs in such implementions still need to work as // The reflection APIs in such implementations still need to work as
// if the field is a repeated message field. // if the field is a repeated message field.
// //
// NOTE: Do not set the option in .proto files. Always use the maps syntax // NOTE: Do not set the option in .proto files. Always use the maps syntax
@ -2363,7 +2363,7 @@ type SourceCodeInfo struct {
// beginning of the "extend" block and is shared by all extensions within // beginning of the "extend" block and is shared by all extensions within
// the block. // the block.
// - Just because a location's span is a subset of some other location's span // - Just because a location's span is a subset of some other location's span
// does not mean that it is a descendent. For example, a "group" defines // does not mean that it is a descendant. For example, a "group" defines
// both a type and a field in a single declaration. Thus, the locations // both a type and a field in a single declaration. Thus, the locations
// corresponding to the type and field and their components will overlap. // corresponding to the type and field and their components will overlap.
// - Code which tries to interpret locations should probably be designed to // - Code which tries to interpret locations should probably be designed to

View File

@ -73,7 +73,7 @@ import (
// It is incremented whenever an incompatibility between the generated code and // It is incremented whenever an incompatibility between the generated code and
// proto package is introduced; the generated code references // proto package is introduced; the generated code references
// a constant, proto.ProtoPackageIsVersionN (where N is generatedCodeVersion). // a constant, proto.ProtoPackageIsVersionN (where N is generatedCodeVersion).
const generatedCodeVersion = 2 const generatedCodeVersion = 3
// A Plugin provides functionality to add to the output during Go code generation, // A Plugin provides functionality to add to the output during Go code generation,
// such as to produce RPC stubs. // such as to produce RPC stubs.
@ -482,6 +482,7 @@ func New() *Generator {
g.Request = new(plugin.CodeGeneratorRequest) g.Request = new(plugin.CodeGeneratorRequest)
g.Response = new(plugin.CodeGeneratorResponse) g.Response = new(plugin.CodeGeneratorResponse)
g.writtenImports = make(map[string]bool) g.writtenImports = make(map[string]bool)
g.addedImports = make(map[GoImportPath]bool)
return g return g
} }
@ -2232,391 +2233,14 @@ type oneofSubField struct {
getterDef string // Default for getters, e.g. "nil", `""` or "Default_MessageType_FieldName" getterDef string // Default for getters, e.g. "nil", `""` or "Default_MessageType_FieldName"
protoDef string // Default value as defined in the proto file, e.g "yoshi" or "5" protoDef string // Default value as defined in the proto file, e.g "yoshi" or "5"
deprecated string // Deprecation comment, if any. deprecated string // Deprecation comment, if any.
wireType string // gogo. We can set this on creation, instead of using a function
}
// wireTypeName returns a textual wire type, needed for oneof sub fields in generated code.
func (f *oneofSubField) wireTypeName() string {
return f.wireType
} }
// typedNil prints a nil casted to the pointer to this field. // typedNil prints a nil casted to the pointer to this field.
// - for XXX_OneofFuncs // - for XXX_OneofWrappers
func (f *oneofSubField) typedNil(g *Generator) { func (f *oneofSubField) typedNil(g *Generator) {
g.P("(*", f.oneofTypeName, ")(nil),") g.P("(*", f.oneofTypeName, ")(nil),")
} }
// marshalCase prints the case matching this oneof subfield in the marshalling code.
func (f *oneofSubField) marshalCase(g *Generator, mc *msgCtx) {
// if field.OneofIndex == nil || int(*field.OneofIndex) != oi {
// continue
// }
g.P("case *", f.oneofTypeName, ":")
var pre, post string
val := "x." + f.goName // overridden for TYPE_BOOL
canFail := false // only TYPE_MESSAGE and TYPE_GROUP can fail
switch f.protoType {
case descriptor.FieldDescriptorProto_TYPE_DOUBLE:
pre = "b.EncodeFixed64(" + g.Pkg["math"] + ".Float64bits("
post = "))"
case descriptor.FieldDescriptorProto_TYPE_FLOAT:
pre = "b.EncodeFixed32(uint64(" + g.Pkg["math"] + ".Float32bits("
post = ")))"
case descriptor.FieldDescriptorProto_TYPE_INT64,
descriptor.FieldDescriptorProto_TYPE_UINT64:
pre, post = "b.EncodeVarint(uint64(", "))"
case descriptor.FieldDescriptorProto_TYPE_INT32,
descriptor.FieldDescriptorProto_TYPE_UINT32,
descriptor.FieldDescriptorProto_TYPE_ENUM:
pre, post = "b.EncodeVarint(uint64(", "))"
case descriptor.FieldDescriptorProto_TYPE_FIXED64,
descriptor.FieldDescriptorProto_TYPE_SFIXED64:
pre, post = "b.EncodeFixed64(uint64(", "))"
case descriptor.FieldDescriptorProto_TYPE_FIXED32,
descriptor.FieldDescriptorProto_TYPE_SFIXED32:
pre, post = "b.EncodeFixed32(uint64(", "))"
case descriptor.FieldDescriptorProto_TYPE_BOOL:
// bool needs special handling.
g.P("t := uint64(0)")
g.P("if ", val, " { t = 1 }")
val = "t"
pre, post = "b.EncodeVarint(", ")"
case descriptor.FieldDescriptorProto_TYPE_STRING:
pre, post = "b.EncodeStringBytes(", ")"
case descriptor.FieldDescriptorProto_TYPE_GROUP:
pre, post = "b.Marshal(", ")"
canFail = true
case descriptor.FieldDescriptorProto_TYPE_MESSAGE:
pre, post = "b.EncodeMessage(", ")"
canFail = true
case descriptor.FieldDescriptorProto_TYPE_BYTES:
pre, post = "b.EncodeRawBytes(", ")"
case descriptor.FieldDescriptorProto_TYPE_SINT32:
pre, post = "b.EncodeZigzag32(uint64(", "))"
case descriptor.FieldDescriptorProto_TYPE_SINT64:
pre, post = "b.EncodeZigzag64(uint64(", "))"
default:
g.Fail("unhandled oneof field type ", f.protoType.String())
}
g.P("_ = b.EncodeVarint(", f.fieldNumber, "<<3|", g.Pkg["proto"], ".", f.wireTypeName(), ")")
if f.protoType == descriptor.FieldDescriptorProto_TYPE_BYTES && gogoproto.IsCustomType(f.protoField) {
g.P(`dAtA, err := `, val, `.Marshal()`)
g.P(`if err != nil {`)
g.In()
g.P(`return err`)
g.Out()
g.P(`}`)
val = "dAtA"
} else if gogoproto.IsStdType(f.protoField) {
pkg := g.useTypes()
ptr := ""
fnname := ""
if gogoproto.IsNullable(f.protoField) {
ptr = "*"
}
if gogoproto.IsStdTime(f.protoField) {
fnname = "Time"
} else if gogoproto.IsStdDuration(f.protoField) {
fnname = "Duration"
} else if gogoproto.IsStdDouble(f.protoField) {
fnname = "Double"
} else if gogoproto.IsStdFloat(f.protoField) {
fnname = "Float"
} else if gogoproto.IsStdInt64(f.protoField) {
fnname = "Int64"
} else if gogoproto.IsStdUInt64(f.protoField) {
fnname = "UInt64"
} else if gogoproto.IsStdInt32(f.protoField) {
fnname = "Int32"
} else if gogoproto.IsStdUInt32(f.protoField) {
fnname = "UInt32"
} else if gogoproto.IsStdBool(f.protoField) {
fnname = "Bool"
} else if gogoproto.IsStdString(f.protoField) {
fnname = "String"
} else if gogoproto.IsStdBytes(f.protoField) {
fnname = "Bytes"
} else {
panic("internal error")
}
g.P(`dAtA, err := `, pkg, `.Std`, fnname, `Marshal(`, ptr, val, `)`)
g.P(`if err != nil {`)
g.In()
g.P(`return err`)
g.Out()
g.P(`}`)
val = "dAtA"
pre, post = "b.EncodeRawBytes(", ")"
}
if !canFail {
g.P("_ = ", pre, val, post)
} else {
g.P("if err := ", pre, val, post, "; err != nil {")
g.In()
g.P("return err")
g.Out()
g.P("}")
}
if f.protoType == descriptor.FieldDescriptorProto_TYPE_GROUP {
g.P("_ = b.EncodeVarint(", f.fieldNumber, "<<3|", g.Pkg["proto"], ".WireEndGroup)")
}
}
// unmarshalCase prints the case matching this oneof subfield in the unmarshalling code.
func (f *oneofSubField) unmarshalCase(g *Generator, origOneofName string, oneofName string, mc *msgCtx) {
// if field.OneofIndex == nil {
// continue
// }
g.P("case ", f.fieldNumber, ": // ", origOneofName, ".", f.getProtoName())
g.P("if wire != ", g.Pkg["proto"], ".", f.wireTypeName(), " {")
g.P("return true, ", g.Pkg["proto"], ".ErrInternalBadWireType")
g.P("}")
lhs := "x, err" // overridden for TYPE_MESSAGE and TYPE_GROUP
var dec, cast, cast2 string
switch f.protoType {
case descriptor.FieldDescriptorProto_TYPE_DOUBLE:
dec, cast = "b.DecodeFixed64()", g.Pkg["math"]+".Float64frombits"
case descriptor.FieldDescriptorProto_TYPE_FLOAT:
dec, cast, cast2 = "b.DecodeFixed32()", "uint32", g.Pkg["math"]+".Float32frombits"
case descriptor.FieldDescriptorProto_TYPE_INT64:
dec, cast = "b.DecodeVarint()", "int64"
case descriptor.FieldDescriptorProto_TYPE_UINT64:
dec = "b.DecodeVarint()"
case descriptor.FieldDescriptorProto_TYPE_INT32:
dec, cast = "b.DecodeVarint()", "int32"
case descriptor.FieldDescriptorProto_TYPE_FIXED64:
dec = "b.DecodeFixed64()"
case descriptor.FieldDescriptorProto_TYPE_FIXED32:
dec, cast = "b.DecodeFixed32()", "uint32"
case descriptor.FieldDescriptorProto_TYPE_BOOL:
dec = "b.DecodeVarint()"
// handled specially below
case descriptor.FieldDescriptorProto_TYPE_STRING:
dec = "b.DecodeStringBytes()"
case descriptor.FieldDescriptorProto_TYPE_GROUP:
g.P("msg := new(", f.goType[1:], ")") // drop star
lhs = "err"
dec = "b.DecodeGroup(msg)"
// handled specially below
case descriptor.FieldDescriptorProto_TYPE_MESSAGE:
if gogoproto.IsStdType(f.protoField) {
dec = "b.DecodeRawBytes(true)"
} else {
g.P("msg := new(", f.goType[1:], ")") // drop star
lhs = "err"
dec = "b.DecodeMessage(msg)"
}
// handled specially below
case descriptor.FieldDescriptorProto_TYPE_BYTES:
dec = "b.DecodeRawBytes(true)"
case descriptor.FieldDescriptorProto_TYPE_UINT32:
dec, cast = "b.DecodeVarint()", "uint32"
case descriptor.FieldDescriptorProto_TYPE_ENUM:
dec, cast = "b.DecodeVarint()", f.goType
case descriptor.FieldDescriptorProto_TYPE_SFIXED32:
dec, cast = "b.DecodeFixed32()", "int32"
case descriptor.FieldDescriptorProto_TYPE_SFIXED64:
dec, cast = "b.DecodeFixed64()", "int64"
case descriptor.FieldDescriptorProto_TYPE_SINT32:
dec, cast = "b.DecodeZigzag32()", "int32"
case descriptor.FieldDescriptorProto_TYPE_SINT64:
dec, cast = "b.DecodeZigzag64()", "int64"
default:
g.Fail("unhandled oneof field type ", f.protoType.String())
}
g.P(lhs, " := ", dec)
val := "x"
if f.protoType == descriptor.FieldDescriptorProto_TYPE_BYTES && gogoproto.IsCustomType(f.protoField) {
g.P(`if err != nil {`)
g.In()
g.P(`return true, err`)
g.Out()
g.P(`}`)
_, ctyp, err := GetCustomType(f.protoField)
if err != nil {
panic(err)
}
g.P(`var cc `, ctyp)
g.P(`c := &cc`)
g.P(`err = c.Unmarshal(`, val, `)`)
val = "*c"
} else if gogoproto.IsStdType(f.protoField) {
var stdtype string
var fnname string
if gogoproto.IsStdTime(f.protoField) {
stdtype = "time.Time"
fnname = "Time"
} else if gogoproto.IsStdDuration(f.protoField) {
stdtype = "time.Duration"
fnname = "Duration"
} else if gogoproto.IsStdDouble(f.protoField) {
stdtype = "float64"
fnname = "Double"
} else if gogoproto.IsStdFloat(f.protoField) {
stdtype = "float32"
fnname = "Float"
} else if gogoproto.IsStdInt64(f.protoField) {
stdtype = "int64"
fnname = "Int64"
} else if gogoproto.IsStdUInt64(f.protoField) {
stdtype = "uint64"
fnname = "UInt64"
} else if gogoproto.IsStdInt32(f.protoField) {
stdtype = "int32"
fnname = "Int32"
} else if gogoproto.IsStdUInt32(f.protoField) {
stdtype = "uint32"
fnname = "UInt32"
} else if gogoproto.IsStdBool(f.protoField) {
stdtype = "bool"
fnname = "Bool"
} else if gogoproto.IsStdString(f.protoField) {
stdtype = "string"
fnname = "String"
} else if gogoproto.IsStdBytes(f.protoField) {
stdtype = "[]byte"
fnname = "Bytes"
} else {
panic("internal error")
}
pkg := g.useTypes()
g.P(`if err != nil {`)
g.In()
g.P(`return true, err`)
g.Out()
g.P(`}`)
g.P(`c := new(`, stdtype, `)`)
g.P(`if err2 := `, pkg, `.Std`, fnname, `Unmarshal(c, `, val, `); err2 != nil {`)
g.In()
g.P(`return true, err`)
g.Out()
g.P(`}`)
val = "c"
}
if cast != "" {
val = cast + "(" + val + ")"
}
if cast2 != "" {
val = cast2 + "(" + val + ")"
}
switch f.protoType {
case descriptor.FieldDescriptorProto_TYPE_BOOL:
val += " != 0"
case descriptor.FieldDescriptorProto_TYPE_GROUP,
descriptor.FieldDescriptorProto_TYPE_MESSAGE:
if !gogoproto.IsStdType(f.protoField) {
val = "msg"
}
}
if gogoproto.IsCastType(f.protoField) {
_, typ, err := getCastType(f.protoField)
if err != nil {
g.Fail(err.Error())
}
val = typ + "(" + val + ")"
}
g.P("m.", oneofName, " = &", f.oneofTypeName, "{", val, "}")
g.P("return true, err")
}
// sizerCase prints the case matching this oneof subfield in the sizer code.
func (f *oneofSubField) sizerCase(g *Generator) {
// if field.OneofIndex == nil || int(*field.OneofIndex) != oi {
// continue
// }
g.P("case *", f.oneofTypeName, ":")
val := "x." + f.goName
var varint, fixed string
switch f.protoType {
case descriptor.FieldDescriptorProto_TYPE_DOUBLE:
fixed = "8"
case descriptor.FieldDescriptorProto_TYPE_FLOAT:
fixed = "4"
case descriptor.FieldDescriptorProto_TYPE_INT64,
descriptor.FieldDescriptorProto_TYPE_UINT64,
descriptor.FieldDescriptorProto_TYPE_INT32,
descriptor.FieldDescriptorProto_TYPE_UINT32,
descriptor.FieldDescriptorProto_TYPE_ENUM:
varint = val
case descriptor.FieldDescriptorProto_TYPE_FIXED64,
descriptor.FieldDescriptorProto_TYPE_SFIXED64:
fixed = "8"
case descriptor.FieldDescriptorProto_TYPE_FIXED32,
descriptor.FieldDescriptorProto_TYPE_SFIXED32:
fixed = "4"
case descriptor.FieldDescriptorProto_TYPE_BOOL:
fixed = "1"
case descriptor.FieldDescriptorProto_TYPE_STRING:
fixed = "len(" + val + ")"
varint = fixed
case descriptor.FieldDescriptorProto_TYPE_GROUP:
fixed = g.Pkg["proto"] + ".Size(" + val + ")"
case descriptor.FieldDescriptorProto_TYPE_MESSAGE:
if gogoproto.IsStdType(f.protoField) {
pkg := g.useTypes()
if gogoproto.IsNullable(f.protoField) {
val = "*" + val
}
if gogoproto.IsStdTime(f.protoField) {
g.P("s := ", pkg, ".SizeOfStdTime(", val, ")")
} else if gogoproto.IsStdDuration(f.protoField) {
g.P("s := ", pkg, ".SizeOfStdDuration(", val, ")")
} else if gogoproto.IsStdDouble(f.protoField) {
g.P("s := ", pkg, ".SizeOfStdDouble(", val, ")")
} else if gogoproto.IsStdFloat(f.protoField) {
g.P("s := ", pkg, ".SizeOfStdFloat(", val, ")")
} else if gogoproto.IsStdInt64(f.protoField) {
g.P("s := ", pkg, ".SizeOfStdInt64(", val, ")")
} else if gogoproto.IsStdUInt64(f.protoField) {
g.P("s := ", pkg, ".SizeOfStdUInt64(", val, ")")
} else if gogoproto.IsStdInt32(f.protoField) {
g.P("s := ", pkg, ".SizeOfStdInt32(", val, ")")
} else if gogoproto.IsStdUInt32(f.protoField) {
g.P("s := ", pkg, ".SizeOfStdUInt32(", val, ")")
} else if gogoproto.IsStdBool(f.protoField) {
g.P("s := ", pkg, ".SizeOfStdBool(", val, ")")
} else if gogoproto.IsStdString(f.protoField) {
g.P("s := ", pkg, ".SizeOfStdString(", val, ")")
} else if gogoproto.IsStdBytes(f.protoField) {
g.P("s := ", pkg, ".SizeOfStdBytes(", val, ")")
} else {
panic("internal error")
}
} else {
g.P("s := ", g.Pkg["proto"], ".Size(", val, ")")
}
fixed = "s"
varint = fixed
case descriptor.FieldDescriptorProto_TYPE_BYTES:
if gogoproto.IsCustomType(f.protoField) {
fixed = val + ".Size()"
} else {
fixed = "len(" + val + ")"
}
varint = fixed
case descriptor.FieldDescriptorProto_TYPE_SINT32:
varint = "(uint32(" + val + ") << 1) ^ uint32((int32(" + val + ") >> 31))"
case descriptor.FieldDescriptorProto_TYPE_SINT64:
varint = "uint64(" + val + " << 1) ^ uint64((int64(" + val + ") >> 63))"
default:
g.Fail("unhandled oneof field type ", f.protoType.String())
}
// Tag and wire varint is known statically,
// so don't generate code for that part of the size computation.
tagAndWireSize := proto.SizeVarint(uint64(f.fieldNumber << 3)) // wire doesn't affect varint size
g.P("n += ", tagAndWireSize, " // tag and wire")
if varint != "" {
g.P("n += ", g.Pkg["proto"], ".SizeVarint(uint64(", varint, "))")
}
if fixed != "" {
g.P("n += ", fixed)
}
if f.protoType == descriptor.FieldDescriptorProto_TYPE_GROUP {
g.P("n += ", tagAndWireSize, " // tag and wire")
}
}
// getProtoDef returns the default value explicitly stated in the proto file, e.g "yoshi" or "5". // getProtoDef returns the default value explicitly stated in the proto file, e.g "yoshi" or "5".
func (f *oneofSubField) getProtoDef() string { func (f *oneofSubField) getProtoDef() string {
return f.protoDef return f.protoDef
@ -2895,17 +2519,11 @@ func (g *Generator) generateOneofFuncs(mc *msgCtx, topLevelFields []topLevelFiel
if len(ofields) == 0 { if len(ofields) == 0 {
return return
} }
enc := "_" + mc.goName + "_OneofMarshaler"
dec := "_" + mc.goName + "_OneofUnmarshaler"
size := "_" + mc.goName + "_OneofSizer"
encSig := "(msg " + g.Pkg["proto"] + ".Message, b *" + g.Pkg["proto"] + ".Buffer) error"
decSig := "(msg " + g.Pkg["proto"] + ".Message, tag, wire int, b *" + g.Pkg["proto"] + ".Buffer) (bool, error)"
sizeSig := "(msg " + g.Pkg["proto"] + ".Message) (n int)"
// OneofFuncs // OneofFuncs
g.P("// XXX_OneofFuncs is for the internal use of the proto package.") g.P("// XXX_OneofWrappers is for the internal use of the proto package.")
g.P("func (*", mc.goName, ") XXX_OneofFuncs() (func", encSig, ", func", decSig, ", func", sizeSig, ", []interface{}) {") g.P("func (*", mc.goName, ") XXX_OneofWrappers() []interface{} {")
g.P("return ", enc, ", ", dec, ", ", size, ", []interface{}{") g.P("return []interface{}{")
for _, of := range ofields { for _, of := range ofields {
for _, sf := range of.subFields { for _, sf := range of.subFields {
sf.typedNil(g) sf.typedNil(g)
@ -2914,56 +2532,6 @@ func (g *Generator) generateOneofFuncs(mc *msgCtx, topLevelFields []topLevelFiel
g.P("}") g.P("}")
g.P("}") g.P("}")
g.P() g.P()
// marshaler
g.P("func ", enc, encSig, " {")
g.P("m := msg.(*", mc.goName, ")")
for _, of := range ofields {
g.P("// ", of.getProtoName())
g.P("switch x := m.", of.goName, ".(type) {")
for _, sf := range of.subFields {
sf.marshalCase(g, mc)
}
g.P("case nil:")
g.P("default: return ", g.Pkg["fmt"], `.Errorf("`, mc.goName, ".", of.goName, ` has unexpected type %T", x)`)
g.P("}")
}
g.P("return nil")
g.P("}")
g.P()
// unmarshaler
g.P("func ", dec, decSig, " {")
g.P("m := msg.(*", mc.goName, ")")
g.P("switch tag {")
for _, of := range ofields {
for _, sf := range of.subFields {
sf.unmarshalCase(g, of.getProtoName(), of.goName, mc)
}
}
g.P("default: return false, nil")
g.P("}")
g.P("}")
g.P()
// sizer
g.P("func ", size, sizeSig, " {")
g.P("m := msg.(*", mc.goName, ")")
for _, of := range ofields {
g.P("// ", of.getProtoName())
g.P("switch x := m.", of.goName, ".(type) {")
for _, sf := range of.subFields {
// also fills in field.wire
sf.sizerCase(g)
}
g.P("case nil:")
g.P("default:")
g.P("panic(", g.Pkg["fmt"], ".Sprintf(\"proto: unexpected type %T in oneof\", x))")
g.P("}")
}
g.P("return n")
g.P("}")
g.P()
} }
func (g *Generator) generateOneofDecls(mc *msgCtx, topLevelFields []topLevelField) { func (g *Generator) generateOneofDecls(mc *msgCtx, topLevelFields []topLevelField) {
@ -3004,16 +2572,17 @@ func (g *Generator) generateOneofDecls(mc *msgCtx, topLevelFields []topLevelFiel
if gogoproto.IsProtoSizer(g.file.FileDescriptorProto, mc.message.DescriptorProto) { if gogoproto.IsProtoSizer(g.file.FileDescriptorProto, mc.message.DescriptorProto) {
g.P(`ProtoSize() int`) g.P(`ProtoSize() int`)
} }
if gogoproto.HasCompare(g.file.FileDescriptorProto, mc.message.DescriptorProto) {
g.P(`Compare(interface{}) int`)
}
g.Out() g.Out()
g.P("}") g.P("}")
} }
g.P() g.P()
for _, of := range ofields { for _, of := range ofields {
for i, sf := range of.subFields { for i, sf := range of.subFields {
_, wiretype := g.GoType(mc.message, sf.protoField)
tag := "protobuf:" + g.goTag(mc.message, sf.protoField, wiretype)
fieldFullPath := fmt.Sprintf("%s,%d,%d", mc.message.path, messageFieldPath, i) fieldFullPath := fmt.Sprintf("%s,%d,%d", mc.message.path, messageFieldPath, i)
g.P("type ", Annotate(mc.message.file, fieldFullPath, sf.oneofTypeName), " struct{ ", Annotate(mc.message.file, fieldFullPath, sf.goName), " ", sf.goType, " `", tag, "` }") g.P("type ", Annotate(mc.message.file, fieldFullPath, sf.oneofTypeName), " struct{ ", Annotate(mc.message.file, fieldFullPath, sf.goName), " ", sf.goType, " `", sf.tags, "` }")
if !gogoproto.IsStdType(sf.protoField) && !gogoproto.IsCustomType(sf.protoField) && !gogoproto.IsCastType(sf.protoField) { if !gogoproto.IsStdType(sf.protoField) && !gogoproto.IsCustomType(sf.protoField) && !gogoproto.IsCastType(sf.protoField) {
g.RecordTypeUse(sf.protoField.GetTypeName()) g.RecordTypeUse(sf.protoField.GetTypeName())
} }
@ -3147,7 +2716,7 @@ func (g *Generator) generateCommonMethods(mc *msgCtx) {
gogoproto.IsUnsafeMarshaler(g.file.FileDescriptorProto, mc.message.DescriptorProto) { gogoproto.IsUnsafeMarshaler(g.file.FileDescriptorProto, mc.message.DescriptorProto) {
if gogoproto.IsStableMarshaler(g.file.FileDescriptorProto, mc.message.DescriptorProto) { if gogoproto.IsStableMarshaler(g.file.FileDescriptorProto, mc.message.DescriptorProto) {
g.P("b = b[:cap(b)]") g.P("b = b[:cap(b)]")
g.P("n, err := m.MarshalTo(b)") g.P("n, err := m.MarshalToSizedBuffer(b)")
g.P("if err != nil {") g.P("if err != nil {")
g.In() g.In()
g.P("return nil, err") g.P("return nil, err")
@ -3161,7 +2730,7 @@ func (g *Generator) generateCommonMethods(mc *msgCtx) {
g.P("} else {") g.P("} else {")
g.In() g.In()
g.P("b = b[:cap(b)]") g.P("b = b[:cap(b)]")
g.P("n, err := m.MarshalTo(b)") g.P("n, err := m.MarshalToSizedBuffer(b)")
g.P("if err != nil {") g.P("if err != nil {")
g.In() g.In()
g.P("return nil, err") g.P("return nil, err")
@ -3302,13 +2871,13 @@ func (g *Generator) generateMessage(message *Descriptor) {
// when we've computed any disambiguation. // when we've computed any disambiguation.
dname := "is" + goTypeName + "_" + fname dname := "is" + goTypeName + "_" + fname
tag := `protobuf_oneof:"` + odp.GetName() + `"` oneOftag := `protobuf_oneof:"` + odp.GetName() + `"`
of := oneofField{ of := oneofField{
fieldCommon: fieldCommon{ fieldCommon: fieldCommon{
goName: fname, goName: fname,
getterName: gname, getterName: gname,
goType: dname, goType: dname,
tags: tag, tags: oneOftag,
protoName: odp.GetName(), protoName: odp.GetName(),
fullPath: oneofFullPath, fullPath: oneofFullPath,
protoField: field, protoField: field,
@ -3361,7 +2930,6 @@ func (g *Generator) generateMessage(message *Descriptor) {
} }
oneofField := oFields[*field.OneofIndex] oneofField := oFields[*field.OneofIndex]
tag = "protobuf:" + g.goTag(message, field, wiretype)
sf := oneofSubField{ sf := oneofSubField{
fieldCommon: fieldCommon{ fieldCommon: fieldCommon{
goName: fieldName, goName: fieldName,
@ -3379,7 +2947,6 @@ func (g *Generator) generateMessage(message *Descriptor) {
protoDef: field.GetDefaultValue(), protoDef: field.GetDefaultValue(),
oneofTypeName: tname, oneofTypeName: tname,
deprecated: fieldDeprecated, deprecated: fieldDeprecated,
wireType: wireTypeName(field),
} }
oneofField.subFields = append(oneofField.subFields, &sf) oneofField.subFields = append(oneofField.subFields, &sf)
@ -3820,44 +3387,6 @@ func IsScalar(field *descriptor.FieldDescriptorProto) bool {
} }
} }
func wireTypeName(field *descriptor.FieldDescriptorProto) string {
switch *field.Type {
case descriptor.FieldDescriptorProto_TYPE_DOUBLE:
return "WireFixed64"
case descriptor.FieldDescriptorProto_TYPE_FLOAT:
return "WireFixed32"
case descriptor.FieldDescriptorProto_TYPE_INT64,
descriptor.FieldDescriptorProto_TYPE_UINT64:
return "WireVarint"
case descriptor.FieldDescriptorProto_TYPE_INT32,
descriptor.FieldDescriptorProto_TYPE_UINT32,
descriptor.FieldDescriptorProto_TYPE_ENUM:
return "WireVarint"
case descriptor.FieldDescriptorProto_TYPE_FIXED64,
descriptor.FieldDescriptorProto_TYPE_SFIXED64:
return "WireFixed64"
case descriptor.FieldDescriptorProto_TYPE_FIXED32,
descriptor.FieldDescriptorProto_TYPE_SFIXED32:
return "WireFixed32"
case descriptor.FieldDescriptorProto_TYPE_BOOL:
return "WireVarint"
case descriptor.FieldDescriptorProto_TYPE_STRING:
return "WireBytes"
case descriptor.FieldDescriptorProto_TYPE_GROUP:
return "WireStartGroup"
case descriptor.FieldDescriptorProto_TYPE_MESSAGE:
return "WireBytes"
case descriptor.FieldDescriptorProto_TYPE_BYTES:
return "WireBytes"
case descriptor.FieldDescriptorProto_TYPE_SINT32:
return "WireVarint"
case descriptor.FieldDescriptorProto_TYPE_SINT64:
return "WireVarint"
default:
return "WireVarint"
}
}
// badToUnderscore is the mapping function used to generate Go names from package names, // badToUnderscore is the mapping function used to generate Go names from package names,
// which can be dotted in the input .proto file. It replaces non-identifier characters such as // which can be dotted in the input .proto file. It replaces non-identifier characters such as
// dot or dash with underscore. // dot or dash with underscore.

View File

@ -355,6 +355,7 @@ func (g *Generator) generatePlugin(file *FileDescriptor, p Plugin) {
g.usedPackages = make(map[GoImportPath]bool) g.usedPackages = make(map[GoImportPath]bool)
g.packageNames = make(map[GoImportPath]GoPackageName) g.packageNames = make(map[GoImportPath]GoPackageName)
g.usedPackageNames = make(map[GoPackageName]bool) g.usedPackageNames = make(map[GoPackageName]bool)
g.addedImports = make(map[GoImportPath]bool)
g.file = file g.file = file
// Run the plugins before the imports so we know which imports are necessary. // Run the plugins before the imports so we know which imports are necessary.

61
vendor/github.com/gogo/protobuf/protoc-gen-gogo/grpc/grpc.go generated vendored Normal file → Executable file
View File

@ -54,6 +54,8 @@ const generatedCodeVersion = 4
const ( const (
contextPkgPath = "context" contextPkgPath = "context"
grpcPkgPath = "google.golang.org/grpc" grpcPkgPath = "google.golang.org/grpc"
codePkgPath = "google.golang.org/grpc/codes"
statusPkgPath = "google.golang.org/grpc/status"
) )
func init() { func init() {
@ -215,6 +217,12 @@ func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.Servi
g.P("}") g.P("}")
g.P() g.P()
// Server Unimplemented struct for forward compatability.
if deprecated {
g.P(deprecationComment)
}
g.generateUnimplementedServer(servName, service)
// Server registration. // Server registration.
if deprecated { if deprecated {
g.P(deprecationComment) g.P(deprecationComment)
@ -268,6 +276,35 @@ func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.Servi
g.P() g.P()
} }
// generateUnimplementedServer creates the unimplemented server struct
func (g *grpc) generateUnimplementedServer(servName string, service *pb.ServiceDescriptorProto) {
serverType := servName + "Server"
g.P("// Unimplemented", serverType, " can be embedded to have forward compatible implementations.")
g.P("type Unimplemented", serverType, " struct {")
g.P("}")
g.P()
// Unimplemented<service_name>Server's concrete methods
for _, method := range service.Method {
g.generateServerMethodConcrete(servName, method)
}
g.P()
}
// generateServerMethodConcrete returns unimplemented methods which ensure forward compatibility
func (g *grpc) generateServerMethodConcrete(servName string, method *pb.MethodDescriptorProto) {
header := g.generateServerSignatureWithParamNames(servName, method)
g.P("func (*Unimplemented", servName, "Server) ", header, " {")
var nilArg string
if !method.GetServerStreaming() && !method.GetClientStreaming() {
nilArg = "nil, "
}
methName := generator.CamelCase(method.GetName())
statusPkg := string(g.gen.AddImport(statusPkgPath))
codePkg := string(g.gen.AddImport(codePkgPath))
g.P("return ", nilArg, statusPkg, `.Errorf(`, codePkg, `.Unimplemented, "method `, methName, ` not implemented")`)
g.P("}")
}
// generateClientSignature returns the client-side signature for a method. // generateClientSignature returns the client-side signature for a method.
func (g *grpc) generateClientSignature(servName string, method *pb.MethodDescriptorProto) string { func (g *grpc) generateClientSignature(servName string, method *pb.MethodDescriptorProto) string {
origMethName := method.GetName() origMethName := method.GetName()
@ -367,6 +404,30 @@ func (g *grpc) generateClientMethod(servName, fullServName, serviceDescVar strin
} }
} }
// generateServerSignatureWithParamNames returns the server-side signature for a method with parameter names.
func (g *grpc) generateServerSignatureWithParamNames(servName string, method *pb.MethodDescriptorProto) string {
origMethName := method.GetName()
methName := generator.CamelCase(origMethName)
if reservedClientName[methName] {
methName += "_"
}
var reqArgs []string
ret := "error"
if !method.GetServerStreaming() && !method.GetClientStreaming() {
reqArgs = append(reqArgs, "ctx "+contextPkg+".Context")
ret = "(*" + g.typeName(method.GetOutputType()) + ", error)"
}
if !method.GetClientStreaming() {
reqArgs = append(reqArgs, "req *"+g.typeName(method.GetInputType()))
}
if method.GetServerStreaming() || method.GetClientStreaming() {
reqArgs = append(reqArgs, "srv "+servName+"_"+generator.CamelCase(origMethName)+"Server")
}
return methName + "(" + strings.Join(reqArgs, ", ") + ") " + ret
}
// generateServerSignature returns the server-side signature for a method. // generateServerSignature returns the server-side signature for a method.
func (g *grpc) generateServerSignature(servName string, method *pb.MethodDescriptorProto) string { func (g *grpc) generateServerSignature(servName string, method *pb.MethodDescriptorProto) string {
origMethName := method.GetName() origMethName := method.GetName()

View File

@ -19,7 +19,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// The version number of protocol compiler. // The version number of protocol compiler.
type Version struct { type Version struct {

View File

@ -9,6 +9,7 @@ import (
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -22,7 +23,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// `Any` contains an arbitrary serialized protocol buffer message along with a // `Any` contains an arbitrary serialized protocol buffer message along with a
// URL that describes the type of the serialized message. // URL that describes the type of the serialized message.
@ -155,7 +156,7 @@ func (m *Any) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Any.Marshal(b, m, deterministic) return xxx_messageInfo_Any.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -309,7 +310,7 @@ func valueToGoStringAny(v interface{}, typ string) string {
func (m *Any) Marshal() (dAtA []byte, err error) { func (m *Any) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -317,36 +318,46 @@ func (m *Any) Marshal() (dAtA []byte, err error) {
} }
func (m *Any) MarshalTo(dAtA []byte) (int, error) { func (m *Any) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Any) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.TypeUrl) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintAny(dAtA, i, uint64(len(m.TypeUrl)))
i += copy(dAtA[i:], m.TypeUrl)
} }
if len(m.Value) > 0 { if len(m.Value) > 0 {
dAtA[i] = 0x12 i -= len(m.Value)
i++ copy(dAtA[i:], m.Value)
i = encodeVarintAny(dAtA, i, uint64(len(m.Value))) i = encodeVarintAny(dAtA, i, uint64(len(m.Value)))
i += copy(dAtA[i:], m.Value) i--
dAtA[i] = 0x12
} }
if m.XXX_unrecognized != nil { if len(m.TypeUrl) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.TypeUrl)
copy(dAtA[i:], m.TypeUrl)
i = encodeVarintAny(dAtA, i, uint64(len(m.TypeUrl)))
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func encodeVarintAny(dAtA []byte, offset int, v uint64) int { func encodeVarintAny(dAtA []byte, offset int, v uint64) int {
offset -= sovAny(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func NewPopulatedAny(r randyAny, easy bool) *Any { func NewPopulatedAny(r randyAny, easy bool) *Any {
this := &Any{} this := &Any{}
@ -455,14 +466,7 @@ func (m *Any) Size() (n int) {
} }
func sovAny(x uint64) (n int) { func sovAny(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozAny(x uint64) (n int) { func sozAny(x uint64) (n int) {
return sovAny(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovAny(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -610,6 +614,7 @@ func (m *Any) Unmarshal(dAtA []byte) error {
func skipAny(dAtA []byte) (n int, err error) { func skipAny(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -641,10 +646,8 @@ func skipAny(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -665,55 +668,30 @@ func skipAny(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthAny return 0, ErrInvalidLengthAny
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthAny
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowAny
}
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 := skipAny(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthAny
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupAny
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthAny
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthAny = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthAny = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowAny = fmt.Errorf("proto: integer overflow") ErrIntOverflowAny = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupAny = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -9,6 +9,7 @@ import (
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -22,7 +23,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// Api is a light-weight descriptor for an API Interface. // Api is a light-weight descriptor for an API Interface.
// //
@ -88,7 +89,7 @@ func (m *Api) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Api.Marshal(b, m, deterministic) return xxx_messageInfo_Api.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -194,7 +195,7 @@ func (m *Method) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Method.Marshal(b, m, deterministic) return xxx_messageInfo_Method.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -368,7 +369,7 @@ func (m *Mixin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Mixin.Marshal(b, m, deterministic) return xxx_messageInfo_Mixin.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -862,7 +863,7 @@ func valueToGoStringApi(v interface{}, typ string) string {
func (m *Api) Marshal() (dAtA []byte, err error) { func (m *Api) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -870,83 +871,99 @@ func (m *Api) Marshal() (dAtA []byte, err error) {
} }
func (m *Api) MarshalTo(dAtA []byte) (int, error) { func (m *Api) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Api) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Name) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintApi(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
}
if len(m.Methods) > 0 {
for _, msg := range m.Methods {
dAtA[i] = 0x12
i++
i = encodeVarintApi(dAtA, i, uint64(msg.Size()))
n, err := msg.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n
}
}
if len(m.Options) > 0 {
for _, msg := range m.Options {
dAtA[i] = 0x1a
i++
i = encodeVarintApi(dAtA, i, uint64(msg.Size()))
n, err := msg.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n
}
}
if len(m.Version) > 0 {
dAtA[i] = 0x22
i++
i = encodeVarintApi(dAtA, i, uint64(len(m.Version)))
i += copy(dAtA[i:], m.Version)
}
if m.SourceContext != nil {
dAtA[i] = 0x2a
i++
i = encodeVarintApi(dAtA, i, uint64(m.SourceContext.Size()))
n1, err := m.SourceContext.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n1
}
if len(m.Mixins) > 0 {
for _, msg := range m.Mixins {
dAtA[i] = 0x32
i++
i = encodeVarintApi(dAtA, i, uint64(msg.Size()))
n, err := msg.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n
}
} }
if m.Syntax != 0 { if m.Syntax != 0 {
dAtA[i] = 0x38
i++
i = encodeVarintApi(dAtA, i, uint64(m.Syntax)) i = encodeVarintApi(dAtA, i, uint64(m.Syntax))
i--
dAtA[i] = 0x38
} }
if m.XXX_unrecognized != nil { if len(m.Mixins) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) for iNdEx := len(m.Mixins) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Mixins[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintApi(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
}
} }
return i, nil if m.SourceContext != nil {
{
size, err := m.SourceContext.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintApi(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x2a
}
if len(m.Version) > 0 {
i -= len(m.Version)
copy(dAtA[i:], m.Version)
i = encodeVarintApi(dAtA, i, uint64(len(m.Version)))
i--
dAtA[i] = 0x22
}
if len(m.Options) > 0 {
for iNdEx := len(m.Options) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Options[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintApi(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
}
}
if len(m.Methods) > 0 {
for iNdEx := len(m.Methods) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Methods[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintApi(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
if len(m.Name) > 0 {
i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintApi(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *Method) Marshal() (dAtA []byte, err error) { func (m *Method) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -954,75 +971,86 @@ func (m *Method) Marshal() (dAtA []byte, err error) {
} }
func (m *Method) MarshalTo(dAtA []byte) (int, error) { func (m *Method) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Method) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Name) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintApi(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
} }
if len(m.RequestTypeUrl) > 0 { if m.Syntax != 0 {
dAtA[i] = 0x12 i = encodeVarintApi(dAtA, i, uint64(m.Syntax))
i++ i--
i = encodeVarintApi(dAtA, i, uint64(len(m.RequestTypeUrl))) dAtA[i] = 0x38
i += copy(dAtA[i:], m.RequestTypeUrl)
} }
if m.RequestStreaming { if len(m.Options) > 0 {
dAtA[i] = 0x18 for iNdEx := len(m.Options) - 1; iNdEx >= 0; iNdEx-- {
i++ {
if m.RequestStreaming { size, err := m.Options[iNdEx].MarshalToSizedBuffer(dAtA[:i])
dAtA[i] = 1 if err != nil {
} else { return 0, err
dAtA[i] = 0 }
i -= size
i = encodeVarintApi(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
} }
i++
}
if len(m.ResponseTypeUrl) > 0 {
dAtA[i] = 0x22
i++
i = encodeVarintApi(dAtA, i, uint64(len(m.ResponseTypeUrl)))
i += copy(dAtA[i:], m.ResponseTypeUrl)
} }
if m.ResponseStreaming { if m.ResponseStreaming {
dAtA[i] = 0x28 i--
i++
if m.ResponseStreaming { if m.ResponseStreaming {
dAtA[i] = 1 dAtA[i] = 1
} else { } else {
dAtA[i] = 0 dAtA[i] = 0
} }
i++ i--
dAtA[i] = 0x28
} }
if len(m.Options) > 0 { if len(m.ResponseTypeUrl) > 0 {
for _, msg := range m.Options { i -= len(m.ResponseTypeUrl)
dAtA[i] = 0x32 copy(dAtA[i:], m.ResponseTypeUrl)
i++ i = encodeVarintApi(dAtA, i, uint64(len(m.ResponseTypeUrl)))
i = encodeVarintApi(dAtA, i, uint64(msg.Size())) i--
n, err := msg.MarshalTo(dAtA[i:]) dAtA[i] = 0x22
if err != nil { }
return 0, err if m.RequestStreaming {
} i--
i += n if m.RequestStreaming {
dAtA[i] = 1
} else {
dAtA[i] = 0
} }
i--
dAtA[i] = 0x18
} }
if m.Syntax != 0 { if len(m.RequestTypeUrl) > 0 {
dAtA[i] = 0x38 i -= len(m.RequestTypeUrl)
i++ copy(dAtA[i:], m.RequestTypeUrl)
i = encodeVarintApi(dAtA, i, uint64(m.Syntax)) i = encodeVarintApi(dAtA, i, uint64(len(m.RequestTypeUrl)))
i--
dAtA[i] = 0x12
} }
if m.XXX_unrecognized != nil { if len(m.Name) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintApi(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func (m *Mixin) Marshal() (dAtA []byte, err error) { func (m *Mixin) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1030,48 +1058,58 @@ func (m *Mixin) Marshal() (dAtA []byte, err error) {
} }
func (m *Mixin) MarshalTo(dAtA []byte) (int, error) { func (m *Mixin) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Mixin) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Name) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintApi(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
} }
if len(m.Root) > 0 { if len(m.Root) > 0 {
dAtA[i] = 0x12 i -= len(m.Root)
i++ copy(dAtA[i:], m.Root)
i = encodeVarintApi(dAtA, i, uint64(len(m.Root))) i = encodeVarintApi(dAtA, i, uint64(len(m.Root)))
i += copy(dAtA[i:], m.Root) i--
dAtA[i] = 0x12
} }
if m.XXX_unrecognized != nil { if len(m.Name) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintApi(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func encodeVarintApi(dAtA []byte, offset int, v uint64) int { func encodeVarintApi(dAtA []byte, offset int, v uint64) int {
offset -= sovApi(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func NewPopulatedApi(r randyApi, easy bool) *Api { func NewPopulatedApi(r randyApi, easy bool) *Api {
this := &Api{} this := &Api{}
this.Name = string(randStringApi(r)) this.Name = string(randStringApi(r))
if r.Intn(10) != 0 { if r.Intn(5) != 0 {
v1 := r.Intn(5) v1 := r.Intn(5)
this.Methods = make([]*Method, v1) this.Methods = make([]*Method, v1)
for i := 0; i < v1; i++ { for i := 0; i < v1; i++ {
this.Methods[i] = NewPopulatedMethod(r, easy) this.Methods[i] = NewPopulatedMethod(r, easy)
} }
} }
if r.Intn(10) != 0 { if r.Intn(5) != 0 {
v2 := r.Intn(5) v2 := r.Intn(5)
this.Options = make([]*Option, v2) this.Options = make([]*Option, v2)
for i := 0; i < v2; i++ { for i := 0; i < v2; i++ {
@ -1079,10 +1117,10 @@ func NewPopulatedApi(r randyApi, easy bool) *Api {
} }
} }
this.Version = string(randStringApi(r)) this.Version = string(randStringApi(r))
if r.Intn(10) != 0 { if r.Intn(5) != 0 {
this.SourceContext = NewPopulatedSourceContext(r, easy) this.SourceContext = NewPopulatedSourceContext(r, easy)
} }
if r.Intn(10) != 0 { if r.Intn(5) != 0 {
v3 := r.Intn(5) v3 := r.Intn(5)
this.Mixins = make([]*Mixin, v3) this.Mixins = make([]*Mixin, v3)
for i := 0; i < v3; i++ { for i := 0; i < v3; i++ {
@ -1103,7 +1141,7 @@ func NewPopulatedMethod(r randyApi, easy bool) *Method {
this.RequestStreaming = bool(bool(r.Intn(2) == 0)) this.RequestStreaming = bool(bool(r.Intn(2) == 0))
this.ResponseTypeUrl = string(randStringApi(r)) this.ResponseTypeUrl = string(randStringApi(r))
this.ResponseStreaming = bool(bool(r.Intn(2) == 0)) this.ResponseStreaming = bool(bool(r.Intn(2) == 0))
if r.Intn(10) != 0 { if r.Intn(5) != 0 {
v4 := r.Intn(5) v4 := r.Intn(5)
this.Options = make([]*Option, v4) this.Options = make([]*Option, v4)
for i := 0; i < v4; i++ { for i := 0; i < v4; i++ {
@ -1304,14 +1342,7 @@ func (m *Mixin) Size() (n int) {
} }
func sovApi(x uint64) (n int) { func sovApi(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozApi(x uint64) (n int) { func sozApi(x uint64) (n int) {
return sovApi(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovApi(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -1320,13 +1351,28 @@ func (this *Api) String() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
repeatedStringForMethods := "[]*Method{"
for _, f := range this.Methods {
repeatedStringForMethods += strings.Replace(f.String(), "Method", "Method", 1) + ","
}
repeatedStringForMethods += "}"
repeatedStringForOptions := "[]*Option{"
for _, f := range this.Options {
repeatedStringForOptions += strings.Replace(fmt.Sprintf("%v", f), "Option", "Option", 1) + ","
}
repeatedStringForOptions += "}"
repeatedStringForMixins := "[]*Mixin{"
for _, f := range this.Mixins {
repeatedStringForMixins += strings.Replace(f.String(), "Mixin", "Mixin", 1) + ","
}
repeatedStringForMixins += "}"
s := strings.Join([]string{`&Api{`, s := strings.Join([]string{`&Api{`,
`Name:` + fmt.Sprintf("%v", this.Name) + `,`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`,
`Methods:` + strings.Replace(fmt.Sprintf("%v", this.Methods), "Method", "Method", 1) + `,`, `Methods:` + repeatedStringForMethods + `,`,
`Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Option", "Option", 1) + `,`, `Options:` + repeatedStringForOptions + `,`,
`Version:` + fmt.Sprintf("%v", this.Version) + `,`, `Version:` + fmt.Sprintf("%v", this.Version) + `,`,
`SourceContext:` + strings.Replace(fmt.Sprintf("%v", this.SourceContext), "SourceContext", "SourceContext", 1) + `,`, `SourceContext:` + strings.Replace(fmt.Sprintf("%v", this.SourceContext), "SourceContext", "SourceContext", 1) + `,`,
`Mixins:` + strings.Replace(fmt.Sprintf("%v", this.Mixins), "Mixin", "Mixin", 1) + `,`, `Mixins:` + repeatedStringForMixins + `,`,
`Syntax:` + fmt.Sprintf("%v", this.Syntax) + `,`, `Syntax:` + fmt.Sprintf("%v", this.Syntax) + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`, `}`,
@ -1337,13 +1383,18 @@ func (this *Method) String() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
repeatedStringForOptions := "[]*Option{"
for _, f := range this.Options {
repeatedStringForOptions += strings.Replace(fmt.Sprintf("%v", f), "Option", "Option", 1) + ","
}
repeatedStringForOptions += "}"
s := strings.Join([]string{`&Method{`, s := strings.Join([]string{`&Method{`,
`Name:` + fmt.Sprintf("%v", this.Name) + `,`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`,
`RequestTypeUrl:` + fmt.Sprintf("%v", this.RequestTypeUrl) + `,`, `RequestTypeUrl:` + fmt.Sprintf("%v", this.RequestTypeUrl) + `,`,
`RequestStreaming:` + fmt.Sprintf("%v", this.RequestStreaming) + `,`, `RequestStreaming:` + fmt.Sprintf("%v", this.RequestStreaming) + `,`,
`ResponseTypeUrl:` + fmt.Sprintf("%v", this.ResponseTypeUrl) + `,`, `ResponseTypeUrl:` + fmt.Sprintf("%v", this.ResponseTypeUrl) + `,`,
`ResponseStreaming:` + fmt.Sprintf("%v", this.ResponseStreaming) + `,`, `ResponseStreaming:` + fmt.Sprintf("%v", this.ResponseStreaming) + `,`,
`Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Option", "Option", 1) + `,`, `Options:` + repeatedStringForOptions + `,`,
`Syntax:` + fmt.Sprintf("%v", this.Syntax) + `,`, `Syntax:` + fmt.Sprintf("%v", this.Syntax) + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`, `}`,
@ -2009,6 +2060,7 @@ func (m *Mixin) Unmarshal(dAtA []byte) error {
func skipApi(dAtA []byte) (n int, err error) { func skipApi(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -2040,10 +2092,8 @@ func skipApi(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -2064,55 +2114,30 @@ func skipApi(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthApi return 0, ErrInvalidLengthApi
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthApi
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowApi
}
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 := skipApi(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthApi
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupApi
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthApi
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthApi = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthApi = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowApi = fmt.Errorf("proto: integer overflow") ErrIntOverflowApi = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupApi = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -9,6 +9,7 @@ import (
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -22,7 +23,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// A Duration represents a signed, fixed-length span of time represented // A Duration represents a signed, fixed-length span of time represented
// as a count of seconds and fractions of seconds at nanosecond // as a count of seconds and fractions of seconds at nanosecond
@ -115,7 +116,7 @@ func (m *Duration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Duration.Marshal(b, m, deterministic) return xxx_messageInfo_Duration.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -272,7 +273,7 @@ func valueToGoStringDuration(v interface{}, typ string) string {
func (m *Duration) Marshal() (dAtA []byte, err error) { func (m *Duration) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -280,34 +281,42 @@ func (m *Duration) Marshal() (dAtA []byte, err error) {
} }
func (m *Duration) MarshalTo(dAtA []byte) (int, error) { func (m *Duration) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Duration) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Seconds != 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0x8 i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintDuration(dAtA, i, uint64(m.Seconds))
} }
if m.Nanos != 0 { if m.Nanos != 0 {
dAtA[i] = 0x10
i++
i = encodeVarintDuration(dAtA, i, uint64(m.Nanos)) i = encodeVarintDuration(dAtA, i, uint64(m.Nanos))
i--
dAtA[i] = 0x10
} }
if m.XXX_unrecognized != nil { if m.Seconds != 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i = encodeVarintDuration(dAtA, i, uint64(m.Seconds))
i--
dAtA[i] = 0x8
} }
return i, nil return len(dAtA) - i, nil
} }
func encodeVarintDuration(dAtA []byte, offset int, v uint64) int { func encodeVarintDuration(dAtA []byte, offset int, v uint64) int {
offset -= sovDuration(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *Duration) Size() (n int) { func (m *Duration) Size() (n int) {
if m == nil { if m == nil {
@ -328,14 +337,7 @@ func (m *Duration) Size() (n int) {
} }
func sovDuration(x uint64) (n int) { func sovDuration(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozDuration(x uint64) (n int) { func sozDuration(x uint64) (n int) {
return sovDuration(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovDuration(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -435,6 +437,7 @@ func (m *Duration) Unmarshal(dAtA []byte) error {
func skipDuration(dAtA []byte) (n int, err error) { func skipDuration(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -466,10 +469,8 @@ func skipDuration(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -490,55 +491,30 @@ func skipDuration(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthDuration return 0, ErrInvalidLengthDuration
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthDuration
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowDuration
}
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 := skipDuration(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthDuration
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupDuration
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthDuration
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthDuration = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthDuration = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowDuration = fmt.Errorf("proto: integer overflow") ErrIntOverflowDuration = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupDuration = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -9,6 +9,7 @@ import (
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -22,7 +23,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// A generic empty message that you can re-use to avoid defining duplicated // A generic empty message that you can re-use to avoid defining duplicated
// empty messages in your APIs. A typical example is to use it as the request // empty messages in your APIs. A typical example is to use it as the request
@ -53,7 +54,7 @@ func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Empty.Marshal(b, m, deterministic) return xxx_messageInfo_Empty.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -173,7 +174,7 @@ func valueToGoStringEmpty(v interface{}, typ string) string {
func (m *Empty) Marshal() (dAtA []byte, err error) { func (m *Empty) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -181,24 +182,32 @@ func (m *Empty) Marshal() (dAtA []byte, err error) {
} }
func (m *Empty) MarshalTo(dAtA []byte) (int, error) { func (m *Empty) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Empty) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil return len(dAtA) - i, nil
} }
func encodeVarintEmpty(dAtA []byte, offset int, v uint64) int { func encodeVarintEmpty(dAtA []byte, offset int, v uint64) int {
offset -= sovEmpty(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func NewPopulatedEmpty(r randyEmpty, easy bool) *Empty { func NewPopulatedEmpty(r randyEmpty, easy bool) *Empty {
this := &Empty{} this := &Empty{}
@ -293,14 +302,7 @@ func (m *Empty) Size() (n int) {
} }
func sovEmpty(x uint64) (n int) { func sovEmpty(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozEmpty(x uint64) (n int) { func sozEmpty(x uint64) (n int) {
return sovEmpty(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovEmpty(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -380,6 +382,7 @@ func (m *Empty) Unmarshal(dAtA []byte) error {
func skipEmpty(dAtA []byte) (n int, err error) { func skipEmpty(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -411,10 +414,8 @@ func skipEmpty(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -435,55 +436,30 @@ func skipEmpty(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthEmpty return 0, ErrInvalidLengthEmpty
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthEmpty
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEmpty
}
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 := skipEmpty(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthEmpty
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupEmpty
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthEmpty
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthEmpty = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthEmpty = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowEmpty = fmt.Errorf("proto: integer overflow") ErrIntOverflowEmpty = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupEmpty = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -9,6 +9,7 @@ import (
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -22,7 +23,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// `FieldMask` represents a set of symbolic field paths, for example: // `FieldMask` represents a set of symbolic field paths, for example:
// //
@ -244,7 +245,7 @@ func (m *FieldMask) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_FieldMask.Marshal(b, m, deterministic) return xxx_messageInfo_FieldMask.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -396,7 +397,7 @@ func valueToGoStringFieldMask(v interface{}, typ string) string {
func (m *FieldMask) Marshal() (dAtA []byte, err error) { func (m *FieldMask) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -404,39 +405,41 @@ func (m *FieldMask) Marshal() (dAtA []byte, err error) {
} }
func (m *FieldMask) MarshalTo(dAtA []byte) (int, error) { func (m *FieldMask) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *FieldMask) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.Paths) > 0 { if len(m.Paths) > 0 {
for _, s := range m.Paths { for iNdEx := len(m.Paths) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Paths[iNdEx])
copy(dAtA[i:], m.Paths[iNdEx])
i = encodeVarintFieldMask(dAtA, i, uint64(len(m.Paths[iNdEx])))
i--
dAtA[i] = 0xa dAtA[i] = 0xa
i++
l = len(s)
for l >= 1<<7 {
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
l >>= 7
i++
}
dAtA[i] = uint8(l)
i++
i += copy(dAtA[i:], s)
} }
} }
if m.XXX_unrecognized != nil { return len(dAtA) - i, nil
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
} }
func encodeVarintFieldMask(dAtA []byte, offset int, v uint64) int { func encodeVarintFieldMask(dAtA []byte, offset int, v uint64) int {
offset -= sovFieldMask(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func NewPopulatedFieldMask(r randyFieldMask, easy bool) *FieldMask { func NewPopulatedFieldMask(r randyFieldMask, easy bool) *FieldMask {
this := &FieldMask{} this := &FieldMask{}
@ -542,14 +545,7 @@ func (m *FieldMask) Size() (n int) {
} }
func sovFieldMask(x uint64) (n int) { func sovFieldMask(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozFieldMask(x uint64) (n int) { func sozFieldMask(x uint64) (n int) {
return sovFieldMask(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovFieldMask(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -662,6 +658,7 @@ func (m *FieldMask) Unmarshal(dAtA []byte) error {
func skipFieldMask(dAtA []byte) (n int, err error) { func skipFieldMask(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -693,10 +690,8 @@ func skipFieldMask(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -717,55 +712,30 @@ func skipFieldMask(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthFieldMask return 0, ErrInvalidLengthFieldMask
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthFieldMask
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowFieldMask
}
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 := skipFieldMask(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthFieldMask
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupFieldMask
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthFieldMask
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthFieldMask = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthFieldMask = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowFieldMask = fmt.Errorf("proto: integer overflow") ErrIntOverflowFieldMask = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupFieldMask = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -9,6 +9,7 @@ import (
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -22,7 +23,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// `SourceContext` represents information about the source of a // `SourceContext` represents information about the source of a
// protobuf element, like the file in which it is defined. // protobuf element, like the file in which it is defined.
@ -48,7 +49,7 @@ func (m *SourceContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error
return xxx_messageInfo_SourceContext.Marshal(b, m, deterministic) return xxx_messageInfo_SourceContext.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -190,7 +191,7 @@ func valueToGoStringSourceContext(v interface{}, typ string) string {
func (m *SourceContext) Marshal() (dAtA []byte, err error) { func (m *SourceContext) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -198,30 +199,39 @@ func (m *SourceContext) Marshal() (dAtA []byte, err error) {
} }
func (m *SourceContext) MarshalTo(dAtA []byte) (int, error) { func (m *SourceContext) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *SourceContext) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.FileName) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintSourceContext(dAtA, i, uint64(len(m.FileName)))
i += copy(dAtA[i:], m.FileName)
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if len(m.FileName) > 0 {
i -= len(m.FileName)
copy(dAtA[i:], m.FileName)
i = encodeVarintSourceContext(dAtA, i, uint64(len(m.FileName)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func encodeVarintSourceContext(dAtA []byte, offset int, v uint64) int { func encodeVarintSourceContext(dAtA []byte, offset int, v uint64) int {
offset -= sovSourceContext(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func NewPopulatedSourceContext(r randySourceContext, easy bool) *SourceContext { func NewPopulatedSourceContext(r randySourceContext, easy bool) *SourceContext {
this := &SourceContext{} this := &SourceContext{}
@ -321,14 +331,7 @@ func (m *SourceContext) Size() (n int) {
} }
func sovSourceContext(x uint64) (n int) { func sovSourceContext(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozSourceContext(x uint64) (n int) { func sozSourceContext(x uint64) (n int) {
return sovSourceContext(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovSourceContext(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -441,6 +444,7 @@ func (m *SourceContext) Unmarshal(dAtA []byte) error {
func skipSourceContext(dAtA []byte) (n int, err error) { func skipSourceContext(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -472,10 +476,8 @@ func skipSourceContext(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -496,55 +498,30 @@ func skipSourceContext(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthSourceContext return 0, ErrInvalidLengthSourceContext
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthSourceContext
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowSourceContext
}
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 := skipSourceContext(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthSourceContext
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupSourceContext
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthSourceContext
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthSourceContext = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthSourceContext = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowSourceContext = fmt.Errorf("proto: integer overflow") ErrIntOverflowSourceContext = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupSourceContext = fmt.Errorf("proto: unexpected end of group")
) )

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,7 @@ import (
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -22,7 +23,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// A Timestamp represents a point in time independent of any time zone or local // A Timestamp represents a point in time independent of any time zone or local
// calendar, encoded as a count of seconds and fractions of seconds at // calendar, encoded as a count of seconds and fractions of seconds at
@ -97,11 +98,13 @@ const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
// 01:30 UTC on January 15, 2017. // 01:30 UTC on January 15, 2017.
// //
// In JavaScript, one can convert a Date object to this format using the // In JavaScript, one can convert a Date object to this format using the
// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) // standard
// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
// method. In Python, a standard `datetime.datetime` object can be converted // method. In Python, a standard `datetime.datetime` object can be converted
// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) // to this format using
// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
// can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( // the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
// the Joda Time's [`ISODateTimeFormat.dateTime()`](
// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D // http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
// ) to obtain a formatter capable of generating timestamps in this format. // ) to obtain a formatter capable of generating timestamps in this format.
// //
@ -135,7 +138,7 @@ func (m *Timestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Timestamp.Marshal(b, m, deterministic) return xxx_messageInfo_Timestamp.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -292,7 +295,7 @@ func valueToGoStringTimestamp(v interface{}, typ string) string {
func (m *Timestamp) Marshal() (dAtA []byte, err error) { func (m *Timestamp) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -300,34 +303,42 @@ func (m *Timestamp) Marshal() (dAtA []byte, err error) {
} }
func (m *Timestamp) MarshalTo(dAtA []byte) (int, error) { func (m *Timestamp) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Timestamp) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Seconds != 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0x8 i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintTimestamp(dAtA, i, uint64(m.Seconds))
} }
if m.Nanos != 0 { if m.Nanos != 0 {
dAtA[i] = 0x10
i++
i = encodeVarintTimestamp(dAtA, i, uint64(m.Nanos)) i = encodeVarintTimestamp(dAtA, i, uint64(m.Nanos))
i--
dAtA[i] = 0x10
} }
if m.XXX_unrecognized != nil { if m.Seconds != 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i = encodeVarintTimestamp(dAtA, i, uint64(m.Seconds))
i--
dAtA[i] = 0x8
} }
return i, nil return len(dAtA) - i, nil
} }
func encodeVarintTimestamp(dAtA []byte, offset int, v uint64) int { func encodeVarintTimestamp(dAtA []byte, offset int, v uint64) int {
offset -= sovTimestamp(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func (m *Timestamp) Size() (n int) { func (m *Timestamp) Size() (n int) {
if m == nil { if m == nil {
@ -348,14 +359,7 @@ func (m *Timestamp) Size() (n int) {
} }
func sovTimestamp(x uint64) (n int) { func sovTimestamp(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozTimestamp(x uint64) (n int) { func sozTimestamp(x uint64) (n int) {
return sovTimestamp(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovTimestamp(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -455,6 +459,7 @@ func (m *Timestamp) Unmarshal(dAtA []byte) error {
func skipTimestamp(dAtA []byte) (n int, err error) { func skipTimestamp(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -486,10 +491,8 @@ func skipTimestamp(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -510,55 +513,30 @@ func skipTimestamp(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthTimestamp return 0, ErrInvalidLengthTimestamp
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthTimestamp
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTimestamp
}
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 := skipTimestamp(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthTimestamp
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupTimestamp
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthTimestamp
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthTimestamp = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthTimestamp = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowTimestamp = fmt.Errorf("proto: integer overflow") ErrIntOverflowTimestamp = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupTimestamp = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -9,6 +9,7 @@ import (
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strconv "strconv" strconv "strconv"
strings "strings" strings "strings"
@ -23,7 +24,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// The syntax in which a protocol buffer element is defined. // The syntax in which a protocol buffer element is defined.
type Syntax int32 type Syntax int32
@ -205,7 +206,7 @@ func (m *Type) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Type.Marshal(b, m, deterministic) return xxx_messageInfo_Type.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -312,7 +313,7 @@ func (m *Field) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Field.Marshal(b, m, deterministic) return xxx_messageInfo_Field.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -435,7 +436,7 @@ func (m *Enum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Enum.Marshal(b, m, deterministic) return xxx_messageInfo_Enum.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -519,7 +520,7 @@ func (m *EnumValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_EnumValue.Marshal(b, m, deterministic) return xxx_messageInfo_EnumValue.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -594,7 +595,7 @@ func (m *Option) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Option.Marshal(b, m, deterministic) return xxx_messageInfo_Option.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1404,7 +1405,7 @@ func valueToGoStringType(v interface{}, typ string) string {
func (m *Type) Marshal() (dAtA []byte, err error) { func (m *Type) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1412,80 +1413,87 @@ func (m *Type) Marshal() (dAtA []byte, err error) {
} }
func (m *Type) MarshalTo(dAtA []byte) (int, error) { func (m *Type) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Type) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Name) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintType(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
} }
if len(m.Fields) > 0 { if m.Syntax != 0 {
for _, msg := range m.Fields { i = encodeVarintType(dAtA, i, uint64(m.Syntax))
dAtA[i] = 0x12 i--
i++ dAtA[i] = 0x30
i = encodeVarintType(dAtA, i, uint64(msg.Size())) }
n, err := msg.MarshalTo(dAtA[i:]) if m.SourceContext != nil {
{
size, err := m.SourceContext.MarshalToSizedBuffer(dAtA[:i])
if err != nil { if err != nil {
return 0, err return 0, err
} }
i += n i -= size
i = encodeVarintType(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x2a
}
if len(m.Options) > 0 {
for iNdEx := len(m.Options) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Options[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintType(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
} }
} }
if len(m.Oneofs) > 0 { if len(m.Oneofs) > 0 {
for _, s := range m.Oneofs { for iNdEx := len(m.Oneofs) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Oneofs[iNdEx])
copy(dAtA[i:], m.Oneofs[iNdEx])
i = encodeVarintType(dAtA, i, uint64(len(m.Oneofs[iNdEx])))
i--
dAtA[i] = 0x1a dAtA[i] = 0x1a
i++ }
l = len(s) }
for l >= 1<<7 { if len(m.Fields) > 0 {
dAtA[i] = uint8(uint64(l)&0x7f | 0x80) for iNdEx := len(m.Fields) - 1; iNdEx >= 0; iNdEx-- {
l >>= 7 {
i++ size, err := m.Fields[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintType(dAtA, i, uint64(size))
} }
dAtA[i] = uint8(l) i--
i++ dAtA[i] = 0x12
i += copy(dAtA[i:], s)
} }
} }
if len(m.Options) > 0 { if len(m.Name) > 0 {
for _, msg := range m.Options { i -= len(m.Name)
dAtA[i] = 0x22 copy(dAtA[i:], m.Name)
i++ i = encodeVarintType(dAtA, i, uint64(len(m.Name)))
i = encodeVarintType(dAtA, i, uint64(msg.Size())) i--
n, err := msg.MarshalTo(dAtA[i:]) dAtA[i] = 0xa
if err != nil {
return 0, err
}
i += n
}
} }
if m.SourceContext != nil { return len(dAtA) - i, nil
dAtA[i] = 0x2a
i++
i = encodeVarintType(dAtA, i, uint64(m.SourceContext.Size()))
n1, err := m.SourceContext.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n1
}
if m.Syntax != 0 {
dAtA[i] = 0x30
i++
i = encodeVarintType(dAtA, i, uint64(m.Syntax))
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
} }
func (m *Field) Marshal() (dAtA []byte, err error) { func (m *Field) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1493,86 +1501,98 @@ func (m *Field) Marshal() (dAtA []byte, err error) {
} }
func (m *Field) MarshalTo(dAtA []byte) (int, error) { func (m *Field) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Field) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Kind != 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0x8 i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintType(dAtA, i, uint64(m.Kind))
} }
if m.Cardinality != 0 { if len(m.DefaultValue) > 0 {
dAtA[i] = 0x10 i -= len(m.DefaultValue)
i++ copy(dAtA[i:], m.DefaultValue)
i = encodeVarintType(dAtA, i, uint64(m.Cardinality)) i = encodeVarintType(dAtA, i, uint64(len(m.DefaultValue)))
i--
dAtA[i] = 0x5a
} }
if m.Number != 0 { if len(m.JsonName) > 0 {
dAtA[i] = 0x18 i -= len(m.JsonName)
i++ copy(dAtA[i:], m.JsonName)
i = encodeVarintType(dAtA, i, uint64(m.Number)) i = encodeVarintType(dAtA, i, uint64(len(m.JsonName)))
i--
dAtA[i] = 0x52
} }
if len(m.Name) > 0 { if len(m.Options) > 0 {
dAtA[i] = 0x22 for iNdEx := len(m.Options) - 1; iNdEx >= 0; iNdEx-- {
i++ {
i = encodeVarintType(dAtA, i, uint64(len(m.Name))) size, err := m.Options[iNdEx].MarshalToSizedBuffer(dAtA[:i])
i += copy(dAtA[i:], m.Name) if err != nil {
} return 0, err
if len(m.TypeUrl) > 0 { }
dAtA[i] = 0x32 i -= size
i++ i = encodeVarintType(dAtA, i, uint64(size))
i = encodeVarintType(dAtA, i, uint64(len(m.TypeUrl))) }
i += copy(dAtA[i:], m.TypeUrl) i--
} dAtA[i] = 0x4a
if m.OneofIndex != 0 { }
dAtA[i] = 0x38
i++
i = encodeVarintType(dAtA, i, uint64(m.OneofIndex))
} }
if m.Packed { if m.Packed {
dAtA[i] = 0x40 i--
i++
if m.Packed { if m.Packed {
dAtA[i] = 1 dAtA[i] = 1
} else { } else {
dAtA[i] = 0 dAtA[i] = 0
} }
i++ i--
dAtA[i] = 0x40
} }
if len(m.Options) > 0 { if m.OneofIndex != 0 {
for _, msg := range m.Options { i = encodeVarintType(dAtA, i, uint64(m.OneofIndex))
dAtA[i] = 0x4a i--
i++ dAtA[i] = 0x38
i = encodeVarintType(dAtA, i, uint64(msg.Size()))
n, err := msg.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n
}
} }
if len(m.JsonName) > 0 { if len(m.TypeUrl) > 0 {
dAtA[i] = 0x52 i -= len(m.TypeUrl)
i++ copy(dAtA[i:], m.TypeUrl)
i = encodeVarintType(dAtA, i, uint64(len(m.JsonName))) i = encodeVarintType(dAtA, i, uint64(len(m.TypeUrl)))
i += copy(dAtA[i:], m.JsonName) i--
dAtA[i] = 0x32
} }
if len(m.DefaultValue) > 0 { if len(m.Name) > 0 {
dAtA[i] = 0x5a i -= len(m.Name)
i++ copy(dAtA[i:], m.Name)
i = encodeVarintType(dAtA, i, uint64(len(m.DefaultValue))) i = encodeVarintType(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.DefaultValue) i--
dAtA[i] = 0x22
} }
if m.XXX_unrecognized != nil { if m.Number != 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i = encodeVarintType(dAtA, i, uint64(m.Number))
i--
dAtA[i] = 0x18
} }
return i, nil if m.Cardinality != 0 {
i = encodeVarintType(dAtA, i, uint64(m.Cardinality))
i--
dAtA[i] = 0x10
}
if m.Kind != 0 {
i = encodeVarintType(dAtA, i, uint64(m.Kind))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
} }
func (m *Enum) Marshal() (dAtA []byte, err error) { func (m *Enum) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1580,65 +1600,78 @@ func (m *Enum) Marshal() (dAtA []byte, err error) {
} }
func (m *Enum) MarshalTo(dAtA []byte) (int, error) { func (m *Enum) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Enum) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Name) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintType(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
}
if len(m.Enumvalue) > 0 {
for _, msg := range m.Enumvalue {
dAtA[i] = 0x12
i++
i = encodeVarintType(dAtA, i, uint64(msg.Size()))
n, err := msg.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n
}
}
if len(m.Options) > 0 {
for _, msg := range m.Options {
dAtA[i] = 0x1a
i++
i = encodeVarintType(dAtA, i, uint64(msg.Size()))
n, err := msg.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n
}
}
if m.SourceContext != nil {
dAtA[i] = 0x22
i++
i = encodeVarintType(dAtA, i, uint64(m.SourceContext.Size()))
n2, err := m.SourceContext.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n2
} }
if m.Syntax != 0 { if m.Syntax != 0 {
dAtA[i] = 0x28
i++
i = encodeVarintType(dAtA, i, uint64(m.Syntax)) i = encodeVarintType(dAtA, i, uint64(m.Syntax))
i--
dAtA[i] = 0x28
} }
if m.XXX_unrecognized != nil { if m.SourceContext != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) {
size, err := m.SourceContext.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintType(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
} }
return i, nil if len(m.Options) > 0 {
for iNdEx := len(m.Options) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Options[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintType(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
}
}
if len(m.Enumvalue) > 0 {
for iNdEx := len(m.Enumvalue) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Enumvalue[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintType(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
if len(m.Name) > 0 {
i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintType(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *EnumValue) Marshal() (dAtA []byte, err error) { func (m *EnumValue) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1646,43 +1679,52 @@ func (m *EnumValue) Marshal() (dAtA []byte, err error) {
} }
func (m *EnumValue) MarshalTo(dAtA []byte) (int, error) { func (m *EnumValue) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *EnumValue) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Name) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintType(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
}
if m.Number != 0 {
dAtA[i] = 0x10
i++
i = encodeVarintType(dAtA, i, uint64(m.Number))
} }
if len(m.Options) > 0 { if len(m.Options) > 0 {
for _, msg := range m.Options { for iNdEx := len(m.Options) - 1; iNdEx >= 0; iNdEx-- {
dAtA[i] = 0x1a {
i++ size, err := m.Options[iNdEx].MarshalToSizedBuffer(dAtA[:i])
i = encodeVarintType(dAtA, i, uint64(msg.Size())) if err != nil {
n, err := msg.MarshalTo(dAtA[i:]) return 0, err
if err != nil { }
return 0, err i -= size
i = encodeVarintType(dAtA, i, uint64(size))
} }
i += n i--
dAtA[i] = 0x1a
} }
} }
if m.XXX_unrecognized != nil { if m.Number != 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i = encodeVarintType(dAtA, i, uint64(m.Number))
i--
dAtA[i] = 0x10
} }
return i, nil if len(m.Name) > 0 {
i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintType(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *Option) Marshal() (dAtA []byte, err error) { func (m *Option) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1690,45 +1732,56 @@ func (m *Option) Marshal() (dAtA []byte, err error) {
} }
func (m *Option) MarshalTo(dAtA []byte) (int, error) { func (m *Option) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Option) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Name) > 0 { if m.XXX_unrecognized != nil {
dAtA[i] = 0xa i -= len(m.XXX_unrecognized)
i++ copy(dAtA[i:], m.XXX_unrecognized)
i = encodeVarintType(dAtA, i, uint64(len(m.Name)))
i += copy(dAtA[i:], m.Name)
} }
if m.Value != nil { if m.Value != nil {
dAtA[i] = 0x12 {
i++ size, err := m.Value.MarshalToSizedBuffer(dAtA[:i])
i = encodeVarintType(dAtA, i, uint64(m.Value.Size())) if err != nil {
n3, err := m.Value.MarshalTo(dAtA[i:]) return 0, err
if err != nil { }
return 0, err i -= size
i = encodeVarintType(dAtA, i, uint64(size))
} }
i += n3 i--
dAtA[i] = 0x12
} }
if m.XXX_unrecognized != nil { if len(m.Name) > 0 {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintType(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
} }
return i, nil return len(dAtA) - i, nil
} }
func encodeVarintType(dAtA []byte, offset int, v uint64) int { func encodeVarintType(dAtA []byte, offset int, v uint64) int {
offset -= sovType(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func NewPopulatedType(r randyType, easy bool) *Type { func NewPopulatedType(r randyType, easy bool) *Type {
this := &Type{} this := &Type{}
this.Name = string(randStringType(r)) this.Name = string(randStringType(r))
if r.Intn(10) != 0 { if r.Intn(5) != 0 {
v1 := r.Intn(5) v1 := r.Intn(5)
this.Fields = make([]*Field, v1) this.Fields = make([]*Field, v1)
for i := 0; i < v1; i++ { for i := 0; i < v1; i++ {
@ -1740,14 +1793,14 @@ func NewPopulatedType(r randyType, easy bool) *Type {
for i := 0; i < v2; i++ { for i := 0; i < v2; i++ {
this.Oneofs[i] = string(randStringType(r)) this.Oneofs[i] = string(randStringType(r))
} }
if r.Intn(10) != 0 { if r.Intn(5) != 0 {
v3 := r.Intn(5) v3 := r.Intn(5)
this.Options = make([]*Option, v3) this.Options = make([]*Option, v3)
for i := 0; i < v3; i++ { for i := 0; i < v3; i++ {
this.Options[i] = NewPopulatedOption(r, easy) this.Options[i] = NewPopulatedOption(r, easy)
} }
} }
if r.Intn(10) != 0 { if r.Intn(5) != 0 {
this.SourceContext = NewPopulatedSourceContext(r, easy) this.SourceContext = NewPopulatedSourceContext(r, easy)
} }
this.Syntax = Syntax([]int32{0, 1}[r.Intn(2)]) this.Syntax = Syntax([]int32{0, 1}[r.Intn(2)])
@ -1772,7 +1825,7 @@ func NewPopulatedField(r randyType, easy bool) *Field {
this.OneofIndex *= -1 this.OneofIndex *= -1
} }
this.Packed = bool(bool(r.Intn(2) == 0)) this.Packed = bool(bool(r.Intn(2) == 0))
if r.Intn(10) != 0 { if r.Intn(5) != 0 {
v4 := r.Intn(5) v4 := r.Intn(5)
this.Options = make([]*Option, v4) this.Options = make([]*Option, v4)
for i := 0; i < v4; i++ { for i := 0; i < v4; i++ {
@ -1790,21 +1843,21 @@ func NewPopulatedField(r randyType, easy bool) *Field {
func NewPopulatedEnum(r randyType, easy bool) *Enum { func NewPopulatedEnum(r randyType, easy bool) *Enum {
this := &Enum{} this := &Enum{}
this.Name = string(randStringType(r)) this.Name = string(randStringType(r))
if r.Intn(10) != 0 { if r.Intn(5) != 0 {
v5 := r.Intn(5) v5 := r.Intn(5)
this.Enumvalue = make([]*EnumValue, v5) this.Enumvalue = make([]*EnumValue, v5)
for i := 0; i < v5; i++ { for i := 0; i < v5; i++ {
this.Enumvalue[i] = NewPopulatedEnumValue(r, easy) this.Enumvalue[i] = NewPopulatedEnumValue(r, easy)
} }
} }
if r.Intn(10) != 0 { if r.Intn(5) != 0 {
v6 := r.Intn(5) v6 := r.Intn(5)
this.Options = make([]*Option, v6) this.Options = make([]*Option, v6)
for i := 0; i < v6; i++ { for i := 0; i < v6; i++ {
this.Options[i] = NewPopulatedOption(r, easy) this.Options[i] = NewPopulatedOption(r, easy)
} }
} }
if r.Intn(10) != 0 { if r.Intn(5) != 0 {
this.SourceContext = NewPopulatedSourceContext(r, easy) this.SourceContext = NewPopulatedSourceContext(r, easy)
} }
this.Syntax = Syntax([]int32{0, 1}[r.Intn(2)]) this.Syntax = Syntax([]int32{0, 1}[r.Intn(2)])
@ -1821,7 +1874,7 @@ func NewPopulatedEnumValue(r randyType, easy bool) *EnumValue {
if r.Intn(2) == 0 { if r.Intn(2) == 0 {
this.Number *= -1 this.Number *= -1
} }
if r.Intn(10) != 0 { if r.Intn(5) != 0 {
v7 := r.Intn(5) v7 := r.Intn(5)
this.Options = make([]*Option, v7) this.Options = make([]*Option, v7)
for i := 0; i < v7; i++ { for i := 0; i < v7; i++ {
@ -1837,7 +1890,7 @@ func NewPopulatedEnumValue(r randyType, easy bool) *EnumValue {
func NewPopulatedOption(r randyType, easy bool) *Option { func NewPopulatedOption(r randyType, easy bool) *Option {
this := &Option{} this := &Option{}
this.Name = string(randStringType(r)) this.Name = string(randStringType(r))
if r.Intn(10) != 0 { if r.Intn(5) != 0 {
this.Value = NewPopulatedAny(r, easy) this.Value = NewPopulatedAny(r, easy)
} }
if !easy && r.Intn(10) != 0 { if !easy && r.Intn(10) != 0 {
@ -2089,14 +2142,7 @@ func (m *Option) Size() (n int) {
} }
func sovType(x uint64) (n int) { func sovType(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozType(x uint64) (n int) { func sozType(x uint64) (n int) {
return sovType(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovType(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -2105,11 +2151,21 @@ func (this *Type) String() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
repeatedStringForFields := "[]*Field{"
for _, f := range this.Fields {
repeatedStringForFields += strings.Replace(f.String(), "Field", "Field", 1) + ","
}
repeatedStringForFields += "}"
repeatedStringForOptions := "[]*Option{"
for _, f := range this.Options {
repeatedStringForOptions += strings.Replace(f.String(), "Option", "Option", 1) + ","
}
repeatedStringForOptions += "}"
s := strings.Join([]string{`&Type{`, s := strings.Join([]string{`&Type{`,
`Name:` + fmt.Sprintf("%v", this.Name) + `,`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`,
`Fields:` + strings.Replace(fmt.Sprintf("%v", this.Fields), "Field", "Field", 1) + `,`, `Fields:` + repeatedStringForFields + `,`,
`Oneofs:` + fmt.Sprintf("%v", this.Oneofs) + `,`, `Oneofs:` + fmt.Sprintf("%v", this.Oneofs) + `,`,
`Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Option", "Option", 1) + `,`, `Options:` + repeatedStringForOptions + `,`,
`SourceContext:` + strings.Replace(fmt.Sprintf("%v", this.SourceContext), "SourceContext", "SourceContext", 1) + `,`, `SourceContext:` + strings.Replace(fmt.Sprintf("%v", this.SourceContext), "SourceContext", "SourceContext", 1) + `,`,
`Syntax:` + fmt.Sprintf("%v", this.Syntax) + `,`, `Syntax:` + fmt.Sprintf("%v", this.Syntax) + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
@ -2121,6 +2177,11 @@ func (this *Field) String() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
repeatedStringForOptions := "[]*Option{"
for _, f := range this.Options {
repeatedStringForOptions += strings.Replace(f.String(), "Option", "Option", 1) + ","
}
repeatedStringForOptions += "}"
s := strings.Join([]string{`&Field{`, s := strings.Join([]string{`&Field{`,
`Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`,
`Cardinality:` + fmt.Sprintf("%v", this.Cardinality) + `,`, `Cardinality:` + fmt.Sprintf("%v", this.Cardinality) + `,`,
@ -2129,7 +2190,7 @@ func (this *Field) String() string {
`TypeUrl:` + fmt.Sprintf("%v", this.TypeUrl) + `,`, `TypeUrl:` + fmt.Sprintf("%v", this.TypeUrl) + `,`,
`OneofIndex:` + fmt.Sprintf("%v", this.OneofIndex) + `,`, `OneofIndex:` + fmt.Sprintf("%v", this.OneofIndex) + `,`,
`Packed:` + fmt.Sprintf("%v", this.Packed) + `,`, `Packed:` + fmt.Sprintf("%v", this.Packed) + `,`,
`Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Option", "Option", 1) + `,`, `Options:` + repeatedStringForOptions + `,`,
`JsonName:` + fmt.Sprintf("%v", this.JsonName) + `,`, `JsonName:` + fmt.Sprintf("%v", this.JsonName) + `,`,
`DefaultValue:` + fmt.Sprintf("%v", this.DefaultValue) + `,`, `DefaultValue:` + fmt.Sprintf("%v", this.DefaultValue) + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
@ -2141,10 +2202,20 @@ func (this *Enum) String() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
repeatedStringForEnumvalue := "[]*EnumValue{"
for _, f := range this.Enumvalue {
repeatedStringForEnumvalue += strings.Replace(f.String(), "EnumValue", "EnumValue", 1) + ","
}
repeatedStringForEnumvalue += "}"
repeatedStringForOptions := "[]*Option{"
for _, f := range this.Options {
repeatedStringForOptions += strings.Replace(f.String(), "Option", "Option", 1) + ","
}
repeatedStringForOptions += "}"
s := strings.Join([]string{`&Enum{`, s := strings.Join([]string{`&Enum{`,
`Name:` + fmt.Sprintf("%v", this.Name) + `,`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`,
`Enumvalue:` + strings.Replace(fmt.Sprintf("%v", this.Enumvalue), "EnumValue", "EnumValue", 1) + `,`, `Enumvalue:` + repeatedStringForEnumvalue + `,`,
`Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Option", "Option", 1) + `,`, `Options:` + repeatedStringForOptions + `,`,
`SourceContext:` + strings.Replace(fmt.Sprintf("%v", this.SourceContext), "SourceContext", "SourceContext", 1) + `,`, `SourceContext:` + strings.Replace(fmt.Sprintf("%v", this.SourceContext), "SourceContext", "SourceContext", 1) + `,`,
`Syntax:` + fmt.Sprintf("%v", this.Syntax) + `,`, `Syntax:` + fmt.Sprintf("%v", this.Syntax) + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
@ -2156,10 +2227,15 @@ func (this *EnumValue) String() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
repeatedStringForOptions := "[]*Option{"
for _, f := range this.Options {
repeatedStringForOptions += strings.Replace(f.String(), "Option", "Option", 1) + ","
}
repeatedStringForOptions += "}"
s := strings.Join([]string{`&EnumValue{`, s := strings.Join([]string{`&EnumValue{`,
`Name:` + fmt.Sprintf("%v", this.Name) + `,`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`,
`Number:` + fmt.Sprintf("%v", this.Number) + `,`, `Number:` + fmt.Sprintf("%v", this.Number) + `,`,
`Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Option", "Option", 1) + `,`, `Options:` + repeatedStringForOptions + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`, `}`,
}, "") }, "")
@ -3211,6 +3287,7 @@ func (m *Option) Unmarshal(dAtA []byte) error {
func skipType(dAtA []byte) (n int, err error) { func skipType(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -3242,10 +3319,8 @@ func skipType(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -3266,55 +3341,30 @@ func skipType(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthType return 0, ErrInvalidLengthType
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthType
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowType
}
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 := skipType(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthType
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupType
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthType
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthType = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthType = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowType = fmt.Errorf("proto: integer overflow") ErrIntOverflowType = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupType = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -10,6 +10,7 @@ import (
proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto"
io "io" io "io"
math "math" math "math"
math_bits "math/bits"
reflect "reflect" reflect "reflect"
strings "strings" strings "strings"
) )
@ -23,7 +24,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// Wrapper message for `double`. // Wrapper message for `double`.
// //
@ -50,7 +51,7 @@ func (m *DoubleValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return xxx_messageInfo_DoubleValue.Marshal(b, m, deterministic) return xxx_messageInfo_DoubleValue.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -105,7 +106,7 @@ func (m *FloatValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_FloatValue.Marshal(b, m, deterministic) return xxx_messageInfo_FloatValue.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -160,7 +161,7 @@ func (m *Int64Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Int64Value.Marshal(b, m, deterministic) return xxx_messageInfo_Int64Value.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -215,7 +216,7 @@ func (m *UInt64Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return xxx_messageInfo_UInt64Value.Marshal(b, m, deterministic) return xxx_messageInfo_UInt64Value.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -270,7 +271,7 @@ func (m *Int32Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Int32Value.Marshal(b, m, deterministic) return xxx_messageInfo_Int32Value.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -325,7 +326,7 @@ func (m *UInt32Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return xxx_messageInfo_UInt32Value.Marshal(b, m, deterministic) return xxx_messageInfo_UInt32Value.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -380,7 +381,7 @@ func (m *BoolValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_BoolValue.Marshal(b, m, deterministic) return xxx_messageInfo_BoolValue.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -435,7 +436,7 @@ func (m *StringValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return xxx_messageInfo_StringValue.Marshal(b, m, deterministic) return xxx_messageInfo_StringValue.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -490,7 +491,7 @@ func (m *BytesValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_BytesValue.Marshal(b, m, deterministic) return xxx_messageInfo_BytesValue.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalTo(b) n, err := m.MarshalToSizedBuffer(b)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1247,7 +1248,7 @@ func valueToGoStringWrappers(v interface{}, typ string) string {
func (m *DoubleValue) Marshal() (dAtA []byte, err error) { func (m *DoubleValue) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1255,26 +1256,32 @@ func (m *DoubleValue) Marshal() (dAtA []byte, err error) {
} }
func (m *DoubleValue) MarshalTo(dAtA []byte) (int, error) { func (m *DoubleValue) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *DoubleValue) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Value != 0 {
dAtA[i] = 0x9
i++
encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value))))
i += 8
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if m.Value != 0 {
i -= 8
encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value))))
i--
dAtA[i] = 0x9
}
return len(dAtA) - i, nil
} }
func (m *FloatValue) Marshal() (dAtA []byte, err error) { func (m *FloatValue) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1282,26 +1289,32 @@ func (m *FloatValue) Marshal() (dAtA []byte, err error) {
} }
func (m *FloatValue) MarshalTo(dAtA []byte) (int, error) { func (m *FloatValue) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *FloatValue) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Value != 0 {
dAtA[i] = 0xd
i++
encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.Value))))
i += 4
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if m.Value != 0 {
i -= 4
encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.Value))))
i--
dAtA[i] = 0xd
}
return len(dAtA) - i, nil
} }
func (m *Int64Value) Marshal() (dAtA []byte, err error) { func (m *Int64Value) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1309,25 +1322,31 @@ func (m *Int64Value) Marshal() (dAtA []byte, err error) {
} }
func (m *Int64Value) MarshalTo(dAtA []byte) (int, error) { func (m *Int64Value) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Int64Value) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Value != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintWrappers(dAtA, i, uint64(m.Value))
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if m.Value != 0 {
i = encodeVarintWrappers(dAtA, i, uint64(m.Value))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
} }
func (m *UInt64Value) Marshal() (dAtA []byte, err error) { func (m *UInt64Value) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1335,25 +1354,31 @@ func (m *UInt64Value) Marshal() (dAtA []byte, err error) {
} }
func (m *UInt64Value) MarshalTo(dAtA []byte) (int, error) { func (m *UInt64Value) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *UInt64Value) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Value != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintWrappers(dAtA, i, uint64(m.Value))
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if m.Value != 0 {
i = encodeVarintWrappers(dAtA, i, uint64(m.Value))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
} }
func (m *Int32Value) Marshal() (dAtA []byte, err error) { func (m *Int32Value) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1361,25 +1386,31 @@ func (m *Int32Value) Marshal() (dAtA []byte, err error) {
} }
func (m *Int32Value) MarshalTo(dAtA []byte) (int, error) { func (m *Int32Value) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Int32Value) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Value != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintWrappers(dAtA, i, uint64(m.Value))
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if m.Value != 0 {
i = encodeVarintWrappers(dAtA, i, uint64(m.Value))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
} }
func (m *UInt32Value) Marshal() (dAtA []byte, err error) { func (m *UInt32Value) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1387,25 +1418,31 @@ func (m *UInt32Value) Marshal() (dAtA []byte, err error) {
} }
func (m *UInt32Value) MarshalTo(dAtA []byte) (int, error) { func (m *UInt32Value) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *UInt32Value) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Value != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintWrappers(dAtA, i, uint64(m.Value))
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if m.Value != 0 {
i = encodeVarintWrappers(dAtA, i, uint64(m.Value))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
} }
func (m *BoolValue) Marshal() (dAtA []byte, err error) { func (m *BoolValue) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1413,30 +1450,36 @@ func (m *BoolValue) Marshal() (dAtA []byte, err error) {
} }
func (m *BoolValue) MarshalTo(dAtA []byte) (int, error) { func (m *BoolValue) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *BoolValue) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if m.Value { if m.Value {
dAtA[i] = 0x8 i--
i++
if m.Value { if m.Value {
dAtA[i] = 1 dAtA[i] = 1
} else { } else {
dAtA[i] = 0 dAtA[i] = 0
} }
i++ i--
dAtA[i] = 0x8
} }
if m.XXX_unrecognized != nil { return len(dAtA) - i, nil
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
} }
func (m *StringValue) Marshal() (dAtA []byte, err error) { func (m *StringValue) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1444,26 +1487,33 @@ func (m *StringValue) Marshal() (dAtA []byte, err error) {
} }
func (m *StringValue) MarshalTo(dAtA []byte) (int, error) { func (m *StringValue) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *StringValue) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Value) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintWrappers(dAtA, i, uint64(len(m.Value)))
i += copy(dAtA[i:], m.Value)
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if len(m.Value) > 0 {
i -= len(m.Value)
copy(dAtA[i:], m.Value)
i = encodeVarintWrappers(dAtA, i, uint64(len(m.Value)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func (m *BytesValue) Marshal() (dAtA []byte, err error) { func (m *BytesValue) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA) n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1471,30 +1521,39 @@ func (m *BytesValue) Marshal() (dAtA []byte, err error) {
} }
func (m *BytesValue) MarshalTo(dAtA []byte) (int, error) { func (m *BytesValue) MarshalTo(dAtA []byte) (int, error) {
var i int size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *BytesValue) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Value) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintWrappers(dAtA, i, uint64(len(m.Value)))
i += copy(dAtA[i:], m.Value)
}
if m.XXX_unrecognized != nil { if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized) i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
} }
return i, nil if len(m.Value) > 0 {
i -= len(m.Value)
copy(dAtA[i:], m.Value)
i = encodeVarintWrappers(dAtA, i, uint64(len(m.Value)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
} }
func encodeVarintWrappers(dAtA []byte, offset int, v uint64) int { func encodeVarintWrappers(dAtA []byte, offset int, v uint64) int {
offset -= sovWrappers(v)
base := offset
for v >= 1<<7 { for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80) dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7 v >>= 7
offset++ offset++
} }
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return offset + 1 return base
} }
func NewPopulatedDoubleValue(r randyWrappers, easy bool) *DoubleValue { func NewPopulatedDoubleValue(r randyWrappers, easy bool) *DoubleValue {
this := &DoubleValue{} this := &DoubleValue{}
@ -1803,14 +1862,7 @@ func (m *BytesValue) Size() (n int) {
} }
func sovWrappers(x uint64) (n int) { func sovWrappers(x uint64) (n int) {
for { return (math_bits.Len64(x|1) + 6) / 7
n++
x >>= 7
if x == 0 {
break
}
}
return n
} }
func sozWrappers(x uint64) (n int) { func sozWrappers(x uint64) (n int) {
return sovWrappers(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovWrappers(uint64((x << 1) ^ uint64((int64(x) >> 63))))
@ -2595,6 +2647,7 @@ func (m *BytesValue) Unmarshal(dAtA []byte) error {
func skipWrappers(dAtA []byte) (n int, err error) { func skipWrappers(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
depth := 0
for iNdEx < l { for iNdEx < l {
var wire uint64 var wire uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -2626,10 +2679,8 @@ func skipWrappers(dAtA []byte) (n int, err error) {
break break
} }
} }
return iNdEx, nil
case 1: case 1:
iNdEx += 8 iNdEx += 8
return iNdEx, nil
case 2: case 2:
var length int var length int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -2650,55 +2701,30 @@ func skipWrappers(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthWrappers return 0, ErrInvalidLengthWrappers
} }
iNdEx += length iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthWrappers
}
return iNdEx, nil
case 3: case 3:
for { depth++
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowWrappers
}
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 := skipWrappers(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthWrappers
}
}
return iNdEx, nil
case 4: case 4:
return iNdEx, nil if depth == 0 {
return 0, ErrUnexpectedEndOfGroupWrappers
}
depth--
case 5: case 5:
iNdEx += 4 iNdEx += 4
return iNdEx, nil
default: default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
} }
if iNdEx < 0 {
return 0, ErrInvalidLengthWrappers
}
if depth == 0 {
return iNdEx, nil
}
} }
panic("unreachable") return 0, io.ErrUnexpectedEOF
} }
var ( var (
ErrInvalidLengthWrappers = fmt.Errorf("proto: negative length found during unmarshaling") ErrInvalidLengthWrappers = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowWrappers = fmt.Errorf("proto: integer overflow") ErrIntOverflowWrappers = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupWrappers = fmt.Errorf("proto: unexpected end of group")
) )

View File

@ -7,7 +7,7 @@ Google's data interchange format.
Copyright 2010 The Go Authors. Copyright 2010 The Go Authors.
https://github.com/golang/protobuf https://github.com/golang/protobuf
This package and the code it generates requires at least Go 1.6. This package and the code it generates requires at least Go 1.9.
This software implements Go bindings for protocol buffers. For This software implements Go bindings for protocol buffers. For
information about protocol buffers themselves, see information about protocol buffers themselves, see
@ -24,11 +24,22 @@ To use this software, you must:
https://golang.org/doc/install https://golang.org/doc/install
for details or, if you are using gccgo, follow the instructions at for details or, if you are using gccgo, follow the instructions at
https://golang.org/doc/install/gccgo https://golang.org/doc/install/gccgo
- Grab the code from the repository and install the proto package. - Grab the code from the repository and install the `proto` package.
The simplest way is to run `go get -u github.com/golang/protobuf/protoc-gen-go`. The simplest way is to run:
The compiler plugin, protoc-gen-go, will be installed in $GOBIN, ```
defaulting to $GOPATH/bin. It must be in your $PATH for the protocol go get -u github.com/golang/protobuf/protoc-gen-go
compiler, protoc, to find it. ```
The compiler plugin, `protoc-gen-go`, will be installed in `$GOPATH/bin`
unless `$GOBIN` is set. It must be in your `$PATH` for the protocol
compiler, `protoc`, to find it.
- If you need a particular version of `protoc-gen-go` (e.g., to match your
`proto` package version), one option is
```shell
GIT_TAG="v1.2.0" # change as needed
go get -d -u github.com/golang/protobuf/protoc-gen-go
git -C "$(go env GOPATH)"/src/github.com/golang/protobuf checkout $GIT_TAG
go install github.com/golang/protobuf/protoc-gen-go
```
This software has two parts: a 'protocol compiler plugin' that This software has two parts: a 'protocol compiler plugin' that
generates Go source files that, once compiled, can access and manage generates Go source files that, once compiled, can access and manage

3
vendor/github.com/golang/protobuf/go.mod generated vendored Normal file
View File

@ -0,0 +1,3 @@
module github.com/golang/protobuf
go 1.12

View File

@ -186,7 +186,6 @@ func (p *Buffer) DecodeVarint() (x uint64, err error) {
if b&0x80 == 0 { if b&0x80 == 0 {
goto done goto done
} }
// x -= 0x80 << 63 // Always zero.
return 0, errOverflow return 0, errOverflow

63
vendor/github.com/golang/protobuf/proto/deprecated.go generated vendored Normal file
View File

@ -0,0 +1,63 @@
// Go support for Protocol Buffers - Google's data interchange format
//
// Copyright 2018 The Go Authors. All rights reserved.
// https://github.com/golang/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package proto
import "errors"
// Deprecated: do not use.
type Stats struct{ Emalloc, Dmalloc, Encode, Decode, Chit, Cmiss, Size uint64 }
// Deprecated: do not use.
func GetStats() Stats { return Stats{} }
// Deprecated: do not use.
func MarshalMessageSet(interface{}) ([]byte, error) {
return nil, errors.New("proto: not implemented")
}
// Deprecated: do not use.
func UnmarshalMessageSet([]byte, interface{}) error {
return errors.New("proto: not implemented")
}
// Deprecated: do not use.
func MarshalMessageSetJSON(interface{}) ([]byte, error) {
return nil, errors.New("proto: not implemented")
}
// Deprecated: do not use.
func UnmarshalMessageSetJSON([]byte, interface{}) error {
return errors.New("proto: not implemented")
}
// Deprecated: do not use.
func RegisterMessageSetType(Message, int32, string) {}

View File

@ -246,7 +246,8 @@ func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool {
return false return false
} }
m1, m2 := e1.value, e2.value m1 := extensionAsLegacyType(e1.value)
m2 := extensionAsLegacyType(e2.value)
if m1 == nil && m2 == nil { if m1 == nil && m2 == nil {
// Both have only encoded form. // Both have only encoded form.

View File

@ -185,9 +185,25 @@ type Extension struct {
// extension will have only enc set. When such an extension is // extension will have only enc set. When such an extension is
// accessed using GetExtension (or GetExtensions) desc and value // accessed using GetExtension (or GetExtensions) desc and value
// will be set. // will be set.
desc *ExtensionDesc desc *ExtensionDesc
// value is a concrete value for the extension field. Let the type of
// desc.ExtensionType be the "API type" and the type of Extension.value
// be the "storage type". The API type and storage type are the same except:
// * For scalars (except []byte), the API type uses *T,
// while the storage type uses T.
// * For repeated fields, the API type uses []T, while the storage type
// uses *[]T.
//
// The reason for the divergence is so that the storage type more naturally
// matches what is expected of when retrieving the values through the
// protobuf reflection APIs.
//
// The value may only be populated if desc is also populated.
value interface{} value interface{}
enc []byte
// enc is the raw bytes for the extension field.
enc []byte
} }
// SetRawExtension is for testing only. // SetRawExtension is for testing only.
@ -334,7 +350,7 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) {
// descriptors with the same field number. // descriptors with the same field number.
return nil, errors.New("proto: descriptor conflict") return nil, errors.New("proto: descriptor conflict")
} }
return e.value, nil return extensionAsLegacyType(e.value), nil
} }
if extension.ExtensionType == nil { if extension.ExtensionType == nil {
@ -349,11 +365,11 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) {
// Remember the decoded version and drop the encoded version. // Remember the decoded version and drop the encoded version.
// That way it is safe to mutate what we return. // That way it is safe to mutate what we return.
e.value = v e.value = extensionAsStorageType(v)
e.desc = extension e.desc = extension
e.enc = nil e.enc = nil
emap[extension.Field] = e emap[extension.Field] = e
return e.value, nil return extensionAsLegacyType(e.value), nil
} }
// defaultExtensionValue returns the default value for extension. // defaultExtensionValue returns the default value for extension.
@ -488,7 +504,7 @@ func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error
} }
typ := reflect.TypeOf(extension.ExtensionType) typ := reflect.TypeOf(extension.ExtensionType)
if typ != reflect.TypeOf(value) { if typ != reflect.TypeOf(value) {
return errors.New("proto: bad extension value type") return fmt.Errorf("proto: bad extension value type. got: %T, want: %T", value, extension.ExtensionType)
} }
// nil extension values need to be caught early, because the // nil extension values need to be caught early, because the
// encoder can't distinguish an ErrNil due to a nil extension // encoder can't distinguish an ErrNil due to a nil extension
@ -500,7 +516,7 @@ func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error
} }
extmap := epb.extensionsWrite() extmap := epb.extensionsWrite()
extmap[extension.Field] = Extension{desc: extension, value: value} extmap[extension.Field] = Extension{desc: extension, value: extensionAsStorageType(value)}
return nil return nil
} }
@ -541,3 +557,51 @@ func RegisterExtension(desc *ExtensionDesc) {
func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc {
return extensionMaps[reflect.TypeOf(pb).Elem()] return extensionMaps[reflect.TypeOf(pb).Elem()]
} }
// extensionAsLegacyType converts an value in the storage type as the API type.
// See Extension.value.
func extensionAsLegacyType(v interface{}) interface{} {
switch rv := reflect.ValueOf(v); rv.Kind() {
case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String:
// Represent primitive types as a pointer to the value.
rv2 := reflect.New(rv.Type())
rv2.Elem().Set(rv)
v = rv2.Interface()
case reflect.Ptr:
// Represent slice types as the value itself.
switch rv.Type().Elem().Kind() {
case reflect.Slice:
if rv.IsNil() {
v = reflect.Zero(rv.Type().Elem()).Interface()
} else {
v = rv.Elem().Interface()
}
}
}
return v
}
// extensionAsStorageType converts an value in the API type as the storage type.
// See Extension.value.
func extensionAsStorageType(v interface{}) interface{} {
switch rv := reflect.ValueOf(v); rv.Kind() {
case reflect.Ptr:
// Represent slice types as the value itself.
switch rv.Type().Elem().Kind() {
case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String:
if rv.IsNil() {
v = reflect.Zero(rv.Type().Elem()).Interface()
} else {
v = rv.Elem().Interface()
}
}
case reflect.Slice:
// Represent slice types as a pointer to the value.
if rv.Type().Elem().Kind() != reflect.Uint8 {
rv2 := reflect.New(rv.Type())
rv2.Elem().Set(rv)
v = rv2.Interface()
}
}
return v
}

View File

@ -341,26 +341,6 @@ type Message interface {
ProtoMessage() ProtoMessage()
} }
// Stats records allocation details about the protocol buffer encoders
// and decoders. Useful for tuning the library itself.
type Stats struct {
Emalloc uint64 // mallocs in encode
Dmalloc uint64 // mallocs in decode
Encode uint64 // number of encodes
Decode uint64 // number of decodes
Chit uint64 // number of cache hits
Cmiss uint64 // number of cache misses
Size uint64 // number of sizes
}
// Set to true to enable stats collection.
const collectStats = false
var stats Stats
// GetStats returns a copy of the global Stats structure.
func GetStats() Stats { return stats }
// A Buffer is a buffer manager for marshaling and unmarshaling // A Buffer is a buffer manager for marshaling and unmarshaling
// protocol buffers. It may be reused between invocations to // protocol buffers. It may be reused between invocations to
// reduce memory usage. It is not necessary to use a Buffer; // reduce memory usage. It is not necessary to use a Buffer;
@ -413,7 +393,7 @@ func (p *Buffer) Bytes() []byte { return p.buf }
// than relying on this API. // than relying on this API.
// //
// If deterministic serialization is requested, map entries will be sorted // If deterministic serialization is requested, map entries will be sorted
// by keys in lexographical order. This is an implementation detail and // by keys in lexicographical order. This is an implementation detail and
// subject to change. // subject to change.
func (p *Buffer) SetDeterministic(deterministic bool) { func (p *Buffer) SetDeterministic(deterministic bool) {
p.deterministic = deterministic p.deterministic = deterministic
@ -960,13 +940,19 @@ func isProto3Zero(v reflect.Value) bool {
return false return false
} }
// ProtoPackageIsVersion2 is referenced from generated protocol buffer files const (
// to assert that that code is compatible with this version of the proto package. // ProtoPackageIsVersion3 is referenced from generated protocol buffer files
const ProtoPackageIsVersion2 = true // to assert that that code is compatible with this version of the proto package.
ProtoPackageIsVersion3 = true
// ProtoPackageIsVersion1 is referenced from generated protocol buffer files // ProtoPackageIsVersion2 is referenced from generated protocol buffer files
// to assert that that code is compatible with this version of the proto package. // to assert that that code is compatible with this version of the proto package.
const ProtoPackageIsVersion1 = true ProtoPackageIsVersion2 = true
// ProtoPackageIsVersion1 is referenced from generated protocol buffer files
// to assert that that code is compatible with this version of the proto package.
ProtoPackageIsVersion1 = true
)
// InternalMessageInfo is a type used internally by generated .pb.go files. // InternalMessageInfo is a type used internally by generated .pb.go files.
// This type is not intended to be used by non-generated code. // This type is not intended to be used by non-generated code.

View File

@ -36,13 +36,7 @@ package proto
*/ */
import ( import (
"bytes"
"encoding/json"
"errors" "errors"
"fmt"
"reflect"
"sort"
"sync"
) )
// errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. // errNoMessageTypeID occurs when a protocol buffer does not have a message type ID.
@ -145,46 +139,9 @@ func skipVarint(buf []byte) []byte {
return buf[i+1:] return buf[i+1:]
} }
// MarshalMessageSet encodes the extension map represented by m in the message set wire format. // unmarshalMessageSet decodes the extension map encoded in buf in the message set wire format.
// It is called by generated Marshal methods on protocol buffer messages with the message_set_wire_format option.
func MarshalMessageSet(exts interface{}) ([]byte, error) {
return marshalMessageSet(exts, false)
}
// marshaMessageSet implements above function, with the opt to turn on / off deterministic during Marshal.
func marshalMessageSet(exts interface{}, deterministic bool) ([]byte, error) {
switch exts := exts.(type) {
case *XXX_InternalExtensions:
var u marshalInfo
siz := u.sizeMessageSet(exts)
b := make([]byte, 0, siz)
return u.appendMessageSet(b, exts, deterministic)
case map[int32]Extension:
// This is an old-style extension map.
// Wrap it in a new-style XXX_InternalExtensions.
ie := XXX_InternalExtensions{
p: &struct {
mu sync.Mutex
extensionMap map[int32]Extension
}{
extensionMap: exts,
},
}
var u marshalInfo
siz := u.sizeMessageSet(&ie)
b := make([]byte, 0, siz)
return u.appendMessageSet(b, &ie, deterministic)
default:
return nil, errors.New("proto: not an extension map")
}
}
// UnmarshalMessageSet decodes the extension map encoded in buf in the message set wire format.
// It is called by Unmarshal methods on protocol buffer messages with the message_set_wire_format option. // It is called by Unmarshal methods on protocol buffer messages with the message_set_wire_format option.
func UnmarshalMessageSet(buf []byte, exts interface{}) error { func unmarshalMessageSet(buf []byte, exts interface{}) error {
var m map[int32]Extension var m map[int32]Extension
switch exts := exts.(type) { switch exts := exts.(type) {
case *XXX_InternalExtensions: case *XXX_InternalExtensions:
@ -222,93 +179,3 @@ func UnmarshalMessageSet(buf []byte, exts interface{}) error {
} }
return nil return nil
} }
// MarshalMessageSetJSON encodes the extension map represented by m in JSON format.
// It is called by generated MarshalJSON methods on protocol buffer messages with the message_set_wire_format option.
func MarshalMessageSetJSON(exts interface{}) ([]byte, error) {
var m map[int32]Extension
switch exts := exts.(type) {
case *XXX_InternalExtensions:
var mu sync.Locker
m, mu = exts.extensionsRead()
if m != nil {
// Keep the extensions map locked until we're done marshaling to prevent
// races between marshaling and unmarshaling the lazily-{en,de}coded
// values.
mu.Lock()
defer mu.Unlock()
}
case map[int32]Extension:
m = exts
default:
return nil, errors.New("proto: not an extension map")
}
var b bytes.Buffer
b.WriteByte('{')
// Process the map in key order for deterministic output.
ids := make([]int32, 0, len(m))
for id := range m {
ids = append(ids, id)
}
sort.Sort(int32Slice(ids)) // int32Slice defined in text.go
for i, id := range ids {
ext := m[id]
msd, ok := messageSetMap[id]
if !ok {
// Unknown type; we can't render it, so skip it.
continue
}
if i > 0 && b.Len() > 1 {
b.WriteByte(',')
}
fmt.Fprintf(&b, `"[%s]":`, msd.name)
x := ext.value
if x == nil {
x = reflect.New(msd.t.Elem()).Interface()
if err := Unmarshal(ext.enc, x.(Message)); err != nil {
return nil, err
}
}
d, err := json.Marshal(x)
if err != nil {
return nil, err
}
b.Write(d)
}
b.WriteByte('}')
return b.Bytes(), nil
}
// UnmarshalMessageSetJSON decodes the extension map encoded in buf in JSON format.
// It is called by generated UnmarshalJSON methods on protocol buffer messages with the message_set_wire_format option.
func UnmarshalMessageSetJSON(buf []byte, exts interface{}) error {
// Common-case fast path.
if len(buf) == 0 || bytes.Equal(buf, []byte("{}")) {
return nil
}
// This is fairly tricky, and it's not clear that it is needed.
return errors.New("TODO: UnmarshalMessageSetJSON not yet implemented")
}
// A global registry of types that can be used in a MessageSet.
var messageSetMap = make(map[int32]messageSetDesc)
type messageSetDesc struct {
t reflect.Type // pointer to struct
name string
}
// RegisterMessageSetType is called from the generated code.
func RegisterMessageSetType(m Message, fieldNum int32, name string) {
messageSetMap[fieldNum] = messageSetDesc{
t: reflect.TypeOf(m),
name: name,
}
}

View File

@ -79,10 +79,13 @@ func toPointer(i *Message) pointer {
// toAddrPointer converts an interface to a pointer that points to // toAddrPointer converts an interface to a pointer that points to
// the interface data. // the interface data.
func toAddrPointer(i *interface{}, isptr bool) pointer { func toAddrPointer(i *interface{}, isptr, deref bool) pointer {
v := reflect.ValueOf(*i) v := reflect.ValueOf(*i)
u := reflect.New(v.Type()) u := reflect.New(v.Type())
u.Elem().Set(v) u.Elem().Set(v)
if deref {
u = u.Elem()
}
return pointer{v: u} return pointer{v: u}
} }

View File

@ -85,16 +85,21 @@ func toPointer(i *Message) pointer {
// toAddrPointer converts an interface to a pointer that points to // toAddrPointer converts an interface to a pointer that points to
// the interface data. // the interface data.
func toAddrPointer(i *interface{}, isptr bool) pointer { func toAddrPointer(i *interface{}, isptr, deref bool) (p pointer) {
// Super-tricky - read or get the address of data word of interface value. // Super-tricky - read or get the address of data word of interface value.
if isptr { if isptr {
// The interface is of pointer type, thus it is a direct interface. // The interface is of pointer type, thus it is a direct interface.
// The data word is the pointer data itself. We take its address. // The data word is the pointer data itself. We take its address.
return pointer{p: unsafe.Pointer(uintptr(unsafe.Pointer(i)) + ptrSize)} p = pointer{p: unsafe.Pointer(uintptr(unsafe.Pointer(i)) + ptrSize)}
} else {
// The interface is not of pointer type. The data word is the pointer
// to the data.
p = pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]}
} }
// The interface is not of pointer type. The data word is the pointer if deref {
// to the data. p.p = *(*unsafe.Pointer)(p.p)
return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} }
return p
} }
// valToPointer converts v to a pointer. v must be of pointer type. // valToPointer converts v to a pointer. v must be of pointer type.

View File

@ -38,7 +38,6 @@ package proto
import ( import (
"fmt" "fmt"
"log" "log"
"os"
"reflect" "reflect"
"sort" "sort"
"strconv" "strconv"
@ -194,7 +193,7 @@ func (p *Properties) Parse(s string) {
// "bytes,49,opt,name=foo,def=hello!" // "bytes,49,opt,name=foo,def=hello!"
fields := strings.Split(s, ",") // breaks def=, but handled below. fields := strings.Split(s, ",") // breaks def=, but handled below.
if len(fields) < 2 { if len(fields) < 2 {
fmt.Fprintf(os.Stderr, "proto: tag has too few fields: %q\n", s) log.Printf("proto: tag has too few fields: %q", s)
return return
} }
@ -214,7 +213,7 @@ func (p *Properties) Parse(s string) {
p.WireType = WireBytes p.WireType = WireBytes
// no numeric converter for non-numeric types // no numeric converter for non-numeric types
default: default:
fmt.Fprintf(os.Stderr, "proto: tag has unknown wire type: %q\n", s) log.Printf("proto: tag has unknown wire type: %q", s)
return return
} }
@ -334,9 +333,6 @@ func GetProperties(t reflect.Type) *StructProperties {
sprop, ok := propertiesMap[t] sprop, ok := propertiesMap[t]
propertiesMu.RUnlock() propertiesMu.RUnlock()
if ok { if ok {
if collectStats {
stats.Chit++
}
return sprop return sprop
} }
@ -346,17 +342,20 @@ func GetProperties(t reflect.Type) *StructProperties {
return sprop return sprop
} }
type (
oneofFuncsIface interface {
XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{})
}
oneofWrappersIface interface {
XXX_OneofWrappers() []interface{}
}
)
// getPropertiesLocked requires that propertiesMu is held. // getPropertiesLocked requires that propertiesMu is held.
func getPropertiesLocked(t reflect.Type) *StructProperties { func getPropertiesLocked(t reflect.Type) *StructProperties {
if prop, ok := propertiesMap[t]; ok { if prop, ok := propertiesMap[t]; ok {
if collectStats {
stats.Chit++
}
return prop return prop
} }
if collectStats {
stats.Cmiss++
}
prop := new(StructProperties) prop := new(StructProperties)
// in case of recursive protos, fill this in now. // in case of recursive protos, fill this in now.
@ -391,13 +390,14 @@ func getPropertiesLocked(t reflect.Type) *StructProperties {
// Re-order prop.order. // Re-order prop.order.
sort.Sort(prop) sort.Sort(prop)
type oneofMessage interface { var oots []interface{}
XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) {
case oneofFuncsIface:
_, _, _, oots = m.XXX_OneofFuncs()
case oneofWrappersIface:
oots = m.XXX_OneofWrappers()
} }
if om, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok { if len(oots) > 0 {
var oots []interface{}
_, _, _, oots = om.XXX_OneofFuncs()
// Interpret oneof metadata. // Interpret oneof metadata.
prop.OneofTypes = make(map[string]*OneofProperties) prop.OneofTypes = make(map[string]*OneofProperties)
for _, oot := range oots { for _, oot := range oots {

View File

@ -87,6 +87,7 @@ type marshalElemInfo struct {
sizer sizer sizer sizer
marshaler marshaler marshaler marshaler
isptr bool // elem is pointer typed, thus interface of this type is a direct interface (extension only) isptr bool // elem is pointer typed, thus interface of this type is a direct interface (extension only)
deref bool // dereference the pointer before operating on it; implies isptr
} }
var ( var (
@ -320,8 +321,11 @@ func (u *marshalInfo) computeMarshalInfo() {
// get oneof implementers // get oneof implementers
var oneofImplementers []interface{} var oneofImplementers []interface{}
if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok { switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) {
case oneofFuncsIface:
_, _, _, oneofImplementers = m.XXX_OneofFuncs() _, _, _, oneofImplementers = m.XXX_OneofFuncs()
case oneofWrappersIface:
oneofImplementers = m.XXX_OneofWrappers()
} }
n := t.NumField() n := t.NumField()
@ -407,13 +411,22 @@ func (u *marshalInfo) getExtElemInfo(desc *ExtensionDesc) *marshalElemInfo {
panic("tag is not an integer") panic("tag is not an integer")
} }
wt := wiretype(tags[0]) wt := wiretype(tags[0])
if t.Kind() == reflect.Ptr && t.Elem().Kind() != reflect.Struct {
t = t.Elem()
}
sizer, marshaler := typeMarshaler(t, tags, false, false) sizer, marshaler := typeMarshaler(t, tags, false, false)
var deref bool
if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 {
t = reflect.PtrTo(t)
deref = true
}
e = &marshalElemInfo{ e = &marshalElemInfo{
wiretag: uint64(tag)<<3 | wt, wiretag: uint64(tag)<<3 | wt,
tagsize: SizeVarint(uint64(tag) << 3), tagsize: SizeVarint(uint64(tag) << 3),
sizer: sizer, sizer: sizer,
marshaler: marshaler, marshaler: marshaler,
isptr: t.Kind() == reflect.Ptr, isptr: t.Kind() == reflect.Ptr,
deref: deref,
} }
// update cache // update cache
@ -448,7 +461,7 @@ func (fi *marshalFieldInfo) computeMarshalFieldInfo(f *reflect.StructField) {
func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofImplementers []interface{}) { func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofImplementers []interface{}) {
fi.field = toField(f) fi.field = toField(f)
fi.wiretag = 1<<31 - 1 // Use a large tag number, make oneofs sorted at the end. This tag will not appear on the wire. fi.wiretag = math.MaxInt32 // Use a large tag number, make oneofs sorted at the end. This tag will not appear on the wire.
fi.isPointer = true fi.isPointer = true
fi.sizer, fi.marshaler = makeOneOfMarshaler(fi, f) fi.sizer, fi.marshaler = makeOneOfMarshaler(fi, f)
fi.oneofElems = make(map[reflect.Type]*marshalElemInfo) fi.oneofElems = make(map[reflect.Type]*marshalElemInfo)
@ -476,10 +489,6 @@ func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofI
} }
} }
type oneofMessage interface {
XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{})
}
// wiretype returns the wire encoding of the type. // wiretype returns the wire encoding of the type.
func wiretype(encoding string) uint64 { func wiretype(encoding string) uint64 {
switch encoding { switch encoding {
@ -2310,8 +2319,8 @@ func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) {
for _, k := range m.MapKeys() { for _, k := range m.MapKeys() {
ki := k.Interface() ki := k.Interface()
vi := m.MapIndex(k).Interface() vi := m.MapIndex(k).Interface()
kaddr := toAddrPointer(&ki, false) // pointer to key kaddr := toAddrPointer(&ki, false, false) // pointer to key
vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value vaddr := toAddrPointer(&vi, valIsPtr, false) // pointer to value
siz := keySizer(kaddr, 1) + valSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) siz := keySizer(kaddr, 1) + valSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1)
n += siz + SizeVarint(uint64(siz)) + tagsize n += siz + SizeVarint(uint64(siz)) + tagsize
} }
@ -2329,8 +2338,8 @@ func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) {
for _, k := range keys { for _, k := range keys {
ki := k.Interface() ki := k.Interface()
vi := m.MapIndex(k).Interface() vi := m.MapIndex(k).Interface()
kaddr := toAddrPointer(&ki, false) // pointer to key kaddr := toAddrPointer(&ki, false, false) // pointer to key
vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value vaddr := toAddrPointer(&vi, valIsPtr, false) // pointer to value
b = appendVarint(b, tag) b = appendVarint(b, tag)
siz := keySizer(kaddr, 1) + valCachedSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) siz := keySizer(kaddr, 1) + valCachedSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1)
b = appendVarint(b, uint64(siz)) b = appendVarint(b, uint64(siz))
@ -2399,7 +2408,7 @@ func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int {
// the last time this function was called. // the last time this function was called.
ei := u.getExtElemInfo(e.desc) ei := u.getExtElemInfo(e.desc)
v := e.value v := e.value
p := toAddrPointer(&v, ei.isptr) p := toAddrPointer(&v, ei.isptr, ei.deref)
n += ei.sizer(p, ei.tagsize) n += ei.sizer(p, ei.tagsize)
} }
mu.Unlock() mu.Unlock()
@ -2434,7 +2443,7 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de
ei := u.getExtElemInfo(e.desc) ei := u.getExtElemInfo(e.desc)
v := e.value v := e.value
p := toAddrPointer(&v, ei.isptr) p := toAddrPointer(&v, ei.isptr, ei.deref)
b, err = ei.marshaler(b, p, ei.wiretag, deterministic) b, err = ei.marshaler(b, p, ei.wiretag, deterministic)
if !nerr.Merge(err) { if !nerr.Merge(err) {
return b, err return b, err
@ -2465,7 +2474,7 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de
ei := u.getExtElemInfo(e.desc) ei := u.getExtElemInfo(e.desc)
v := e.value v := e.value
p := toAddrPointer(&v, ei.isptr) p := toAddrPointer(&v, ei.isptr, ei.deref)
b, err = ei.marshaler(b, p, ei.wiretag, deterministic) b, err = ei.marshaler(b, p, ei.wiretag, deterministic)
if !nerr.Merge(err) { if !nerr.Merge(err) {
return b, err return b, err
@ -2510,7 +2519,7 @@ func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int {
ei := u.getExtElemInfo(e.desc) ei := u.getExtElemInfo(e.desc)
v := e.value v := e.value
p := toAddrPointer(&v, ei.isptr) p := toAddrPointer(&v, ei.isptr, ei.deref)
n += ei.sizer(p, 1) // message, tag = 3 (size=1) n += ei.sizer(p, 1) // message, tag = 3 (size=1)
} }
mu.Unlock() mu.Unlock()
@ -2553,7 +2562,7 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, de
ei := u.getExtElemInfo(e.desc) ei := u.getExtElemInfo(e.desc)
v := e.value v := e.value
p := toAddrPointer(&v, ei.isptr) p := toAddrPointer(&v, ei.isptr, ei.deref)
b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic)
if !nerr.Merge(err) { if !nerr.Merge(err) {
return b, err return b, err
@ -2591,7 +2600,7 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, de
ei := u.getExtElemInfo(e.desc) ei := u.getExtElemInfo(e.desc)
v := e.value v := e.value
p := toAddrPointer(&v, ei.isptr) p := toAddrPointer(&v, ei.isptr, ei.deref)
b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic)
b = append(b, 1<<3|WireEndGroup) b = append(b, 1<<3|WireEndGroup)
if !nerr.Merge(err) { if !nerr.Merge(err) {
@ -2621,7 +2630,7 @@ func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int {
ei := u.getExtElemInfo(e.desc) ei := u.getExtElemInfo(e.desc)
v := e.value v := e.value
p := toAddrPointer(&v, ei.isptr) p := toAddrPointer(&v, ei.isptr, ei.deref)
n += ei.sizer(p, ei.tagsize) n += ei.sizer(p, ei.tagsize)
} }
return n return n
@ -2656,7 +2665,7 @@ func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, determ
ei := u.getExtElemInfo(e.desc) ei := u.getExtElemInfo(e.desc)
v := e.value v := e.value
p := toAddrPointer(&v, ei.isptr) p := toAddrPointer(&v, ei.isptr, ei.deref)
b, err = ei.marshaler(b, p, ei.wiretag, deterministic) b, err = ei.marshaler(b, p, ei.wiretag, deterministic)
if !nerr.Merge(err) { if !nerr.Merge(err) {
return b, err return b, err

View File

@ -136,7 +136,7 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error {
u.computeUnmarshalInfo() u.computeUnmarshalInfo()
} }
if u.isMessageSet { if u.isMessageSet {
return UnmarshalMessageSet(b, m.offset(u.extensions).toExtensions()) return unmarshalMessageSet(b, m.offset(u.extensions).toExtensions())
} }
var reqMask uint64 // bitmask of required fields we've seen. var reqMask uint64 // bitmask of required fields we've seen.
var errLater error var errLater error
@ -362,46 +362,48 @@ func (u *unmarshalInfo) computeUnmarshalInfo() {
} }
// Find any types associated with oneof fields. // Find any types associated with oneof fields.
// TODO: XXX_OneofFuncs returns more info than we need. Get rid of some of it? var oneofImplementers []interface{}
fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("XXX_OneofFuncs") switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) {
if fn.IsValid() { case oneofFuncsIface:
res := fn.Call(nil)[3] // last return value from XXX_OneofFuncs: []interface{} _, _, _, oneofImplementers = m.XXX_OneofFuncs()
for i := res.Len() - 1; i >= 0; i-- { case oneofWrappersIface:
v := res.Index(i) // interface{} oneofImplementers = m.XXX_OneofWrappers()
tptr := reflect.ValueOf(v.Interface()).Type() // *Msg_X }
typ := tptr.Elem() // Msg_X for _, v := range oneofImplementers {
tptr := reflect.TypeOf(v) // *Msg_X
typ := tptr.Elem() // Msg_X
f := typ.Field(0) // oneof implementers have one field f := typ.Field(0) // oneof implementers have one field
baseUnmarshal := fieldUnmarshaler(&f) baseUnmarshal := fieldUnmarshaler(&f)
tags := strings.Split(f.Tag.Get("protobuf"), ",") tags := strings.Split(f.Tag.Get("protobuf"), ",")
fieldNum, err := strconv.Atoi(tags[1]) fieldNum, err := strconv.Atoi(tags[1])
if err != nil { if err != nil {
panic("protobuf tag field not an integer: " + tags[1]) panic("protobuf tag field not an integer: " + tags[1])
} }
var name string var name string
for _, tag := range tags { for _, tag := range tags {
if strings.HasPrefix(tag, "name=") { if strings.HasPrefix(tag, "name=") {
name = strings.TrimPrefix(tag, "name=") name = strings.TrimPrefix(tag, "name=")
break break
}
}
// Find the oneof field that this struct implements.
// Might take O(n^2) to process all of the oneofs, but who cares.
for _, of := range oneofFields {
if tptr.Implements(of.ityp) {
// We have found the corresponding interface for this struct.
// That lets us know where this struct should be stored
// when we encounter it during unmarshaling.
unmarshal := makeUnmarshalOneof(typ, of.ityp, baseUnmarshal)
u.setTag(fieldNum, of.field, unmarshal, 0, name)
}
} }
} }
// Find the oneof field that this struct implements.
// Might take O(n^2) to process all of the oneofs, but who cares.
for _, of := range oneofFields {
if tptr.Implements(of.ityp) {
// We have found the corresponding interface for this struct.
// That lets us know where this struct should be stored
// when we encounter it during unmarshaling.
unmarshal := makeUnmarshalOneof(typ, of.ityp, baseUnmarshal)
u.setTag(fieldNum, of.field, unmarshal, 0, name)
}
}
} }
// Get extension ranges, if any. // Get extension ranges, if any.
fn = reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray") fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray")
if fn.IsValid() { if fn.IsValid() {
if !u.extensions.IsValid() && !u.oldExtensions.IsValid() { if !u.extensions.IsValid() && !u.oldExtensions.IsValid() {
panic("a message with extensions, but no extensions field in " + t.Name()) panic("a message with extensions, but no extensions field in " + t.Name())
@ -1948,7 +1950,7 @@ func encodeVarint(b []byte, x uint64) []byte {
// If there is an error, it returns 0,0. // If there is an error, it returns 0,0.
func decodeVarint(b []byte) (uint64, int) { func decodeVarint(b []byte) (uint64, int) {
var x, y uint64 var x, y uint64
if len(b) <= 0 { if len(b) == 0 {
goto bad goto bad
} }
x = uint64(b[0]) x = uint64(b[0])

View File

@ -456,6 +456,8 @@ func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error {
return nil return nil
} }
var textMarshalerType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem()
// writeAny writes an arbitrary field. // writeAny writes an arbitrary field.
func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error { func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error {
v = reflect.Indirect(v) v = reflect.Indirect(v)
@ -519,8 +521,8 @@ func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Propert
// mutating this value. // mutating this value.
v = v.Addr() v = v.Addr()
} }
if etm, ok := v.Interface().(encoding.TextMarshaler); ok { if v.Type().Implements(textMarshalerType) {
text, err := etm.MarshalText() text, err := v.Interface().(encoding.TextMarshaler).MarshalText()
if err != nil { if err != nil {
return err return err
} }

View File

@ -1,11 +1,13 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/protobuf/any.proto // source: google/protobuf/any.proto
package any // import "github.com/golang/protobuf/ptypes/any" package any
import proto "github.com/golang/protobuf/proto" import (
import fmt "fmt" fmt "fmt"
import math "math" proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal var _ = proto.Marshal
@ -16,7 +18,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// `Any` contains an arbitrary serialized protocol buffer message along with a // `Any` contains an arbitrary serialized protocol buffer message along with a
// URL that describes the type of the serialized message. // URL that describes the type of the serialized message.
@ -99,17 +101,18 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
// } // }
// //
type Any struct { type Any struct {
// A URL/resource name whose content describes the type of the // A URL/resource name that uniquely identifies the type of the serialized
// serialized protocol buffer message. // protocol buffer message. The last segment of the URL's path must represent
// the fully qualified name of the type (as in
// `path/google.protobuf.Duration`). The name should be in a canonical form
// (e.g., leading "." is not accepted).
// //
// For URLs which use the scheme `http`, `https`, or no scheme, the // In practice, teams usually precompile into the binary all types that they
// following restrictions and interpretations apply: // expect it to use in the context of Any. However, for URLs which use the
// scheme `http`, `https`, or no scheme, one can optionally set up a type
// server that maps type URLs to message definitions as follows:
// //
// * If no scheme is provided, `https` is assumed. // * If no scheme is provided, `https` is assumed.
// * The last segment of the URL's path must represent the fully
// qualified name of the type (as in `path/google.protobuf.Duration`).
// The name should be in a canonical form (e.g., leading "." is
// not accepted).
// * An HTTP GET on the URL must yield a [google.protobuf.Type][] // * An HTTP GET on the URL must yield a [google.protobuf.Type][]
// value in binary format, or produce an error. // value in binary format, or produce an error.
// * Applications are allowed to cache lookup results based on the // * Applications are allowed to cache lookup results based on the
@ -118,6 +121,10 @@ type Any struct {
// on changes to types. (Use versioned type names to manage // on changes to types. (Use versioned type names to manage
// breaking changes.) // breaking changes.)
// //
// Note: this functionality is not currently available in the official
// protobuf release, and it is not used for type URLs beginning with
// type.googleapis.com.
//
// Schemes other than `http`, `https` (or the empty scheme) might be // Schemes other than `http`, `https` (or the empty scheme) might be
// used with implementation specific semantics. // used with implementation specific semantics.
// //
@ -133,17 +140,19 @@ func (m *Any) Reset() { *m = Any{} }
func (m *Any) String() string { return proto.CompactTextString(m) } func (m *Any) String() string { return proto.CompactTextString(m) }
func (*Any) ProtoMessage() {} func (*Any) ProtoMessage() {}
func (*Any) Descriptor() ([]byte, []int) { func (*Any) Descriptor() ([]byte, []int) {
return fileDescriptor_any_744b9ca530f228db, []int{0} return fileDescriptor_b53526c13ae22eb4, []int{0}
} }
func (*Any) XXX_WellKnownType() string { return "Any" } func (*Any) XXX_WellKnownType() string { return "Any" }
func (m *Any) XXX_Unmarshal(b []byte) error { func (m *Any) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Any.Unmarshal(m, b) return xxx_messageInfo_Any.Unmarshal(m, b)
} }
func (m *Any) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *Any) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Any.Marshal(b, m, deterministic) return xxx_messageInfo_Any.Marshal(b, m, deterministic)
} }
func (dst *Any) XXX_Merge(src proto.Message) { func (m *Any) XXX_Merge(src proto.Message) {
xxx_messageInfo_Any.Merge(dst, src) xxx_messageInfo_Any.Merge(m, src)
} }
func (m *Any) XXX_Size() int { func (m *Any) XXX_Size() int {
return xxx_messageInfo_Any.Size(m) return xxx_messageInfo_Any.Size(m)
@ -172,9 +181,9 @@ func init() {
proto.RegisterType((*Any)(nil), "google.protobuf.Any") proto.RegisterType((*Any)(nil), "google.protobuf.Any")
} }
func init() { proto.RegisterFile("google/protobuf/any.proto", fileDescriptor_any_744b9ca530f228db) } func init() { proto.RegisterFile("google/protobuf/any.proto", fileDescriptor_b53526c13ae22eb4) }
var fileDescriptor_any_744b9ca530f228db = []byte{ var fileDescriptor_b53526c13ae22eb4 = []byte{
// 185 bytes of a gzipped FileDescriptorProto // 185 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xcf, 0xcf, 0x4f, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xcf, 0xcf, 0x4f,
0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcc, 0xab, 0xd4, 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcc, 0xab, 0xd4,

View File

@ -120,17 +120,18 @@ option objc_class_prefix = "GPB";
// } // }
// //
message Any { message Any {
// A URL/resource name whose content describes the type of the // A URL/resource name that uniquely identifies the type of the serialized
// serialized protocol buffer message. // protocol buffer message. The last segment of the URL's path must represent
// the fully qualified name of the type (as in
// `path/google.protobuf.Duration`). The name should be in a canonical form
// (e.g., leading "." is not accepted).
// //
// For URLs which use the scheme `http`, `https`, or no scheme, the // In practice, teams usually precompile into the binary all types that they
// following restrictions and interpretations apply: // expect it to use in the context of Any. However, for URLs which use the
// scheme `http`, `https`, or no scheme, one can optionally set up a type
// server that maps type URLs to message definitions as follows:
// //
// * If no scheme is provided, `https` is assumed. // * If no scheme is provided, `https` is assumed.
// * The last segment of the URL's path must represent the fully
// qualified name of the type (as in `path/google.protobuf.Duration`).
// The name should be in a canonical form (e.g., leading "." is
// not accepted).
// * An HTTP GET on the URL must yield a [google.protobuf.Type][] // * An HTTP GET on the URL must yield a [google.protobuf.Type][]
// value in binary format, or produce an error. // value in binary format, or produce an error.
// * Applications are allowed to cache lookup results based on the // * Applications are allowed to cache lookup results based on the
@ -139,6 +140,10 @@ message Any {
// on changes to types. (Use versioned type names to manage // on changes to types. (Use versioned type names to manage
// breaking changes.) // breaking changes.)
// //
// Note: this functionality is not currently available in the official
// protobuf release, and it is not used for type URLs beginning with
// type.googleapis.com.
//
// Schemes other than `http`, `https` (or the empty scheme) might be // Schemes other than `http`, `https` (or the empty scheme) might be
// used with implementation specific semantics. // used with implementation specific semantics.
// //

View File

@ -82,7 +82,7 @@ func Duration(p *durpb.Duration) (time.Duration, error) {
return 0, fmt.Errorf("duration: %v is out of range for time.Duration", p) return 0, fmt.Errorf("duration: %v is out of range for time.Duration", p)
} }
if p.Nanos != 0 { if p.Nanos != 0 {
d += time.Duration(p.Nanos) d += time.Duration(p.Nanos) * time.Nanosecond
if (d < 0) != (p.Nanos < 0) { if (d < 0) != (p.Nanos < 0) {
return 0, fmt.Errorf("duration: %v is out of range for time.Duration", p) return 0, fmt.Errorf("duration: %v is out of range for time.Duration", p)
} }

View File

@ -1,11 +1,13 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/protobuf/duration.proto // source: google/protobuf/duration.proto
package duration // import "github.com/golang/protobuf/ptypes/duration" package duration
import proto "github.com/golang/protobuf/proto" import (
import fmt "fmt" fmt "fmt"
import math "math" proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal var _ = proto.Marshal
@ -16,7 +18,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// A Duration represents a signed, fixed-length span of time represented // A Duration represents a signed, fixed-length span of time represented
// as a count of seconds and fractions of seconds at nanosecond // as a count of seconds and fractions of seconds at nanosecond
@ -99,17 +101,19 @@ func (m *Duration) Reset() { *m = Duration{} }
func (m *Duration) String() string { return proto.CompactTextString(m) } func (m *Duration) String() string { return proto.CompactTextString(m) }
func (*Duration) ProtoMessage() {} func (*Duration) ProtoMessage() {}
func (*Duration) Descriptor() ([]byte, []int) { func (*Duration) Descriptor() ([]byte, []int) {
return fileDescriptor_duration_e7d612259e3f0613, []int{0} return fileDescriptor_23597b2ebd7ac6c5, []int{0}
} }
func (*Duration) XXX_WellKnownType() string { return "Duration" } func (*Duration) XXX_WellKnownType() string { return "Duration" }
func (m *Duration) XXX_Unmarshal(b []byte) error { func (m *Duration) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Duration.Unmarshal(m, b) return xxx_messageInfo_Duration.Unmarshal(m, b)
} }
func (m *Duration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *Duration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Duration.Marshal(b, m, deterministic) return xxx_messageInfo_Duration.Marshal(b, m, deterministic)
} }
func (dst *Duration) XXX_Merge(src proto.Message) { func (m *Duration) XXX_Merge(src proto.Message) {
xxx_messageInfo_Duration.Merge(dst, src) xxx_messageInfo_Duration.Merge(m, src)
} }
func (m *Duration) XXX_Size() int { func (m *Duration) XXX_Size() int {
return xxx_messageInfo_Duration.Size(m) return xxx_messageInfo_Duration.Size(m)
@ -138,11 +142,9 @@ func init() {
proto.RegisterType((*Duration)(nil), "google.protobuf.Duration") proto.RegisterType((*Duration)(nil), "google.protobuf.Duration")
} }
func init() { func init() { proto.RegisterFile("google/protobuf/duration.proto", fileDescriptor_23597b2ebd7ac6c5) }
proto.RegisterFile("google/protobuf/duration.proto", fileDescriptor_duration_e7d612259e3f0613)
}
var fileDescriptor_duration_e7d612259e3f0613 = []byte{ var fileDescriptor_23597b2ebd7ac6c5 = []byte{
// 190 bytes of a gzipped FileDescriptorProto // 190 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcf, 0xcf, 0x4f, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcf, 0xcf, 0x4f,
0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0x29, 0x2d, 0x4a, 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0x29, 0x2d, 0x4a,

View File

@ -111,11 +111,9 @@ func TimestampNow() *tspb.Timestamp {
// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. // TimestampProto converts the time.Time to a google.protobuf.Timestamp proto.
// It returns an error if the resulting Timestamp is invalid. // It returns an error if the resulting Timestamp is invalid.
func TimestampProto(t time.Time) (*tspb.Timestamp, error) { func TimestampProto(t time.Time) (*tspb.Timestamp, error) {
seconds := t.Unix()
nanos := int32(t.Sub(time.Unix(seconds, 0)))
ts := &tspb.Timestamp{ ts := &tspb.Timestamp{
Seconds: seconds, Seconds: t.Unix(),
Nanos: nanos, Nanos: int32(t.Nanosecond()),
} }
if err := validateTimestamp(ts); err != nil { if err := validateTimestamp(ts); err != nil {
return nil, err return nil, err

View File

@ -1,11 +1,13 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/protobuf/timestamp.proto // source: google/protobuf/timestamp.proto
package timestamp // import "github.com/golang/protobuf/ptypes/timestamp" package timestamp
import proto "github.com/golang/protobuf/proto" import (
import fmt "fmt" fmt "fmt"
import math "math" proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal var _ = proto.Marshal
@ -16,7 +18,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against. // is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the // A compilation error at this line likely means your copy of the
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// A Timestamp represents a point in time independent of any time zone // A Timestamp represents a point in time independent of any time zone
// or calendar, represented as seconds and fractions of seconds at // or calendar, represented as seconds and fractions of seconds at
@ -81,7 +83,9 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional // {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), // seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone // are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
// is required, though only UTC (as indicated by "Z") is presently supported. // is required. A proto3 JSON serializer should always use UTC (as indicated by
// "Z") when printing the Timestamp type and a proto3 JSON parser should be
// able to accept both UTC and other timezones (as indicated by an offset).
// //
// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
// 01:30 UTC on January 15, 2017. // 01:30 UTC on January 15, 2017.
@ -92,8 +96,8 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) // to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one // with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
// can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( // can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--) // http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
// to obtain a formatter capable of generating timestamps in this format. // ) to obtain a formatter capable of generating timestamps in this format.
// //
// //
type Timestamp struct { type Timestamp struct {
@ -115,17 +119,19 @@ func (m *Timestamp) Reset() { *m = Timestamp{} }
func (m *Timestamp) String() string { return proto.CompactTextString(m) } func (m *Timestamp) String() string { return proto.CompactTextString(m) }
func (*Timestamp) ProtoMessage() {} func (*Timestamp) ProtoMessage() {}
func (*Timestamp) Descriptor() ([]byte, []int) { func (*Timestamp) Descriptor() ([]byte, []int) {
return fileDescriptor_timestamp_b826e8e5fba671a8, []int{0} return fileDescriptor_292007bbfe81227e, []int{0}
} }
func (*Timestamp) XXX_WellKnownType() string { return "Timestamp" } func (*Timestamp) XXX_WellKnownType() string { return "Timestamp" }
func (m *Timestamp) XXX_Unmarshal(b []byte) error { func (m *Timestamp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Timestamp.Unmarshal(m, b) return xxx_messageInfo_Timestamp.Unmarshal(m, b)
} }
func (m *Timestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *Timestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Timestamp.Marshal(b, m, deterministic) return xxx_messageInfo_Timestamp.Marshal(b, m, deterministic)
} }
func (dst *Timestamp) XXX_Merge(src proto.Message) { func (m *Timestamp) XXX_Merge(src proto.Message) {
xxx_messageInfo_Timestamp.Merge(dst, src) xxx_messageInfo_Timestamp.Merge(m, src)
} }
func (m *Timestamp) XXX_Size() int { func (m *Timestamp) XXX_Size() int {
return xxx_messageInfo_Timestamp.Size(m) return xxx_messageInfo_Timestamp.Size(m)
@ -154,11 +160,9 @@ func init() {
proto.RegisterType((*Timestamp)(nil), "google.protobuf.Timestamp") proto.RegisterType((*Timestamp)(nil), "google.protobuf.Timestamp")
} }
func init() { func init() { proto.RegisterFile("google/protobuf/timestamp.proto", fileDescriptor_292007bbfe81227e) }
proto.RegisterFile("google/protobuf/timestamp.proto", fileDescriptor_timestamp_b826e8e5fba671a8)
}
var fileDescriptor_timestamp_b826e8e5fba671a8 = []byte{ var fileDescriptor_292007bbfe81227e = []byte{
// 191 bytes of a gzipped FileDescriptorProto // 191 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xcf, 0xcf, 0x4f, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xcf, 0xcf, 0x4f,
0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0xc9, 0xcc, 0x4d, 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0xc9, 0xcc, 0x4d,

View File

@ -103,7 +103,9 @@ option objc_class_prefix = "GPB";
// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional // {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), // seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone // are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
// is required, though only UTC (as indicated by "Z") is presently supported. // is required. A proto3 JSON serializer should always use UTC (as indicated by
// "Z") when printing the Timestamp type and a proto3 JSON parser should be
// able to accept both UTC and other timezones (as indicated by an offset).
// //
// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
// 01:30 UTC on January 15, 2017. // 01:30 UTC on January 15, 2017.
@ -114,8 +116,8 @@ option objc_class_prefix = "GPB";
// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) // to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one // with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
// can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( // can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--) // http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
// to obtain a formatter capable of generating timestamps in this format. // ) to obtain a formatter capable of generating timestamps in this format.
// //
// //
message Timestamp { message Timestamp {

View File

@ -3,6 +3,8 @@
[![Travis Build](https://travis-ci.org/grpc-ecosystem/go-grpc-prometheus.svg)](https://travis-ci.org/grpc-ecosystem/go-grpc-prometheus) [![Travis Build](https://travis-ci.org/grpc-ecosystem/go-grpc-prometheus.svg)](https://travis-ci.org/grpc-ecosystem/go-grpc-prometheus)
[![Go Report Card](https://goreportcard.com/badge/github.com/grpc-ecosystem/go-grpc-prometheus)](http://goreportcard.com/report/grpc-ecosystem/go-grpc-prometheus) [![Go Report Card](https://goreportcard.com/badge/github.com/grpc-ecosystem/go-grpc-prometheus)](http://goreportcard.com/report/grpc-ecosystem/go-grpc-prometheus)
[![GoDoc](http://img.shields.io/badge/GoDoc-Reference-blue.svg)](https://godoc.org/github.com/grpc-ecosystem/go-grpc-prometheus) [![GoDoc](http://img.shields.io/badge/GoDoc-Reference-blue.svg)](https://godoc.org/github.com/grpc-ecosystem/go-grpc-prometheus)
[![SourceGraph](https://sourcegraph.com/github.com/grpc-ecosystem/go-grpc-prometheus/-/badge.svg)](https://sourcegraph.com/github.com/grpc-ecosystem/go-grpc-prometheus/?badge)
[![codecov](https://codecov.io/gh/grpc-ecosystem/go-grpc-prometheus/branch/master/graph/badge.svg)](https://codecov.io/gh/grpc-ecosystem/go-grpc-prometheus)
[![Apache 2.0 License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) [![Apache 2.0 License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
[Prometheus](https://prometheus.io/) monitoring for your [gRPC Go](https://github.com/grpc/grpc-go) servers and clients. [Prometheus](https://prometheus.io/) monitoring for your [gRPC Go](https://github.com/grpc/grpc-go) servers and clients.
@ -36,7 +38,7 @@ import "github.com/grpc-ecosystem/go-grpc-prometheus"
// After all your registrations, make sure all of the Prometheus metrics are initialized. // After all your registrations, make sure all of the Prometheus metrics are initialized.
grpc_prometheus.Register(myServer) grpc_prometheus.Register(myServer)
// Register Prometheus metrics handler. // Register Prometheus metrics handler.
http.Handle("/metrics", prometheus.Handler()) http.Handle("/metrics", promhttp.Handler())
... ...
``` ```
@ -47,8 +49,8 @@ import "github.com/grpc-ecosystem/go-grpc-prometheus"
... ...
clientConn, err = grpc.Dial( clientConn, err = grpc.Dial(
address, address,
grpc.WithUnaryInterceptor(UnaryClientInterceptor), grpc.WithUnaryInterceptor(grpc_prometheus.UnaryClientInterceptor),
grpc.WithStreamInterceptor(StreamClientInterceptor) grpc.WithStreamInterceptor(grpc_prometheus.StreamClientInterceptor)
) )
client = pb_testproto.NewTestServiceClient(clientConn) client = pb_testproto.NewTestServiceClient(clientConn)
resp, err := client.PingEmpty(s.ctx, &myservice.Request{Msg: "hello"}) resp, err := client.PingEmpty(s.ctx, &myservice.Request{Msg: "hello"})
@ -116,7 +118,7 @@ each of the 20 messages sent back, a counter will be incremented:
grpc_server_msg_sent_total{grpc_method="PingList",grpc_service="mwitkow.testproto.TestService",grpc_type="server_stream"} 20 grpc_server_msg_sent_total{grpc_method="PingList",grpc_service="mwitkow.testproto.TestService",grpc_type="server_stream"} 20
``` ```
After the call completes, it's status (`OK` or other [gRPC status code](https://github.com/grpc/grpc-go/blob/master/codes/codes.go)) After the call completes, its status (`OK` or other [gRPC status code](https://github.com/grpc/grpc-go/blob/master/codes/codes.go))
and the relevant call labels increment the `grpc_server_handled_total` counter. and the relevant call labels increment the `grpc_server_handled_total` counter.
```jsoniq ```jsoniq
@ -126,8 +128,8 @@ grpc_server_handled_total{grpc_code="OK",grpc_method="PingList",grpc_service="mw
## Histograms ## Histograms
[Prometheus histograms](https://prometheus.io/docs/concepts/metric_types/#histogram) are a great way [Prometheus histograms](https://prometheus.io/docs/concepts/metric_types/#histogram) are a great way
to measure latency distributions of your RPCs. However since it is bad practice to have metrics to measure latency distributions of your RPCs. However, since it is bad practice to have metrics
of [high cardinality](https://prometheus.io/docs/practices/instrumentation/#do-not-overuse-labels)) of [high cardinality](https://prometheus.io/docs/practices/instrumentation/#do-not-overuse-labels)
the latency monitoring metrics are disabled by default. To enable them please call the following the latency monitoring metrics are disabled by default. To enable them please call the following
in your server initialization code: in your server initialization code:
@ -135,8 +137,8 @@ in your server initialization code:
grpc_prometheus.EnableHandlingTimeHistogram() grpc_prometheus.EnableHandlingTimeHistogram()
``` ```
After the call completes, it's handling time will be recorded in a [Prometheus histogram](https://prometheus.io/docs/concepts/metric_types/#histogram) After the call completes, its handling time will be recorded in a [Prometheus histogram](https://prometheus.io/docs/concepts/metric_types/#histogram)
variable `grpc_server_handling_seconds`. It contains three sub-metrics: variable `grpc_server_handling_seconds`. The histogram variable contains three sub-metrics:
* `grpc_server_handling_seconds_count` - the count of all completed RPCs by status and method * `grpc_server_handling_seconds_count` - the count of all completed RPCs by status and method
* `grpc_server_handling_seconds_sum` - cumulative time of RPCs by status and method, useful for * `grpc_server_handling_seconds_sum` - cumulative time of RPCs by status and method, useful for
@ -166,7 +168,7 @@ grpc_server_handling_seconds_count{grpc_code="OK",grpc_method="PingList",grpc_se
## Useful query examples ## Useful query examples
Prometheus philosophy is to provide the most detailed metrics possible to the monitoring system, and Prometheus philosophy is to provide raw metrics to the monitoring system, and
let the aggregations be handled there. The verbosity of above metrics make it possible to have that let the aggregations be handled there. The verbosity of above metrics make it possible to have that
flexibility. Here's a couple of useful monitoring queries: flexibility. Here's a couple of useful monitoring queries:

Some files were not shown because too many files have changed in this diff Show More