Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // SendRequest sends Request SendRequest(ctx context.Context, req *Request, timeout time.Duration) (*Response, error) // Close closes client and releases all data Close() error }
Client is a client that sends RPC. It should not be used after calling Close().
type CmdType ¶
type CmdType uint16
CmdType represents the concrete request type in Request or response type in Response.
const ( CmdStartSubTask CmdType = 1 + iota CmdOperateSubTask CmdUpdateSubTask CmdQueryStatus CmdQueryError CmdQueryTaskOperation CmdQueryWorkerConfig CmdSwitchRelayMaster CmdOperateRelay CmdPurgeRelay CmdUpdateRelay CmdMigrateRelay CmdFetchDDLInfo CmdOperateSchema CmdOperateV1Meta CmdHandleError CmdGetWorkerCfg CmdCheckSubtasksCanUpdate CmdGetValidationStatus CmdGetValidationError CmdOperateValidationError CmdUpdateValidation )
CmdType values.
type GRPCClient ¶
type GRPCClient struct {
// contains filtered or unexported fields
}
GRPCClient stores raw grpc connection and worker client.
func NewGRPCClient ¶
func NewGRPCClient(addr string, securityCfg security.Security) (*GRPCClient, error)
NewGRPCClient initializes a new grpc client from worker address.
func NewGRPCClientWrap ¶
func NewGRPCClientWrap(conn *grpc.ClientConn, client pb.WorkerClient) (*GRPCClient, error)
NewGRPCClientWrap initializes a new grpc client from given grpc connection and worker client.
func (*GRPCClient) Closed ¶
func (c *GRPCClient) Closed() bool
Closed returns whether this grpc conn is closed. only used for test now.
func (*GRPCClient) SendRequest ¶
func (c *GRPCClient) SendRequest(ctx context.Context, req *Request, timeout time.Duration) (*Response, error)
SendRequest implements Client.SendRequest.
type Request ¶
type Request struct { Type CmdType QueryStatus *pb.QueryStatusRequest PurgeRelay *pb.PurgeRelayRequest OperateSchema *pb.OperateWorkerSchemaRequest OperateV1Meta *pb.OperateV1MetaRequest HandleError *pb.HandleWorkerErrorRequest GetWorkerCfg *pb.GetWorkerCfgRequest CheckSubtasksCanUpdate *pb.CheckSubtasksCanUpdateRequest GetValidationStatus *pb.GetValidationStatusRequest GetValidationError *pb.GetValidationErrorRequest OperateValidationError *pb.OperateValidationErrorRequest UpdateValidation *pb.UpdateValidationWorkerRequest }
Request wraps all dm-worker rpc requests.
func (*Request) IsStreamAPI ¶
IsStreamAPI checks whether a request is streaming API based on CmdType.
type Response ¶
type Response struct { Type CmdType QueryStatus *pb.QueryStatusResponse PurgeRelay *pb.CommonWorkerResponse OperateSchema *pb.CommonWorkerResponse OperateV1Meta *pb.OperateV1MetaResponse HandleError *pb.CommonWorkerResponse GetWorkerCfg *pb.GetWorkerCfgResponse CheckSubtasksCanUpdate *pb.CheckSubtasksCanUpdateResponse GetValidationStatus *pb.GetValidationStatusResponse GetValidationError *pb.GetValidationErrorResponse OperateValidationError *pb.OperateValidationErrorResponse UpdateValidation *pb.CommonWorkerResponse }
Response wraps all dm-worker rpc responses.