MCPcopy Create free account
hub / github.com/bytedance/terarkdb / EncodeSize

Function EncodeSize

table/plain_table_key_coding.cc:34–47  ·  view source on GitHub ↗

Return 0 for error

Source from the content-addressed store, hash-verified

32
33// Return 0 for error
34size_t EncodeSize(PlainTableEntryType type, uint32_t key_size,
35 char* out_buffer) {
36 out_buffer[0] = type << 6;
37
38 if (key_size < static_cast<uint32_t>(kSizeInlineLimit)) {
39 // size inlined
40 out_buffer[0] |= static_cast<char>(key_size);
41 return 1;
42 } else {
43 out_buffer[0] |= kSizeInlineLimit;
44 char* ptr = EncodeVarint32(out_buffer + 1, key_size - kSizeInlineLimit);
45 return ptr - out_buffer;
46 }
47}
48} // namespace
49
50// Fill bytes_read with number of bytes read.

Callers 1

AppendKeyMethod · 0.85

Calls 1

EncodeVarint32Function · 0.85

Tested by

no test coverage detected