Documentation
¶
Index ¶
- func Call(c *Client, args []string) error
- func Delete(ctx *Context) error
- func Get(ctx *Context) error
- func New(flag *fperf.FlagSet) fperf.Client
- func Scan(ctx *Context) error
- func Set(ctx *Context) error
- type Client
- type Codec
- type Command
- type Context
- type Desc
- type RawTiKVClient
- func (c *RawTiKVClient) BatchDelete(keys [][]byte) error
- func (c *RawTiKVClient) BatchGet(keys [][]byte) ([][]byte, error)
- func (c *RawTiKVClient) BatchPut(keys, values [][]byte) error
- func (c *RawTiKVClient) Close() error
- func (c *RawTiKVClient) ClusterID() uint64
- func (c *RawTiKVClient) Delete(key []byte) error
- func (c *RawTiKVClient) Get(key []byte) ([]byte, error)
- func (c *RawTiKVClient) Put(key, val []byte) error
- func (c *RawTiKVClient) Scan(startKey []byte, limit int) ([][]byte, [][]byte, error)
- type TiKVCodec
- type TiKVOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Codec ¶
type Codec interface { EncodeBytes(b []byte, data []byte) []byte DecodeBytes(b []byte, buf []byte) ([]byte, []byte, error) }
Codec encode bytes to be sortable
type RawTiKVClient ¶
type RawTiKVClient struct {
// contains filtered or unexported fields
}
RawTiKVClient is the client of TiKV raw API
func NewRawTiKVClient ¶
func NewRawTiKVClient(addrs string, options ...TiKVOption) (*RawTiKVClient, error)
NewRawTiKVClient creates a TiKV raw client
func (*RawTiKVClient) BatchDelete ¶
func (c *RawTiKVClient) BatchDelete(keys [][]byte) error
BatchDelete deletes key-value pairs from TiKV
func (*RawTiKVClient) BatchGet ¶
func (c *RawTiKVClient) BatchGet(keys [][]byte) ([][]byte, error)
BatchGet queries values with the keys.
func (*RawTiKVClient) BatchPut ¶
func (c *RawTiKVClient) BatchPut(keys, values [][]byte) error
BatchPut stores key-value pairs to TiKV.
func (*RawTiKVClient) ClusterID ¶
func (c *RawTiKVClient) ClusterID() uint64
ClusterID returns the TiKV cluster ID.
func (*RawTiKVClient) Get ¶
func (c *RawTiKVClient) Get(key []byte) ([]byte, error)
Get return the value of the key
func (*RawTiKVClient) Put ¶
func (c *RawTiKVClient) Put(key, val []byte) error
Put a key value pair and return the version of the key
type TiKVCodec ¶
type TiKVCodec struct{}
TiKVCodec implements interface Codec and encodes the key bytes the same as a txn client
func (*TiKVCodec) 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 (*TiKVCodec) 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
type TiKVOption ¶
type TiKVOption func(c *RawTiKVClient)
TiKVOption supplies options when new a TiKV client
func WithCodec ¶
func WithCodec(codec Codec) TiKVOption
WithCodec set a codec to encode or decode keys