Documentation ¶
Index ¶
- Constants
- func DecodeBytes(b []byte, buf []byte) ([]byte, []byte, error)
- func DecodeBytesDesc(b []byte, buf []byte) ([]byte, []byte, error)
- func DecodeCmpUintToInt(u uint64) int64
- func DecodeComparableUvarint(b []byte) ([]byte, uint64, error)
- func DecodeComparableVarint(b []byte) ([]byte, int64, error)
- func DecodeFloat(b []byte) ([]byte, float64, error)
- func DecodeFloatDesc(b []byte) ([]byte, float64, error)
- func DecodeInt(b []byte) ([]byte, int64, error)
- func DecodeIntDesc(b []byte) ([]byte, int64, error)
- func DecodeUint(b []byte) ([]byte, uint64, error)
- func DecodeUintDesc(b []byte) ([]byte, uint64, error)
- func DecodeUvarint(b []byte) ([]byte, uint64, error)
- func DecodeVarint(b []byte) ([]byte, int64, error)
- func EdgeNonUniqueIndexKey(graphID, indexID, srcVertexID, dstVertexID int64) []byte
- func EncodeBytes(b []byte, data []byte) []byte
- func EncodeBytesDesc(b []byte, data []byte) []byte
- func EncodeBytesExt(b []byte, data []byte, isRawKv bool) []byte
- func EncodeComparableUvarint(b []byte, v uint64) []byte
- func EncodeComparableVarint(b []byte, v int64) []byte
- func EncodeFloat(b []byte, v float64) []byte
- func EncodeFloatDesc(b []byte, v float64) []byte
- func EncodeInt(b []byte, v int64) []byte
- func EncodeIntDesc(b []byte, v int64) []byte
- func EncodeIntToCmpUint(v int64) uint64
- func EncodeUint(b []byte, v uint64) []byte
- func EncodeUintDesc(b []byte, v uint64) []byte
- func EncodeUvarint(b []byte, v uint64) []byte
- func EncodeVarint(b []byte, v int64) []byte
- func EncodedBytesLength(dataLen int) int
- func IncomingEdgeKey(graphID, srcVertexID, dstVertexID int64) []byte
- func LabelKey(graphID, labelID, vertexID, dstVertexID int64) []byte
- func LabelValue() []byte
- func OutgoingEdgeKey(graphID, srcVertexID, dstVertexID int64) []byte
- func ParseEdgeNonUniqueIndexKey(key []byte) (graphID, indexID, srcVertexID, dstVertexID int64, err error)
- func ParseIncomingEdgeKey(key []byte) (graphID, srcVertexID, dstVertexID int64, err error)
- func ParseOutgoingEdgeKey(key []byte) (graphID, srcVertexID, dstVertexID int64, err error)
- func ParseUniqueIndexKey(key []byte) (graphID, indexID int64, typ byte, err error)
- func ParseVertexKey(key []byte) (graphID, vertexID int64, err error)
- func ParseVertexNonUniqueIndexKey(key []byte) (graphID, indexID, vertexID int64, err error)
- func UniqueIndexKey(graphID, indexID int64, typ byte) []byte
- func VertexKey(graphID, vertexID int64) []byte
- func VertexNonUniqueIndexKey(graphID, indexID, vertexID int64) []byte
- type PropertyDecoder
- type PropertyEncoder
Constants ¶
const EdgeKeyLen = 1 + 8 + 8 + 1 + 8 /*dstVertexID*/
const VertexKeyLen = 1 + 8 + 8 /*vertexID*/
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. `buf` is used to buffer data to avoid the cost of makeslice in decodeBytes when DecodeBytes is called by Decoder.DecodeOne.
func DecodeBytesDesc ¶
DecodeBytesDesc decodes bytes which is encoded by EncodeBytesDesc before, returns the leftover bytes and decoded value if no error.
func DecodeCmpUintToInt ¶
DecodeCmpUintToInt decodes the u that encoded by EncodeIntToCmpUint
func DecodeComparableUvarint ¶
DecodeComparableUvarint decodes mem-comparable uvarint.
func DecodeComparableVarint ¶
DecodeComparableVarint decodes mem-comparable varint.
func DecodeFloat ¶
DecodeFloat decodes a float from a byte slice generated with EncodeFloat before.
func DecodeFloatDesc ¶
DecodeFloatDesc decodes a float from a byte slice generated with EncodeFloatDesc before.
func DecodeInt ¶
DecodeInt decodes value encoded by EncodeInt before. It returns the leftover un-decoded slice, decoded value if no error.
func DecodeIntDesc ¶
DecodeIntDesc decodes value encoded by EncodeInt before. It returns the leftover un-decoded slice, decoded value if no error.
func DecodeUint ¶
DecodeUint decodes value encoded by EncodeUint before. It returns the leftover un-decoded slice, decoded value if no error.
func DecodeUintDesc ¶
DecodeUintDesc decodes value encoded by EncodeInt before. It returns the leftover un-decoded slice, decoded value if no error.
func DecodeUvarint ¶
DecodeUvarint decodes value encoded by EncodeUvarint before. It returns the leftover un-decoded slice, decoded value if no error.
func DecodeVarint ¶
DecodeVarint decodes value encoded by EncodeVarint before. It returns the leftover un-decoded slice, decoded value if no error.
func EdgeNonUniqueIndexKey ¶
EdgeNonUniqueIndexKey encodes the non-unique index key described as above.
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 EncodeBytesDesc ¶
EncodeBytesDesc first encodes bytes using EncodeBytes, then bitwise reverses encoded value to guarantee the encoded value is in descending order for comparison.
func EncodeBytesExt ¶
EncodeBytesExt is an extension of `EncodeBytes`, which will not encode for `isRawKv = true` but just append `data` to `b`.
func EncodeComparableUvarint ¶
EncodeComparableUvarint encodes uint64 into mem-comparable bytes.
func EncodeComparableVarint ¶
EncodeComparableVarint encodes an int64 to a mem-comparable bytes.
func EncodeFloat ¶
EncodeFloat encodes a float v into a byte slice which can be sorted lexicographically later. EncodeFloat guarantees that the encoded value is in ascending order for comparison.
func EncodeFloatDesc ¶
EncodeFloatDesc encodes a float v into a byte slice which can be sorted lexicographically later. EncodeFloatDesc guarantees that the encoded value is in descending order for comparison.
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 EncodeIntDesc ¶
EncodeIntDesc appends the encoded value to slice b and returns the appended slice. EncodeIntDesc guarantees that the encoded value is in descending order for comparison.
func EncodeIntToCmpUint ¶
EncodeIntToCmpUint make int v to comparable uint type
func EncodeUint ¶
EncodeUint appends the encoded value to slice b and returns the appended slice. EncodeUint guarantees that the encoded value is in ascending order for comparison.
func EncodeUintDesc ¶
EncodeUintDesc appends the encoded value to slice b and returns the appended slice. EncodeUintDesc guarantees that the encoded value is in descending order for comparison.
func EncodeUvarint ¶
EncodeUvarint appends the encoded value to slice b and returns the appended slice. Note that the encoded result is not memcomparable.
func EncodeVarint ¶
EncodeVarint appends the encoded value to slice b and returns the appended slice. Note that the encoded result is not memcomparable.
func EncodedBytesLength ¶
EncodedBytesLength returns the length of data after encoded
func IncomingEdgeKey ¶
IncomingEdgeKey encodes the incoming edge key.
The key format is: ${Prefix}${GraphID}${DstVertexID}${IncomingEdgeSep}${SrcVertexID}.
func LabelValue ¶
func LabelValue() []byte
LabelValue returns a zero which is represents the flag byte of normal value.
func OutgoingEdgeKey ¶
OutgoingEdgeKey encodes the outgoing edge key.
The key format is: ${Prefix}${GraphID}${SrcVertexID}${outgoingEdgeSep}${DstVertexID}.
func ParseEdgeNonUniqueIndexKey ¶
func ParseEdgeNonUniqueIndexKey(key []byte) (graphID, indexID, srcVertexID, dstVertexID int64, err error)
ParseEdgeNonUniqueIndexKey parses the edge non-unique key.
func ParseIncomingEdgeKey ¶
ParseIncomingEdgeKey parse the incoming edge key.
func ParseOutgoingEdgeKey ¶
ParseOutgoingEdgeKey parse the outgoing edge key.
func ParseUniqueIndexKey ¶
ParseUniqueIndexKey parse the unique key.
func ParseVertexKey ¶
ParseVertexKey parses the vertex key.
func ParseVertexNonUniqueIndexKey ¶
ParseVertexNonUniqueIndexKey parses the vertex non-unique key.
func UniqueIndexKey ¶
UniqueIndexKey encodes the unique index key described as above.
func VertexKey ¶
VertexKey encodes the vertex key. The key format is: ${Prefix}${GraphID}${VertexID}.
func VertexNonUniqueIndexKey ¶
VertexNonUniqueIndexKey encodes the non-unique index key described as above.
Types ¶
type PropertyDecoder ¶
type PropertyDecoder struct {
// contains filtered or unexported fields
}
PropertyDecoder is used to decode value bytes into datum
func NewPropertyDecoder ¶
func NewPropertyDecoder(labels []*model.LabelInfo, properties []*model.PropertyInfo) *PropertyDecoder
type PropertyEncoder ¶
type PropertyEncoder struct {
// contains filtered or unexported fields
}
PropertyEncoder is used to encode datums into value bytes.