MCPcopy
hub / github.com/dgraph-io/badger / Decode

Method Decode

structs.go:96–107  ·  view source on GitHub ↗

Decode decodes the given header from the provided byte slice. Returns the number of bytes read.

(buf []byte)

Source from the content-addressed store, hash-verified

94// Decode decodes the given header from the provided byte slice.
95// Returns the number of bytes read.
96func (h *header) Decode(buf []byte) int {
97 h.meta, h.userMeta = buf[0], buf[1]
98 index := 2
99 klen, count := binary.Uvarint(buf[index:])
100 h.klen = uint32(klen)
101 index += count
102 vlen, count := binary.Uvarint(buf[index:])
103 h.vlen = uint32(vlen)
104 index += count
105 h.expiresAt, count = binary.Uvarint(buf[index:])
106 return index + count
107}
108
109// DecodeFrom reads the header from the hashReader.
110// Returns the number of bytes read.

Callers 4

decodeEntryMethod · 0.95
ReadMethod · 0.95
doRunGCMethod · 0.45
getValMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected