Documentation ¶
Index ¶
- Constants
- Variables
- func NewRpcError(err error) error
- type AdminClient
- type ConnTimeout
- func (c *ConnTimeout) Close() error
- func (c *ConnTimeout) Read(p []byte) (n int, err error)
- func (c *ConnTimeout) RemoteAddr() string
- func (c *ConnTimeout) SetReadTimeout(timeout time.Duration)
- func (c *ConnTimeout) SetWriteTimeout(timeout time.Duration)
- func (c *ConnTimeout) Write(p []byte) (n int, err error)
- type DSRpcClient
- func (c *DSRpcClient) Admin(ctx context.Context, in *dspb.AdminRequest) (*dspb.AdminResponse, error)
- func (c *DSRpcClient) ChangeMember(ctx context.Context, request *dspb.ChangeRaftMemberRequest) (*dspb.SchResponse_Header, *dspb.ChangeRaftMemberResponse, error)
- func (c *DSRpcClient) Close()
- func (c *DSRpcClient) CreateRange(ctx context.Context, in *dspb.CreateRangeRequest) (*dspb.SchResponse_Header, *dspb.CreateRangeResponse, error)
- func (c *DSRpcClient) DeleteRange(ctx context.Context, in *dspb.DeleteRangeRequest) (*dspb.SchResponse_Header, *dspb.DeleteRangeResponse, error)
- func (c *DSRpcClient) GetClientId() int64
- func (c *DSRpcClient) GetPeerInfo(ctx context.Context, in *dspb.GetPeerInfoRequest) (*dspb.SchResponse_Header, *dspb.GetPeerInfoResponse, error)
- func (c *DSRpcClient) IsAlive(ctx context.Context) (*dspb.SchResponse_Header, *dspb.IsAliveResponse, error)
- func (c *DSRpcClient) NodeInfo(ctx context.Context) (*dspb.SchResponse_Header, *dspb.NodeInfoResponse, error)
- func (c *DSRpcClient) Send(ctx context.Context, msg *Message) ([]byte, error)
- func (c *DSRpcClient) TransferLeader(ctx context.Context, in *dspb.TransferRangeLeaderRequest) (*dspb.SchResponse_Header, *dspb.TransferRangeLeaderResponse, error)
- type DialFunc
- type List
- type Message
- func (m *Message) Back(err error)
- func (m *Message) GetData() []byte
- func (m *Message) GetFlags() uint8
- func (m *Message) GetFuncId() uint16
- func (m *Message) GetMsgId() uint64
- func (m *Message) GetMsgType() uint16
- func (m *Message) GetProtoType() uint8
- func (m *Message) GetTimeout() uint32
- func (m *Message) SetData(data []byte)
- func (m *Message) SetFlags(flags uint8)
- func (m *Message) SetFuncId(funcId uint16)
- func (m *Message) SetMsgId(msgId uint64)
- func (m *Message) SetMsgType(msgType uint16)
- func (m *Message) SetProtoType(protoType uint8)
- func (m *Message) SetTimeout(timeout uint32)
- type MsgTypeGroup
- type Pool
- type ResourcePool
- type RpcClient
- type RpcError
- type SchClient
- type SchRpcClient
- func (c *SchRpcClient) ChangeMember(ctx context.Context, addr string, r *dspb.ChangeRaftMemberRequest) (err error)
- func (c *SchRpcClient) Close() error
- func (c *SchRpcClient) CreateRange(ctx context.Context, addr string, r *basepb.Range) (err error)
- func (c *SchRpcClient) DeleteRange(ctx context.Context, addr string, rangeId uint64, peerID uint64) (err error)
- func (c *SchRpcClient) GetPeerInfo(addr string, rangeId uint64) (*dspb.GetPeerInfoResponse, error)
- func (c *SchRpcClient) IsAlive(ctx context.Context, addr string) bool
- func (c *SchRpcClient) NodeInfo(ctx context.Context, addr string) (*dspb.NodeInfoResponse, error)
- func (c *SchRpcClient) TransferLeader(ctx context.Context, addr string, rangeId uint64) (err error)
- type WaitList
Constants ¶
View Source
const ( WriteTimeout = 10 * time.Second ReadTimeout = 31 * time.Second HeartbeatInterval = 9 * time.Second ReadTimeoutShort = 20 * time.Second // For requests that read/write several key-values. ReadTimeoutMedium = 60 * time.Second // For requests that may need scan region. ReadTimeoutLong = 150 * time.Second // For requests that may need scan region multiple times. )
View Source
const ( DefaultIdleTimeout = 1200 * time.Second // 128 KB DefaultInitialWindowSize int32 = 1024 * 64 DefaultPoolSize int = 1 // 40 KB DefaultWriteSize = 40960 // 40 KB DefaultReadSize = 40960 )
View Source
const ( LINK_INIT = iota LINK_CONN LINK_CLOSED LINK_BAN_CONN )
View Source
const DefLog = 1
View Source
const (
TempSendQueueLen = 20
)
Variables ¶
View Source
var ( ErrClientClosed = errors.New("client closed") ErrClientBusy = errors.New("client is busy") ErrRequestTimeout = errors.New("request timeout") ErrConnIdleTimeout = errors.New("conn idle timeout") ErrInvalidMessage = errors.New("invalid message") ErrConnClosing = errors.New("the connection is closing") ErrNetworkIO = errors.New("failed with network I/O error") )
Functions ¶
func NewRpcError ¶
Types ¶
type AdminClient ¶
type AdminClient interface { // Close should release all data. Close() error // SetConfig set config SetConfig(addr string, configs []*dspb.ConfigItem) error }
AdminClient admin client
func NewAdminClient ¶
func NewAdminClient(token string, poolSize int) AdminClient
NewAdminClient new admin client
type ConnTimeout ¶
type ConnTimeout struct {
// contains filtered or unexported fields
}
func DialTimeout ¶
func DialTimeout(addr string, timeout time.Duration) (*ConnTimeout, error)
func NewConnTimeout ¶
func NewConnTimeout(conn net.Conn) *ConnTimeout
func (*ConnTimeout) Close ¶
func (c *ConnTimeout) Close() error
func (*ConnTimeout) RemoteAddr ¶
func (c *ConnTimeout) RemoteAddr() string
func (*ConnTimeout) SetReadTimeout ¶
func (c *ConnTimeout) SetReadTimeout(timeout time.Duration)
func (*ConnTimeout) SetWriteTimeout ¶
func (c *ConnTimeout) SetWriteTimeout(timeout time.Duration)
type DSRpcClient ¶
type DSRpcClient struct {
// contains filtered or unexported fields
}
func NewDSRpcClient ¶
func NewDSRpcClient(addr string, dialFunc DialFunc) *DSRpcClient
func (*DSRpcClient) Admin ¶
func (c *DSRpcClient) Admin(ctx context.Context, in *dspb.AdminRequest) (*dspb.AdminResponse, error)
func (*DSRpcClient) ChangeMember ¶
func (c *DSRpcClient) ChangeMember(ctx context.Context, request *dspb.ChangeRaftMemberRequest) (*dspb.SchResponse_Header, *dspb.ChangeRaftMemberResponse, error)
func (*DSRpcClient) Close ¶
func (c *DSRpcClient) Close()
func (*DSRpcClient) CreateRange ¶
func (c *DSRpcClient) CreateRange(ctx context.Context, in *dspb.CreateRangeRequest) (*dspb.SchResponse_Header, *dspb.CreateRangeResponse, error)
func (*DSRpcClient) DeleteRange ¶
func (c *DSRpcClient) DeleteRange(ctx context.Context, in *dspb.DeleteRangeRequest) (*dspb.SchResponse_Header, *dspb.DeleteRangeResponse, error)
func (*DSRpcClient) GetClientId ¶
func (c *DSRpcClient) GetClientId() int64
func (*DSRpcClient) GetPeerInfo ¶
func (c *DSRpcClient) GetPeerInfo(ctx context.Context, in *dspb.GetPeerInfoRequest) (*dspb.SchResponse_Header, *dspb.GetPeerInfoResponse, error)
func (*DSRpcClient) IsAlive ¶
func (c *DSRpcClient) IsAlive(ctx context.Context) (*dspb.SchResponse_Header, *dspb.IsAliveResponse, error)
func (*DSRpcClient) NodeInfo ¶
func (c *DSRpcClient) NodeInfo(ctx context.Context) (*dspb.SchResponse_Header, *dspb.NodeInfoResponse, error)
func (*DSRpcClient) TransferLeader ¶
func (c *DSRpcClient) TransferLeader(ctx context.Context, in *dspb.TransferRangeLeaderRequest) (*dspb.SchResponse_Header, *dspb.TransferRangeLeaderResponse, error)
type DialFunc ¶
type DialFunc func(addr string) (*ConnTimeout, error)
type List ¶
type List struct {
// contains filtered or unexported fields
}
func (*List) AddElement ¶
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
func (*Message) GetMsgType ¶
func (*Message) GetProtoType ¶
func (*Message) GetTimeout ¶
func (*Message) SetMsgType ¶
func (*Message) SetProtoType ¶
func (*Message) SetTimeout ¶
type MsgTypeGroup ¶
type MsgTypeGroup struct {
// contains filtered or unexported fields
}
func (*MsgTypeGroup) GetRequestMsgType ¶
func (m *MsgTypeGroup) GetRequestMsgType() uint16
func (*MsgTypeGroup) GetResponseMsgType ¶
func (m *MsgTypeGroup) GetResponseMsgType() uint16
type ResourcePool ¶
type ResourcePool struct {
// contains filtered or unexported fields
}
func NewResourcePool ¶
func NewResourcePool(size int) *ResourcePool
func (*ResourcePool) Close ¶
func (rp *ResourcePool) Close()
type RpcClient ¶
type RpcClient interface { // admin CreateRange(ctx context.Context, in *dspb.CreateRangeRequest) (*dspb.SchResponse_Header, *dspb.CreateRangeResponse, error) DeleteRange(ctx context.Context, in *dspb.DeleteRangeRequest) (*dspb.SchResponse_Header, *dspb.DeleteRangeResponse, error) ChangeMember(ctx context.Context, request *dspb.ChangeRaftMemberRequest) (*dspb.SchResponse_Header, *dspb.ChangeRaftMemberResponse, error) TransferLeader(ctx context.Context, in *dspb.TransferRangeLeaderRequest) (*dspb.SchResponse_Header, *dspb.TransferRangeLeaderResponse, error) GetPeerInfo(ctx context.Context, in *dspb.GetPeerInfoRequest) (*dspb.SchResponse_Header, *dspb.GetPeerInfoResponse, error) IsAlive(ctx context.Context) (*dspb.SchResponse_Header, *dspb.IsAliveResponse, error) NodeInfo(ctx context.Context) (*dspb.SchResponse_Header, *dspb.NodeInfoResponse, error) Admin(ctx context.Context, in *dspb.AdminRequest) (*dspb.AdminResponse, error) Close() }
type SchClient ¶
type SchClient interface { // Close should release all data. Close() error // SendKVReq sends kv request. CreateRange(ctx context.Context, addr string, r *basepb.Range) error DeleteRange(ctx context.Context, addr string, rangeId uint64, peerID uint64) error ChangeMember(ctx context.Context, addr string, r *dspb.ChangeRaftMemberRequest) error TransferLeader(ctx context.Context, addr string, rangeId uint64) error GetPeerInfo(addr string, rangeId uint64) (*dspb.GetPeerInfoResponse, error) IsAlive(ctx context.Context, addr string) bool NodeInfo(ctx context.Context, addr string) (*dspb.NodeInfoResponse, error) }
Client is a client that sends RPC. It should not be used after calling Close().
func NewSchRPCClient ¶
type SchRpcClient ¶
type SchRpcClient struct {
// contains filtered or unexported fields
}
func (*SchRpcClient) ChangeMember ¶
func (c *SchRpcClient) ChangeMember(ctx context.Context, addr string, r *dspb.ChangeRaftMemberRequest) (err error)
func (*SchRpcClient) Close ¶
func (c *SchRpcClient) Close() error
func (*SchRpcClient) CreateRange ¶
func (*SchRpcClient) DeleteRange ¶
func (*SchRpcClient) GetPeerInfo ¶
func (c *SchRpcClient) GetPeerInfo(addr string, rangeId uint64) (*dspb.GetPeerInfoResponse, error)
func (*SchRpcClient) IsAlive ¶
func (c *SchRpcClient) IsAlive(ctx context.Context, addr string) bool
func (*SchRpcClient) NodeInfo ¶
func (c *SchRpcClient) NodeInfo(ctx context.Context, addr string) (*dspb.NodeInfoResponse, error)
func (*SchRpcClient) TransferLeader ¶
type WaitList ¶
type WaitList struct {
// contains filtered or unexported fields
}
func NewWaitList ¶
func (*WaitList) AddElement ¶
Click to show internal directories.
Click to hide internal directories.