Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeBytes ¶
DecodeBytes decodes bytes which is encoded by EncodeBytes before, returns the leftover bytes and decoded value if no error.
func DecodeInt ¶
DecodeInt decodes value encoded by EncodeInt before. It returns the leftover un-decoded slice, decoded value if no error.
func EncodeInt ¶
EncodeInt appends the encoded value to slice b and returns the appended slice. EncodeInt guarantees that the encoded value is in ascending order for comparison.
func GenerateRowKey ¶
GenerateRowKey generates a row key.
func GenerateTableKey ¶
GenerateTableKey generates a table split key.
Types ¶
type Key ¶
type Key []byte
Key represents high-level Key type.
func EncodeBytes ¶
EncodeBytes guarantees the encoded value is in ascending order for comparison, encoding with the following rule:
[group1][marker1]...[groupN][markerN] group is 8 bytes slice which is padding with 0. marker is `0xFF - padding 0 count`
For example:
[] -> [0, 0, 0, 0, 0, 0, 0, 0, 247] [1, 2, 3] -> [1, 2, 3, 0, 0, 0, 0, 0, 250] [1, 2, 3, 0] -> [1, 2, 3, 0, 0, 0, 0, 0, 251] [1, 2, 3, 4, 5, 6, 7, 8] -> [1, 2, 3, 4, 5, 6, 7, 8, 255, 0, 0, 0, 0, 0, 0, 0, 0, 247]
Refer: https://github.com/facebook/mysql-5.6/wiki/MyRocks-record-format#memcomparable-format
func (Key) MetaOrTable ¶
MetaOrTable checks if the key is a meta key or table key. If the key is a meta key, it returns true and 0. If the key is a table key, it returns false and table ID. Otherwise, it returns false and 0.