MCPcopy
hub / github.com/pingcap/tidb / DecodeRowKey

Function DecodeRowKey

pkg/tablecodec/tablecodec.go:330–339  ·  view source on GitHub ↗

DecodeRowKey decodes the key and gets the handle.

(key kv.Key)

Source from the content-addressed store, hash-verified

328
329// DecodeRowKey decodes the key and gets the handle.
330func DecodeRowKey(key kv.Key) (kv.Handle, error) {
331 if len(key) < RecordRowKeyLen || !hasTablePrefix(key) || !hasRecordPrefixSep(key[prefixLen-2:]) {
332 return kv.IntHandle(0), errInvalidKey.GenWithStack("invalid key - %q", key)
333 }
334 if len(key) == RecordRowKeyLen {
335 u := binary.BigEndian.Uint64(key[prefixLen:])
336 return kv.IntHandle(codec.DecodeCmpUintToInt(u)), nil
337 }
338 return kv.NewCommonHandle(key[prefixLen:])
339}
340
341// EncodeValue encodes a go value to bytes.
342// This function may return both a valid encoded bytes and an error (actually `"pingcap/errors".ErrorGroup`). If the caller

Callers 15

decodeBytesToTimeMethod · 0.92
handleMethod · 0.92
ProcessMethod · 0.92
ProcessMethod · 0.92
tableScanProcessCoreMethod · 0.92
getRowFromPointMethod · 0.92
getRowFromRangeMethod · 0.92
checkHandleConsistencyFunction · 0.92
seekFunction · 0.92
TestRowKeyCodecFunction · 0.92
IterRecordsFunction · 0.92
replaceRowMethod · 0.92

Calls 5

IntHandleTypeAlias · 0.92
DecodeCmpUintToIntFunction · 0.92
NewCommonHandleFunction · 0.92
hasTablePrefixFunction · 0.85
hasRecordPrefixSepFunction · 0.85

Tested by 6

seekFunction · 0.74
TestRowKeyCodecFunction · 0.74
seekFunction · 0.74
TestTableCodecFunction · 0.68
TestTableCodecInvalidFunction · 0.68
BenchmarkDecodeRowKeyFunction · 0.68