(dst []byte, uid uint64, key []byte, p *pb.Posting)
| 84 | } |
| 85 | |
| 86 | func marshalMapEntry(dst []byte, uid uint64, key []byte, p *pb.Posting) { |
| 87 | if p != nil { |
| 88 | uid = p.Uid |
| 89 | } |
| 90 | binary.BigEndian.PutUint64(dst[0:8], uid) |
| 91 | binary.BigEndian.PutUint32(dst[8:12], uint32(len(key))) |
| 92 | |
| 93 | psz := proto.Size(p) |
| 94 | binary.BigEndian.PutUint32(dst[12:16], uint32(psz)) |
| 95 | |
| 96 | n := copy(dst[16:], key) |
| 97 | |
| 98 | if psz > 0 { |
| 99 | pbuf := dst[16+n:] |
| 100 | _, err := x.MarshalToSizedBuffer(pbuf, p) |
| 101 | x.Check(err) |
| 102 | } |
| 103 | |
| 104 | x.AssertTrue(len(dst) == 16+n+psz) |
| 105 | } |
| 106 | |
| 107 | func (me MapEntry) Size() int { |
| 108 | return len(me) |
no test coverage detected