Skip to content
File

Blob: spec/protocol/pow_vtproto.pb.go

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