proxy

package
v0.0.0-...-35bde85 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2019 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 ContextKey

type ContextKey int
var UUIDKey ContextKey = 1

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(ctx context.Context, keys [][]byte) error

BatchDelete deletes key-value pairs from TiKV.

func (RawKVProxy) BatchGet

func (p RawKVProxy) BatchGet(ctx context.Context, keys [][]byte) ([][]byte, error)

BatchGet queries values with the keys.

func (RawKVProxy) BatchPut

func (p RawKVProxy) BatchPut(ctx context.Context, keys, values [][]byte) error

BatchPut stores key-value pairs to TiKV.

func (RawKVProxy) Close

func (p RawKVProxy) Close(ctx context.Context) error

Close releases a rawkv client.

func (RawKVProxy) Delete

func (p RawKVProxy) Delete(ctx context.Context, key []byte) error

Delete deletes a key-value pair from TiKV.

func (RawKVProxy) DeleteRange

func (p RawKVProxy) DeleteRange(ctx context.Context, startKey []byte, endKey []byte) error

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

func (RawKVProxy) Get

func (p RawKVProxy) Get(ctx context.Context, key []byte) ([]byte, error)

Get queries value with the key.

func (RawKVProxy) New

func (p RawKVProxy) New(ctx context.Context, 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(ctx context.Context, key, value []byte) error

Put stores a key-value pair to TiKV.

func (RawKVProxy) ReverseScan

func (p RawKVProxy) ReverseScan(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context) (UUID, error)

Begin starts a new transaction and returns its UUID.

func (TxnKVProxy) BeginWithTS

func (p TxnKVProxy) BeginWithTS(ctx context.Context, ts uint64) (UUID, error)

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

func (TxnKVProxy) Close

func (p TxnKVProxy) Close(ctx context.Context) error

Close releases a txnkv client.

func (TxnKVProxy) GetTS

func (p TxnKVProxy) GetTS(ctx context.Context) (uint64, error)

GetTS returns a latest timestamp.

func (TxnKVProxy) IterClose

func (p TxnKVProxy) IterClose(ctx context.Context) error

IterClose releases an iterator.

func (TxnKVProxy) IterKey

func (p TxnKVProxy) IterKey(ctx context.Context) ([]byte, error)

IterKey returns the key which the iterator points to.

func (TxnKVProxy) IterNext

func (p TxnKVProxy) IterNext(ctx context.Context) error

IterNext moves the iterator to next entry.

func (TxnKVProxy) IterValid

func (p TxnKVProxy) IterValid(ctx context.Context) (bool, error)

IterValid returns if the iterator is valid to use.

func (TxnKVProxy) IterValue

func (p TxnKVProxy) IterValue(ctx context.Context) ([]byte, error)

IterValue returns the value which the iterator points to.

func (TxnKVProxy) New

func (p TxnKVProxy) New(ctx context.Context, 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(ctx context.Context, keys [][]byte) (map[string][]byte, error)

TxnBatchGet gets a batch of values from TiKV server.

func (TxnKVProxy) TxnCommit

func (p TxnKVProxy) TxnCommit(ctx context.Context) error

TxnCommit commits the transaction operations to TiKV server.

func (TxnKVProxy) TxnDelete

func (p TxnKVProxy) TxnDelete(ctx context.Context, key []byte) error

TxnDelete removes the entry for key from TiKV server.

func (TxnKVProxy) TxnGet

func (p TxnKVProxy) TxnGet(ctx context.Context, key []byte) ([]byte, error)

TxnGet queries value for the given key from TiKV server.

func (TxnKVProxy) TxnIsReadOnly

func (p TxnKVProxy) TxnIsReadOnly(ctx context.Context) (bool, error)

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

func (TxnKVProxy) TxnIter

func (p TxnKVProxy) TxnIter(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context) (int, error)

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

func (TxnKVProxy) TxnLockKeys

func (p TxnKVProxy) TxnLockKeys(ctx context.Context, keys [][]byte) error

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

func (TxnKVProxy) TxnRollback

func (p TxnKVProxy) TxnRollback(ctx context.Context) error

TxnRollback undoes the transaction operations to TiKV server.

func (TxnKVProxy) TxnSet

func (p TxnKVProxy) TxnSet(ctx context.Context, k []byte, v []byte) error

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

func (TxnKVProxy) TxnSize

func (p TxnKVProxy) TxnSize(ctx context.Context) (int, error)

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

func (TxnKVProxy) TxnValid

func (p TxnKVProxy) TxnValid(ctx context.Context) (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