MCPcopy Create free account
hub / github.com/nutsdb/nutsdb / Size

Method Size

hintfile.go:86–103  ·  view source on GitHub ↗

Size returns the size of the hint entry

()

Source from the content-addressed store, hash-verified

84
85// Size returns the size of the hint entry
86func (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
106func (h *HintEntry) Encode() []byte {

Callers 2

EncodeMethod · 0.95
TestHintEntrySizeFunction · 0.95

Calls 2

UvarintSizeFunction · 0.92
VarintSizeFunction · 0.92

Tested by 1

TestHintEntrySizeFunction · 0.76