File
Blob: spec/protocol/node_vtproto.pb.go
| 1 | // Code generated by protoc-gen-go-vtproto. DO NOT EDIT. |
| 2 | // protoc-gen-go-vtproto version: v0.6.0 |
| 3 | // source: spec/proto/node.proto |
| 4 | |
| 5 | package protocol |
| 6 | |
| 7 | import ( |
| 8 | fmt "fmt" |
| 9 | protohelpers "github.com/planetscale/vtprotobuf/protohelpers" |
| 10 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" |
| 11 | io "io" |
| 12 | ) |
| 13 | |
| 14 | const ( |
| 15 | // Verify that this generated code is sufficiently up-to-date. |
| 16 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) |
| 17 | // Verify that runtime/protoimpl is sufficiently up-to-date. |
| 18 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) |
| 19 | ) |
| 20 | |
| 21 | func (m *Node) MarshalVT() (dAtA []byte, err error) { |
| 22 | if m == nil { |
| 23 | return nil, nil |
| 24 | } |
| 25 | size := m.SizeVT() |
| 26 | dAtA = make([]byte, size) |
| 27 | n, err := m.MarshalToSizedBufferVT(dAtA[:size]) |
| 28 | if err != nil { |
| 29 | return nil, err |
| 30 | } |
| 31 | return dAtA[:n], nil |
| 32 | } |
| 33 | |
| 34 | func (m *Node) MarshalToVT(dAtA []byte) (int, error) { |
| 35 | size := m.SizeVT() |
| 36 | return m.MarshalToSizedBufferVT(dAtA[:size]) |
| 37 | } |
| 38 | |
| 39 | func (m *Node) MarshalToSizedBufferVT(dAtA []byte) (int, error) { |
| 40 | if m == nil { |
| 41 | return 0, nil |
| 42 | } |
| 43 | i := len(dAtA) |
| 44 | _ = i |
| 45 | var l int |
| 46 | _ = l |
| 47 | if m.unknownFields != nil { |
| 48 | i -= len(m.unknownFields) |
| 49 | copy(dAtA[i:], m.unknownFields) |
| 50 | } |
| 51 | if m.Rendezvous { |
| 52 | i-- |
| 53 | if m.Rendezvous { |
| 54 | dAtA[i] = 1 |
| 55 | } else { |
| 56 | dAtA[i] = 0 |
| 57 | } |
| 58 | i-- |
| 59 | dAtA[i] = 0x20 |
| 60 | } |
| 61 | if m.Unknown { |
| 62 | i-- |
| 63 | if m.Unknown { |
| 64 | dAtA[i] = 1 |
| 65 | } else { |
| 66 | dAtA[i] = 0 |
| 67 | } |
| 68 | i-- |
| 69 | dAtA[i] = 0x18 |
| 70 | } |
| 71 | if len(m.Address) > 0 { |
| 72 | i -= len(m.Address) |
| 73 | copy(dAtA[i:], m.Address) |
| 74 | i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Address))) |
| 75 | i-- |
| 76 | dAtA[i] = 0x12 |
| 77 | } |
| 78 | if m.Id != 0 { |
| 79 | i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Id)) |
| 80 | i-- |
| 81 | dAtA[i] = 0x8 |
| 82 | } |
| 83 | return len(dAtA) - i, nil |
| 84 | } |
| 85 | |
| 86 | func (m *Node) SizeVT() (n int) { |
| 87 | if m == nil { |
| 88 | return 0 |
| 89 | } |
| 90 | var l int |
| 91 | _ = l |
| 92 | if m.Id != 0 { |
| 93 | n += 1 + protohelpers.SizeOfVarint(uint64(m.Id)) |
| 94 | } |
| 95 | l = len(m.Address) |
| 96 | if l > 0 { |
| 97 | n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) |
| 98 | } |
| 99 | if m.Unknown { |
| 100 | n += 2 |
| 101 | } |
| 102 | if m.Rendezvous { |
| 103 | n += 2 |
| 104 | } |
| 105 | n += len(m.unknownFields) |
| 106 | return n |
| 107 | } |
| 108 | |
| 109 | func (m *Node) UnmarshalVT(dAtA []byte) error { |
| 110 | l := len(dAtA) |
| 111 | iNdEx := 0 |
| 112 | for iNdEx < l { |
| 113 | preIndex := iNdEx |
| 114 | var wire uint64 |
| 115 | for shift := uint(0); ; shift += 7 { |
| 116 | if shift >= 64 { |
| 117 | return protohelpers.ErrIntOverflow |
| 118 | } |
| 119 | if iNdEx >= l { |
| 120 | return io.ErrUnexpectedEOF |
| 121 | } |
| 122 | b := dAtA[iNdEx] |
| 123 | iNdEx++ |
| 124 | wire |= uint64(b&0x7F) << shift |
| 125 | if b < 0x80 { |
| 126 | break |
| 127 | } |
| 128 | } |
| 129 | fieldNum := int32(wire >> 3) |
| 130 | wireType := int(wire & 0x7) |
| 131 | if wireType == 4 { |
| 132 | return fmt.Errorf("proto: Node: wiretype end group for non-group") |
| 133 | } |
| 134 | if fieldNum <= 0 { |
| 135 | return fmt.Errorf("proto: Node: illegal tag %d (wire type %d)", fieldNum, wire) |
| 136 | } |
| 137 | switch fieldNum { |
| 138 | case 1: |
| 139 | if wireType != 0 { |
| 140 | return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) |
| 141 | } |
| 142 | m.Id = 0 |
| 143 | for shift := uint(0); ; shift += 7 { |
| 144 | if shift >= 64 { |
| 145 | return protohelpers.ErrIntOverflow |
| 146 | } |
| 147 | if iNdEx >= l { |
| 148 | return io.ErrUnexpectedEOF |
| 149 | } |
| 150 | b := dAtA[iNdEx] |
| 151 | iNdEx++ |
| 152 | m.Id |= uint64(b&0x7F) << shift |
| 153 | if b < 0x80 { |
| 154 | break |
| 155 | } |
| 156 | } |
| 157 | case 2: |
| 158 | if wireType != 2 { |
| 159 | return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) |
| 160 | } |
| 161 | var stringLen uint64 |
| 162 | for shift := uint(0); ; shift += 7 { |
| 163 | if shift >= 64 { |
| 164 | return protohelpers.ErrIntOverflow |
| 165 | } |
| 166 | if iNdEx >= l { |
| 167 | return io.ErrUnexpectedEOF |
| 168 | } |
| 169 | b := dAtA[iNdEx] |
| 170 | iNdEx++ |
| 171 | stringLen |= uint64(b&0x7F) << shift |
| 172 | if b < 0x80 { |
| 173 | break |
| 174 | } |
| 175 | } |
| 176 | intStringLen := int(stringLen) |
| 177 | if intStringLen < 0 { |
| 178 | return protohelpers.ErrInvalidLength |
| 179 | } |
| 180 | postIndex := iNdEx + intStringLen |
| 181 | if postIndex < 0 { |
| 182 | return protohelpers.ErrInvalidLength |
| 183 | } |
| 184 | if postIndex > l { |
| 185 | return io.ErrUnexpectedEOF |
| 186 | } |
| 187 | m.Address = string(dAtA[iNdEx:postIndex]) |
| 188 | iNdEx = postIndex |
| 189 | case 3: |
| 190 | if wireType != 0 { |
| 191 | return fmt.Errorf("proto: wrong wireType = %d for field Unknown", wireType) |
| 192 | } |
| 193 | var v int |
| 194 | for shift := uint(0); ; shift += 7 { |
| 195 | if shift >= 64 { |
| 196 | return protohelpers.ErrIntOverflow |
| 197 | } |
| 198 | if iNdEx >= l { |
| 199 | return io.ErrUnexpectedEOF |
| 200 | } |
| 201 | b := dAtA[iNdEx] |
| 202 | iNdEx++ |
| 203 | v |= int(b&0x7F) << shift |
| 204 | if b < 0x80 { |
| 205 | break |
| 206 | } |
| 207 | } |
| 208 | m.Unknown = bool(v != 0) |
| 209 | case 4: |
| 210 | if wireType != 0 { |
| 211 | return fmt.Errorf("proto: wrong wireType = %d for field Rendezvous", wireType) |
| 212 | } |
| 213 | var v int |
| 214 | for shift := uint(0); ; shift += 7 { |
| 215 | if shift >= 64 { |
| 216 | return protohelpers.ErrIntOverflow |
| 217 | } |
| 218 | if iNdEx >= l { |
| 219 | return io.ErrUnexpectedEOF |
| 220 | } |
| 221 | b := dAtA[iNdEx] |
| 222 | iNdEx++ |
| 223 | v |= int(b&0x7F) << shift |
| 224 | if b < 0x80 { |
| 225 | break |
| 226 | } |
| 227 | } |
| 228 | m.Rendezvous = bool(v != 0) |
| 229 | default: |
| 230 | iNdEx = preIndex |
| 231 | skippy, err := protohelpers.Skip(dAtA[iNdEx:]) |
| 232 | if err != nil { |
| 233 | return err |
| 234 | } |
| 235 | if (skippy < 0) || (iNdEx+skippy) < 0 { |
| 236 | return protohelpers.ErrInvalidLength |
| 237 | } |
| 238 | if (iNdEx + skippy) > l { |
| 239 | return io.ErrUnexpectedEOF |
| 240 | } |
| 241 | m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) |
| 242 | iNdEx += skippy |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | if iNdEx > l { |
| 247 | return io.ErrUnexpectedEOF |
| 248 | } |
| 249 | return nil |
| 250 | } |