MCPcopy
hub / github.com/IBM/sarama / encode

Method encode

create_topics_request.go:182–212  ·  view source on GitHub ↗
(pe packetEncoder)

Source from the content-addressed store, hash-verified

180}
181
182func (t *TopicDetail) encode(pe packetEncoder) error {
183 pe.putInt32(t.NumPartitions)
184 pe.putInt16(t.ReplicationFactor)
185
186 if err := pe.putArrayLength(len(t.ReplicaAssignment)); err != nil {
187 return err
188 }
189 for partition, assignment := range t.ReplicaAssignment {
190 pe.putInt32(partition)
191 if err := pe.putInt32Array(assignment); err != nil {
192 return err
193 }
194 pe.putEmptyTaggedFieldArray()
195 }
196
197 if err := pe.putArrayLength(len(t.ConfigEntries)); err != nil {
198 return err
199 }
200 for configKey, configValue := range t.ConfigEntries {
201 if err := pe.putString(configKey); err != nil {
202 return err
203 }
204 if err := pe.putNullableString(configValue); err != nil {
205 return err
206 }
207 pe.putEmptyTaggedFieldArray()
208 }
209
210 pe.putEmptyTaggedFieldArray()
211 return nil
212}
213
214func (t *TopicDetail) decode(pd packetDecoder, version int16) (err error) {
215 if t.NumPartitions, err = pd.getInt32(); err != nil {

Callers

nothing calls this directly

Calls 7

putInt32Method · 0.65
putInt16Method · 0.65
putArrayLengthMethod · 0.65
putInt32ArrayMethod · 0.65
putStringMethod · 0.65
putNullableStringMethod · 0.65

Tested by

no test coverage detected