| 163 | } |
| 164 | |
| 165 | func (r *Records) isOverflow() (bool, error) { |
| 166 | if r.recordsType == unknownRecords { |
| 167 | if empty, err := r.setTypeFromFields(); err != nil || empty { |
| 168 | return false, err |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | switch r.recordsType { |
| 173 | case unknownRecords: |
| 174 | return false, nil |
| 175 | case legacyRecords: |
| 176 | if r.MsgSet == nil { |
| 177 | return false, nil |
| 178 | } |
| 179 | return r.MsgSet.OverflowMessage, nil |
| 180 | case defaultRecords: |
| 181 | return false, nil |
| 182 | } |
| 183 | return false, fmt.Errorf("unknown records type: %v", r.recordsType) |
| 184 | } |
| 185 | |
| 186 | // partialSize reports the total on-wire size required to fetch the partial |
| 187 | // trailing batch fully. Returns 0 when not partial or when the size is unknown |