コード例 #1
0
ファイル: server.go プロジェクト: haoqoo/vitess
func (s *server) StopBlp(ctx context.Context, request *pb.StopBlpRequest) (*pb.StopBlpResponse, error) {
	ctx = callinfo.GRPCCallInfo(ctx)
	response := &pb.StopBlpResponse{}
	return response, s.agent.RPCWrapLock(ctx, actionnode.TabletActionStopBLP, request, response, true, func() error {
		positions, err := s.agent.StopBlp(ctx)
		if err == nil {
			response.BlpPositions = blproto.BlpPositionListToProto(positions)
		}
		return err
	})
}
コード例 #2
0
ファイル: client.go プロジェクト: pranjal5215/vitess
// RunBlpUntil is part of the tmclient.TabletManagerClient interface
func (client *Client) RunBlpUntil(ctx context.Context, tablet *topo.TabletInfo, positions *blproto.BlpPositionList, waitTime time.Duration) (myproto.ReplicationPosition, error) {
	cc, c, err := client.dial(ctx, tablet)
	if err != nil {
		return myproto.ReplicationPosition{}, err
	}
	defer cc.Close()
	response, err := c.RunBlpUntil(ctx, &pb.RunBlpUntilRequest{
		BlpPositions: blproto.BlpPositionListToProto(positions),
		WaitTimeout:  int64(waitTime),
	})
	if err != nil {
		return myproto.ReplicationPosition{}, err
	}
	return myproto.ProtoToReplicationPosition(response.Position), nil
}