MCPcopy Index your code
hub / github.com/ByteStorage/FlyDB / encodeLogRecordKeyWithSeq

Function encodeLogRecordKeyWithSeq

engine/batch.go:155–169  ·  view source on GitHub ↗

encodeLogRecordKeyWithSeq Key+Seq Number coding

(key []byte, seqNo uint64)

Source from the content-addressed store, hash-verified

153
154// encodeLogRecordKeyWithSeq Key+Seq Number coding
155func encodeLogRecordKeyWithSeq(key []byte, seqNo uint64) []byte {
156 seq := make([]byte, binary.MaxVarintLen64)
157 n := binary.PutUvarint(seq[:], seqNo)
158
159 // Create a byte slice to hold the encoded key
160 encodeKey := make([]byte, n+len(key))
161
162 // Copy the sequence number bytes to the encodeKey slice
163 copy(encodeKey[:n], seq[:n])
164
165 // Copy the original key bytes to the encodeKey slice starting from offset n
166 copy(encodeKey[n:], key)
167
168 return encodeKey
169}
170
171// Parse the LogRecord key to get the actual key and transaction sequence number seq
172func parseLogRecordKeyAndSeq(key []byte) ([]byte, uint64) {

Callers 4

MergeMethod · 0.85
PutMethod · 0.85
DeleteMethod · 0.85
CommitMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected