client

package
v2.0.0-...-7ffc49f Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Overview

Package client provides tcp connection to kvserver.

Package client provides tcp connection to kvserver.

Package client provides tcp connection to kvserver.

Index

Constants

View Source
const (
	ReadTimeoutShort  = 20 * time.Second // For requests that read/write several key-values.
	ReadTimeoutMedium = 60 * time.Second // For requests that may need scan region.
)

Timeout durations.

View Source
const (
	GrpcInitialWindowSize     = 1 << 30
	GrpcInitialConnWindowSize = 1 << 30
)

Grpc window size

Variables

View Source
var MaxRecvMsgSize = math.MaxInt64

MaxRecvMsgSize set max gRPC receive message size received from server. If any message size is larger than current value, an error will be reported from gRPC.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Close should release all data.
	Close() error
	// SendRequest sends Request.
	SendRequest(ctx context.Context, addr string, req *tikvrpc.Request, timeout time.Duration) (*tikvrpc.Response, error)
}

Client is a client that sends RPC. It should not be used after calling Close().

func NewReqCollapse

func NewReqCollapse(client Client) Client

NewReqCollapse creates a reqCollapse.

func NewTestRPCClient

func NewTestRPCClient(security config.Security) Client

NewTestRPCClient is for some external tests.

type RPCClient

type RPCClient struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

RPCClient is RPC client struct. TODO: Add flow control between RPC clients in TiDB ond RPC servers in TiKV. Since we use shared client connection to communicate to the same TiKV, it's possible that there are too many concurrent requests which overload the service of TiKV.

func NewRPCClient

func NewRPCClient(security config.Security, opts ...func(c *RPCClient)) *RPCClient

NewRPCClient creates a client that manages connections and rpc calls with tikv-servers.

func (*RPCClient) Close

func (c *RPCClient) Close() error

Close closes all connections.

func (*RPCClient) SendRequest

func (c *RPCClient) SendRequest(ctx context.Context, addr string, req *tikvrpc.Request, timeout time.Duration) (*tikvrpc.Response, error)

SendRequest sends a Request to server and receives Response.

Jump to

Keyboard shortcuts

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