File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ func (rb RecordBatch) Encode(pe *encoder.Encoder) {
58
58
for i , record := range rb .Records {
59
59
record .OffsetDelta = int32 (i ) // Offset Deltas are consecutive numerals from 0 to N-1
60
60
// We can set them programmatically as we know the order of the records
61
- record .Encode (pe )
61
+ record .EncodeFull (pe )
62
62
}
63
63
64
64
batchLength := pe .Offset () - 12 - startOffset // 8 bytes for BaseOffset & 4 bytes for BatchLength
@@ -219,11 +219,13 @@ type Record struct {
219
219
Headers []RecordHeader
220
220
}
221
221
222
- func (r Record ) Encode (pe * encoder.Encoder ) {
223
- pe .PutVarint (int64 (utils .GetEncodedLength (r ))) // Length placeholder
222
+ func (r Record ) EncodeFull (pe * encoder.Encoder ) {
223
+ pe .PutVarint (int64 (utils .GetEncodedLength (r ))) // Length
224
224
// As this is variable length, we can't use placeholders and update later reliably.
225
- // We need to have a value, close to the actual value, such that it takes the same space
226
- // This is an approx value, the actual value will be computed at the end
225
+ r .Encode (pe )
226
+ }
227
+
228
+ func (r Record ) Encode (pe * encoder.Encoder ) {
227
229
pe .PutInt8 (r .Attributes )
228
230
pe .PutVarint (r .TimestampDelta )
229
231
pe .PutVarint (int64 (r .OffsetDelta ))
You can’t perform that action at this time.
0 commit comments