| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
package status |
| 14 |
|
| 15 |
import proto "github.com/gogo/protobuf/proto" |
| 16 |
import fmt "fmt" |
| 17 |
import math "math" |
| 18 |
import _ "github.com/gogo/protobuf/gogoproto" |
| 19 |
import codes "github.com/influxdata/yarpc/codes" |
| 20 |
|
| 21 |
import io "io" |
| 22 |
|
| 23 |
|
| 24 |
var _ = proto.Marshal |
| 25 |
var _ = fmt.Errorf |
| 26 |
var _ = math.Inf |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
const _ = proto.GoGoProtoPackageIsVersion2 |
| 33 |
|
| 34 |
type Status struct { |
| 35 |
Code codes.Code `protobuf:"varint,1,opt,name=code,proto3,enum=codes.Code" json:"code,omitempty"` |
| 36 |
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` |
| 37 |
} |
| 38 |
|
| 39 |
func (m *Status) Reset() { *m = Status{} } |
| 40 |
func (m *Status) String() string { return proto.CompactTextString(m) } |
| 41 |
func (*Status) ProtoMessage() {} |
| 42 |
func (*Status) Descriptor() ([]byte, []int) { return fileDescriptorStatus, []int{0} } |
| 43 |
|
| 44 |
func (m *Status) GetCode() codes.Code { |
| 45 |
if m != nil { |
| 46 |
return m.Code |
| 47 |
} |
| 48 |
return codes.OK |
| 49 |
} |
| 50 |
|
| 51 |
func (m *Status) GetMessage() string { |
| 52 |
if m != nil { |
| 53 |
return m.Message |
| 54 |
} |
| 55 |
return "" |
| 56 |
} |
| 57 |
|
| 58 |
func init() { |
| 59 |
proto.RegisterType((*Status)(nil), "status.Status") |
| 60 |
} |
| 61 |
func (m *Status) Marshal() (dAtA []byte, err error) { |
| 62 |
size := m.Size() |
| 63 |
dAtA = make([]byte, size) |
| 64 |
n, err := m.MarshalTo(dAtA) |
| 65 |
if err != nil { |
| 66 |
return nil, err |
| 67 |
} |
| 68 |
return dAtA[:n], nil |
| 69 |
} |
| 70 |
|
| 71 |
func (m *Status) MarshalTo(dAtA []byte) (int, error) { |
| 72 |
var i int |
| 73 |
_ = i |
| 74 |
var l int |
| 75 |
_ = l |
| 76 |
if m.Code != 0 { |
| 77 |
dAtA[i] = 0x8 |
| 78 |
i++ |
| 79 |
i = encodeVarintStatus(dAtA, i, uint64(m.Code)) |
| 80 |
} |
| 81 |
if len(m.Message) > 0 { |
| 82 |
dAtA[i] = 0x12 |
| 83 |
i++ |
| 84 |
i = encodeVarintStatus(dAtA, i, uint64(len(m.Message))) |
| 85 |
i += copy(dAtA[i:], m.Message) |
| 86 |
} |
| 87 |
return i, nil |
| 88 |
} |
| 89 |
|
| 90 |
func encodeFixed64Status(dAtA []byte, offset int, v uint64) int { |
| 91 |
dAtA[offset] = uint8(v) |
| 92 |
dAtA[offset+1] = uint8(v >> 8) |
| 93 |
dAtA[offset+2] = uint8(v >> 16) |
| 94 |
dAtA[offset+3] = uint8(v >> 24) |
| 95 |
dAtA[offset+4] = uint8(v >> 32) |
| 96 |
dAtA[offset+5] = uint8(v >> 40) |
| 97 |
dAtA[offset+6] = uint8(v >> 48) |
| 98 |
dAtA[offset+7] = uint8(v >> 56) |
| 99 |
return offset + 8 |
| 100 |
} |
| 101 |
func encodeFixed32Status(dAtA []byte, offset int, v uint32) int { |
| 102 |
dAtA[offset] = uint8(v) |
| 103 |
dAtA[offset+1] = uint8(v >> 8) |
| 104 |
dAtA[offset+2] = uint8(v >> 16) |
| 105 |
dAtA[offset+3] = uint8(v >> 24) |
| 106 |
return offset + 4 |
| 107 |
} |
| 108 |
func encodeVarintStatus(dAtA []byte, offset int, v uint64) int { |
| 109 |
for v >= 1<<7 { |
| 110 |
dAtA[offset] = uint8(v&0x7f | 0x80) |
| 111 |
v >>= 7 |
| 112 |
offset++ |
| 113 |
} |
| 114 |
dAtA[offset] = uint8(v) |
| 115 |
return offset + 1 |
| 116 |
} |
| 117 |
func (m *Status) Size() (n int) { |
| 118 |
var l int |
| 119 |
_ = l |
| 120 |
if m.Code != 0 { |
| 121 |
n += 1 + sovStatus(uint64(m.Code)) |
| 122 |
} |
| 123 |
l = len(m.Message) |
| 124 |
if l > 0 { |
| 125 |
n += 1 + l + sovStatus(uint64(l)) |
| 126 |
} |
| 127 |
return n |
| 128 |
} |
| 129 |
|
| 130 |
func sovStatus(x uint64) (n int) { |
| 131 |
for { |
| 132 |
n++ |
| 133 |
x >>= 7 |
| 134 |
if x == 0 { |
| 135 |
break |
| 136 |
} |
| 137 |
} |
| 138 |
return n |
| 139 |
} |
| 140 |
func sozStatus(x uint64) (n int) { |
| 141 |
return sovStatus(uint64((x << 1) ^ uint64((int64(x) >> 63)))) |
| 142 |
} |
| 143 |
func (m *Status) Unmarshal(dAtA []byte) error { |
| 144 |
l := len(dAtA) |
| 145 |
iNdEx := 0 |
| 146 |
for iNdEx < l { |
| 147 |
preIndex := iNdEx |
| 148 |
var wire uint64 |
| 149 |
for shift := uint(0); ; shift += 7 { |
| 150 |
if shift >= 64 { |
| 151 |
return ErrIntOverflowStatus |
| 152 |
} |
| 153 |
if iNdEx >= l { |
| 154 |
return io.ErrUnexpectedEOF |
| 155 |
} |
| 156 |
b := dAtA[iNdEx] |
| 157 |
iNdEx++ |
| 158 |
wire |= (uint64(b) & 0x7F) << shift |
| 159 |
if b < 0x80 { |
| 160 |
break |
| 161 |
} |
| 162 |
} |
| 163 |
fieldNum := int32(wire >> 3) |
| 164 |
wireType := int(wire & 0x7) |
| 165 |
if wireType == 4 { |
| 166 |
return fmt.Errorf("proto: Status: wiretype end group for non-group") |
| 167 |
} |
| 168 |
if fieldNum <= 0 { |
| 169 |
return fmt.Errorf("proto: Status: illegal tag %d (wire type %d)", fieldNum, wire) |
| 170 |
} |
| 171 |
switch fieldNum { |
| 172 |
case 1: |
| 173 |
if wireType != 0 { |
| 174 |
return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) |
| 175 |
} |
| 176 |
m.Code = 0 |
| 177 |
for shift := uint(0); ; shift += 7 { |
| 178 |
if shift >= 64 { |
| 179 |
return ErrIntOverflowStatus |
| 180 |
} |
| 181 |
if iNdEx >= l { |
| 182 |
return io.ErrUnexpectedEOF |
| 183 |
} |
| 184 |
b := dAtA[iNdEx] |
| 185 |
iNdEx++ |
| 186 |
m.Code |= (codes.Code(b) & 0x7F) << shift |
| 187 |
if b < 0x80 { |
| 188 |
break |
| 189 |
} |
| 190 |
} |
| 191 |
case 2: |
| 192 |
if wireType != 2 { |
| 193 |
return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) |
| 194 |
} |
| 195 |
var stringLen uint64 |
| 196 |
for shift := uint(0); ; shift += 7 { |
| 197 |
if shift >= 64 { |
| 198 |
return ErrIntOverflowStatus |
| 199 |
} |
| 200 |
if iNdEx >= l { |
| 201 |
return io.ErrUnexpectedEOF |
| 202 |
} |
| 203 |
b := dAtA[iNdEx] |
| 204 |
iNdEx++ |
| 205 |
stringLen |= (uint64(b) & 0x7F) << shift |
| 206 |
if b < 0x80 { |
| 207 |
break |
| 208 |
} |
| 209 |
} |
| 210 |
intStringLen := int(stringLen) |
| 211 |
if intStringLen < 0 { |
| 212 |
return ErrInvalidLengthStatus |
| 213 |
} |
| 214 |
postIndex := iNdEx + intStringLen |
| 215 |
if postIndex > l { |
| 216 |
return io.ErrUnexpectedEOF |
| 217 |
} |
| 218 |
m.Message = string(dAtA[iNdEx:postIndex]) |
| 219 |
iNdEx = postIndex |
| 220 |
default: |
| 221 |
iNdEx = preIndex |
| 222 |
skippy, err := skipStatus(dAtA[iNdEx:]) |
| 223 |
if err != nil { |
| 224 |
return err |
| 225 |
} |
| 226 |
if skippy < 0 { |
| 227 |
return ErrInvalidLengthStatus |
| 228 |
} |
| 229 |
if (iNdEx + skippy) > l { |
| 230 |
return io.ErrUnexpectedEOF |
| 231 |
} |
| 232 |
iNdEx += skippy |
| 233 |
} |
| 234 |
} |
| 235 |
|
| 236 |
if iNdEx > l { |
| 237 |
return io.ErrUnexpectedEOF |
| 238 |
} |
| 239 |
return nil |
| 240 |
} |
| 241 |
func skipStatus(dAtA []byte) (n int, err error) { |
| 242 |
l := len(dAtA) |
| 243 |
iNdEx := 0 |
| 244 |
for iNdEx < l { |
| 245 |
var wire uint64 |
| 246 |
for shift := uint(0); ; shift += 7 { |
| 247 |
if shift >= 64 { |
| 248 |
return 0, ErrIntOverflowStatus |
| 249 |
} |
| 250 |
if iNdEx >= l { |
| 251 |
return 0, io.ErrUnexpectedEOF |
| 252 |
} |
| 253 |
b := dAtA[iNdEx] |
| 254 |
iNdEx++ |
| 255 |
wire |= (uint64(b) & 0x7F) << shift |
| 256 |
if b < 0x80 { |
| 257 |
break |
| 258 |
} |
| 259 |
} |
| 260 |
wireType := int(wire & 0x7) |
| 261 |
switch wireType { |
| 262 |
case 0: |
| 263 |
for shift := uint(0); ; shift += 7 { |
| 264 |
if shift >= 64 { |
| 265 |
return 0, ErrIntOverflowStatus |
| 266 |
} |
| 267 |
if iNdEx >= l { |
| 268 |
return 0, io.ErrUnexpectedEOF |
| 269 |
} |
| 270 |
iNdEx++ |
| 271 |
if dAtA[iNdEx-1] < 0x80 { |
| 272 |
break |
| 273 |
} |
| 274 |
} |
| 275 |
return iNdEx, nil |
| 276 |
case 1: |
| 277 |
iNdEx += 8 |
| 278 |
return iNdEx, nil |
| 279 |
case 2: |
| 280 |
var length int |
| 281 |
for shift := uint(0); ; shift += 7 { |
| 282 |
if shift >= 64 { |
| 283 |
return 0, ErrIntOverflowStatus |
| 284 |
} |
| 285 |
if iNdEx >= l { |
| 286 |
return 0, io.ErrUnexpectedEOF |
| 287 |
} |
| 288 |
b := dAtA[iNdEx] |
| 289 |
iNdEx++ |
| 290 |
length |= (int(b) & 0x7F) << shift |
| 291 |
if b < 0x80 { |
| 292 |
break |
| 293 |
} |
| 294 |
} |
| 295 |
iNdEx += length |
| 296 |
if length < 0 { |
| 297 |
return 0, ErrInvalidLengthStatus |
| 298 |
} |
| 299 |
return iNdEx, nil |
| 300 |
case 3: |
| 301 |
for { |
| 302 |
var innerWire uint64 |
| 303 |
var start int = iNdEx |
| 304 |
for shift := uint(0); ; shift += 7 { |
| 305 |
if shift >= 64 { |
| 306 |
return 0, ErrIntOverflowStatus |
| 307 |
} |
| 308 |
if iNdEx >= l { |
| 309 |
return 0, io.ErrUnexpectedEOF |
| 310 |
} |
| 311 |
b := dAtA[iNdEx] |
| 312 |
iNdEx++ |
| 313 |
innerWire |= (uint64(b) & 0x7F) << shift |
| 314 |
if b < 0x80 { |
| 315 |
break |
| 316 |
} |
| 317 |
} |
| 318 |
innerWireType := int(innerWire & 0x7) |
| 319 |
if innerWireType == 4 { |
| 320 |
break |
| 321 |
} |
| 322 |
next, err := skipStatus(dAtA[start:]) |
| 323 |
if err != nil { |
| 324 |
return 0, err |
| 325 |
} |
| 326 |
iNdEx = start + next |
| 327 |
} |
| 328 |
return iNdEx, nil |
| 329 |
case 4: |
| 330 |
return iNdEx, nil |
| 331 |
case 5: |
| 332 |
iNdEx += 4 |
| 333 |
return iNdEx, nil |
| 334 |
default: |
| 335 |
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) |
| 336 |
} |
| 337 |
} |
| 338 |
panic("unreachable") |
| 339 |
} |
| 340 |
|
| 341 |
var ( |
| 342 |
ErrInvalidLengthStatus = fmt.Errorf("proto: negative length found during unmarshaling") |
| 343 |
ErrIntOverflowStatus = fmt.Errorf("proto: integer overflow") |
| 344 |
) |
| 345 |
|
| 346 |
func init() { proto.RegisterFile("status/status.proto", fileDescriptorStatus) } |
| 347 |
|
| 348 |
var fileDescriptorStatus = []byte{ |
| 349 |
|
| 350 |
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2e, 0x2e, 0x49, 0x2c, |
| 351 |
0x29, 0x2d, 0xd6, 0x87, 0x50, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x6c, 0x10, 0x9e, 0x94, |
| 352 |
0x6e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x7a, 0x7e, 0x7a, 0xbe, |
| 353 |
0x3e, 0x58, 0x3a, 0xa9, 0x34, 0x0d, 0xcc, 0x03, 0x73, 0xc0, 0x2c, 0x88, 0x36, 0x14, 0xe5, 0x99, |
| 354 |
0x79, 0x69, 0x39, 0xa5, 0x15, 0x29, 0x89, 0x25, 0x89, 0xfa, 0x95, 0x89, 0x45, 0x05, 0xc9, 0xfa, |
| 355 |
0xc9, 0xf9, 0x29, 0xa9, 0xc5, 0x10, 0x12, 0xa2, 0x5c, 0xc9, 0x99, 0x8b, 0x2d, 0x18, 0x6c, 0x8f, |
| 356 |
0x90, 0x3c, 0x17, 0x0b, 0x48, 0x42, 0x82, 0x51, 0x81, 0x51, 0x83, 0xcf, 0x88, 0x5b, 0x0f, 0xa2, |
| 357 |
0xca, 0x39, 0x3f, 0x25, 0x35, 0x08, 0x2c, 0x21, 0x24, 0xc1, 0xc5, 0x9e, 0x9b, 0x5a, 0x5c, 0x9c, |
| 358 |
0x98, 0x9e, 0x2a, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0x19, 0x04, 0xe3, 0x3a, 0x09, 0x9c, 0x78, 0x24, |
| 359 |
0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x24, 0xb1, |
| 360 |
0x81, 0x4d, 0x37, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x8c, 0xec, 0x25, 0x86, 0xda, 0x00, 0x00, |
| 361 |
0x00, |
| 362 |
} |