Size returns the size of the hint entry
()
| 84 | |
| 85 | // Size returns the size of the hint entry |
| 86 | func (h *HintEntry) Size() int64 { |
| 87 | keySize := len(h.Key) |
| 88 | |
| 89 | size := 0 |
| 90 | size += utils.UvarintSize(h.BucketId) |
| 91 | size += utils.UvarintSize(uint64(keySize)) |
| 92 | size += utils.UvarintSize(uint64(h.ValueSize)) |
| 93 | size += utils.UvarintSize(h.Timestamp) |
| 94 | size += utils.UvarintSize(uint64(h.TTL)) |
| 95 | size += utils.UvarintSize(uint64(h.Flag)) |
| 96 | size += utils.UvarintSize(uint64(h.Status)) |
| 97 | size += utils.UvarintSize(uint64(h.Ds)) |
| 98 | size += utils.UvarintSize(h.DataPos) |
| 99 | size += utils.VarintSize(h.FileID) |
| 100 | size += keySize |
| 101 | |
| 102 | return int64(size) |
| 103 | } |
| 104 | |
| 105 | // Encode encodes the hint entry to bytes |
| 106 | func (h *HintEntry) Encode() []byte { |