Documentation ¶
Overview ¶
Package tikv provides tcp connection to kvserver.
Index ¶
Constants ¶
const ( // NoJitter makes the backoff sequence strict exponential. NoJitter = 1 + iota // FullJitter applies random factors to strict exponential. FullJitter // EqualJitter is also randomized, but prevents very short sleeps. EqualJitter // DecorrJitter increases the maximum jitter based on the last random value. DecorrJitter )
Variables ¶
This section is empty.
Functions ¶
func NewBackoff ¶
NewBackoff creates a backoff func which implements exponential backoff with optional jitters. See: http://www.awsarchitectureblog.com/2015/03/backoff.html
Types ¶
type Client ¶
type Client interface { // Close should release all data. Close() error // SendKVReq sends kv request. SendKVReq(req *kvrpcpb.Request) (*kvrpcpb.Response, error) // SendCopReq sends coprocessor request. SendCopReq(req *coprocessor.Request) (*coprocessor.Response, error) }
Client is a client that sends RPC. It should not be used after calling Close().
func NewRPCClient ¶
NewRPCClient new client that sends protobuf to do RPC.
type CopClient ¶
type CopClient struct {
// contains filtered or unexported fields
}
CopClient is coprocessor client.
func (*CopClient) SupportRequestType ¶
SupportRequestType checks whether reqType is supported.
type Region ¶
type Region struct {
// contains filtered or unexported fields
}
Region store region info. Region is a readonly class.
func (*Region) Contains ¶
Contains checks whether the key is in the region, for the maximum region endKey is empty. startKey <= key < endKey.
func (*Region) GetContext ¶
GetContext construct kvprotopb.Context from region info.
type RegionCache ¶
type RegionCache struct {
// contains filtered or unexported fields
}
RegionCache store region cache by region id.
func NewRegionCache ¶
func NewRegionCache(pdClient pd.Client) *RegionCache
NewRegionCache new region cache.
func (*RegionCache) DropRegion ¶
func (c *RegionCache) DropRegion(regionID uint64)
DropRegion remove some region cache.
func (*RegionCache) GetRegion ¶
func (c *RegionCache) GetRegion(key []byte) (*Region, error)
GetRegion find in cache, or get new region.
func (*RegionCache) NextStore ¶
func (c *RegionCache) NextStore(regionID uint64)
NextStore picks next store as new leader, if out of range of stores delete region.
func (*RegionCache) UpdateLeader ¶
func (c *RegionCache) UpdateLeader(regionID, leaderStoreID uint64)
UpdateLeader update some region cache with newer leader store ID.