proxy

package
v0.0.0-...-5ef6752 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClientNotFound = errors.New("client not found")
	ErrTxnNotFound    = errors.New("txn not found")
	ErrIterNotFound   = errors.New("iterator not found")
)

Proxy errors. Use errors.Cause() to determine error type.

Functions

This section is empty.

Types

type RawKVProxy

type RawKVProxy struct {
	// contains filtered or unexported fields
}

RawKVProxy implements proxy to use rawkv API. It is safe to copy by value or access concurrently.

func NewRaw

func NewRaw() RawKVProxy

NewRaw creates a RawKVProxy instance.

func (RawKVProxy) BatchDelete

func (p RawKVProxy) BatchDelete(id UUID, keys [][]byte) error

BatchDelete deletes key-value pairs from TiKV.

func (RawKVProxy) BatchGet

func (p RawKVProxy) BatchGet(id UUID, keys [][]byte) ([][]byte, error)

BatchGet queries values with the keys.

func (RawKVProxy) BatchPut

func (p RawKVProxy) BatchPut(id UUID, keys, values [][]byte) error

BatchPut stores key-value pairs to TiKV.

func (RawKVProxy) Close

func (p RawKVProxy) Close(id UUID) error

Close releases a rawkv client.

func (RawKVProxy) Delete

func (p RawKVProxy) Delete(id UUID, key []byte) error

Delete deletes a key-value pair from TiKV.

func (RawKVProxy) DeleteRange

func (p RawKVProxy) DeleteRange(id UUID, startKey []byte, endKey []byte) error

DeleteRange deletes all key-value pairs in a range from TiKV.

func (RawKVProxy) Get

func (p RawKVProxy) Get(id UUID, key []byte) ([]byte, error)

Get queries value with the key.

func (RawKVProxy) New

func (p RawKVProxy) New(pdAddrs []string, conf config.Config) (UUID, error)

New creates a new client and returns the client's UUID.

func (RawKVProxy) Put

func (p RawKVProxy) Put(id UUID, key, value []byte) error

Put stores a key-value pair to TiKV.

func (RawKVProxy) ReverseScan

func (p RawKVProxy) ReverseScan(id UUID, startKey, endKey []byte, limit int) ([][]byte, [][]byte, error)

ReverseScan queries continuous kv pairs in range [endKey, startKey), up to limit pairs. Direction is different from Scan, upper to lower.

func (RawKVProxy) Scan

func (p RawKVProxy) Scan(id UUID, startKey, endKey []byte, limit int) ([][]byte, [][]byte, error)

Scan queries continuous kv pairs in range [startKey, endKey), up to limit pairs.

type TxnKVProxy

type TxnKVProxy struct {
	// contains filtered or unexported fields
}

TxnKVProxy implements proxy to use txnkv API. It is safe to copy by value or access concurrently.

func NewTxn

func NewTxn() TxnKVProxy

NewTxn creates a TxnKVProxy instance.

func (TxnKVProxy) Begin

func (p TxnKVProxy) Begin(id UUID) (UUID, error)

Begin starts a new transaction and returns its UUID.

func (TxnKVProxy) BeginWithTS

func (p TxnKVProxy) BeginWithTS(id UUID, ts uint64) (UUID, error)

BeginWithTS starts a new transaction with given ts and returns its UUID.

func (TxnKVProxy) Close

func (p TxnKVProxy) Close(id UUID) error

Close releases a txnkv client.

func (TxnKVProxy) GetTS

func (p TxnKVProxy) GetTS(id UUID) (uint64, error)

GetTS returns a latest timestamp.

func (TxnKVProxy) IterClose

func (p TxnKVProxy) IterClose(id UUID) error

IterClose releases an iterator.

func (TxnKVProxy) IterKey

func (p TxnKVProxy) IterKey(id UUID) ([]byte, error)

IterKey returns the key which the iterator points to.

func (TxnKVProxy) IterNext

func (p TxnKVProxy) IterNext(id UUID) error

IterNext moves the iterator to next entry.

func (TxnKVProxy) IterValid

func (p TxnKVProxy) IterValid(id UUID) (bool, error)

IterValid returns if the iterator is valid to use.

func (TxnKVProxy) IterValue

func (p TxnKVProxy) IterValue(id UUID) ([]byte, error)

IterValue returns the value which the iterator points to.

func (TxnKVProxy) New

func (p TxnKVProxy) New(pdAddrs []string, conf config.Config) (UUID, error)

New creates a new client and returns the client's UUID.

func (TxnKVProxy) TxnBatchGet

func (p TxnKVProxy) TxnBatchGet(id UUID, keys [][]byte) (map[string][]byte, error)

TxnBatchGet gets a batch of values from TiKV server.

func (TxnKVProxy) TxnCommit

func (p TxnKVProxy) TxnCommit(id UUID) error

TxnCommit commits the transaction operations to TiKV server.

func (TxnKVProxy) TxnDelete

func (p TxnKVProxy) TxnDelete(id UUID, key []byte) error

TxnDelete removes the entry for key from TiKV server.

func (TxnKVProxy) TxnGet

func (p TxnKVProxy) TxnGet(id UUID, key []byte) ([]byte, error)

TxnGet queries value for the given key from TiKV server.

func (TxnKVProxy) TxnIsReadOnly

func (p TxnKVProxy) TxnIsReadOnly(id UUID) (bool, error)

TxnIsReadOnly returns if there are pending key-value to commit in the transaction.

func (TxnKVProxy) TxnIter

func (p TxnKVProxy) TxnIter(id UUID, key []byte, upperBound []byte) (UUID, error)

TxnIter creates an Iterator positioned on the first entry that key <= entry's key and returns the Iterator's UUID.

func (TxnKVProxy) TxnIterReverse

func (p TxnKVProxy) TxnIterReverse(id UUID, key []byte) (UUID, error)

TxnIterReverse creates a reversed Iterator positioned on the first entry which key is less than key and returns the Iterator's UUID.

func (TxnKVProxy) TxnLen

func (p TxnKVProxy) TxnLen(id UUID) (int, error)

TxnLen returns the count of key-value pairs in the transaction's memory buffer.

func (TxnKVProxy) TxnLockKeys

func (p TxnKVProxy) TxnLockKeys(id UUID, keys [][]byte) error

TxnLockKeys tries to lock the entries with the keys in TiKV server.

func (TxnKVProxy) TxnRollback

func (p TxnKVProxy) TxnRollback(id UUID) error

TxnRollback undoes the transaction operations to TiKV server.

func (TxnKVProxy) TxnSet

func (p TxnKVProxy) TxnSet(id UUID, k []byte, v []byte) error

TxnSet sets the value for key k as v into TiKV server.

func (TxnKVProxy) TxnSize

func (p TxnKVProxy) TxnSize(id UUID) (int, error)

TxnSize returns the length (in bytes) of the transaction's memory buffer.

func (TxnKVProxy) TxnValid

func (p TxnKVProxy) TxnValid(id UUID) (bool, error)

TxnValid returns if the transaction is valid.

type UUID

type UUID string

UUID is a global unique ID to identify clients, transactions, or iterators.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL