• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang proto.ReplicationPositionToProto函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/youtube/vitess/go/vt/mysqlctl/proto.ReplicationPositionToProto函数的典型用法代码示例。如果您正苦于以下问题:Golang ReplicationPositionToProto函数的具体用法?Golang ReplicationPositionToProto怎么用?Golang ReplicationPositionToProto使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ReplicationPositionToProto函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: StreamTables

func (client *client) StreamTables(req *proto.TablesRequest, responseChan chan *proto.BinlogTransaction) binlogplayer.BinlogPlayerResponse {
	query := &pb.StreamTablesRequest{
		Position: myproto.ReplicationPositionToProto(req.Position),
		Tables:   req.Tables,
		Charset:  mproto.CharsetToProto(req.Charset),
	}

	response := &response{}
	stream, err := client.c.StreamTables(client.ctx, query)
	if err != nil {
		response.err = err
		close(responseChan)
		return response
	}
	go func() {
		for {
			r, err := stream.Recv()
			if err != nil {
				if err != io.EOF {
					response.err = err
				}
				close(responseChan)
				return
			}
			responseChan <- proto.ProtoToBinlogTransaction(r.BinlogTransaction)
		}
	}()
	return response
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:29,代码来源:player.go


示例2: PromoteSlave

func (s *server) PromoteSlave(ctx context.Context, request *pb.PromoteSlaveRequest) (*pb.PromoteSlaveResponse, error) {
	ctx = callinfo.GRPCCallInfo(ctx)
	response := &pb.PromoteSlaveResponse{}
	return response, s.agent.RPCWrapLockAction(ctx, actionnode.TabletActionPromoteSlave, request, response, true, func() error {
		position, err := s.agent.PromoteSlave(ctx)
		if err == nil {
			response.Position = myproto.ReplicationPositionToProto(position)
		}
		return err
	})
}
开发者ID:ImadBouirmane,项目名称:vitess,代码行数:11,代码来源:server.go


示例3: RunBlpUntil

func (s *server) RunBlpUntil(ctx context.Context, request *pb.RunBlpUntilRequest) (*pb.RunBlpUntilResponse, error) {
	ctx = callinfo.GRPCCallInfo(ctx)
	response := &pb.RunBlpUntilResponse{}
	return response, s.agent.RPCWrapLock(ctx, actionnode.TabletActionRunBLPUntil, request, response, true, func() error {
		position, err := s.agent.RunBlpUntil(ctx, blproto.ProtoToBlpPositionList(request.BlpPositions), time.Duration(request.WaitTimeout))
		if err == nil {
			response.Position = myproto.ReplicationPositionToProto(*position)
		}
		return err
	})
}
开发者ID:ImadBouirmane,项目名称:vitess,代码行数:11,代码来源:server.go


示例4: StopSlaveMinimum

func (s *server) StopSlaveMinimum(ctx context.Context, request *pb.StopSlaveMinimumRequest) (*pb.StopSlaveMinimumResponse, error) {
	ctx = callinfo.GRPCCallInfo(ctx)
	response := &pb.StopSlaveMinimumResponse{}
	return response, s.agent.RPCWrapLock(ctx, actionnode.TabletActionStopSlaveMinimum, request, response, true, func() error {
		position, err := s.agent.StopSlaveMinimum(ctx, myproto.ProtoToReplicationPosition(request.Position), time.Duration(request.WaitTimeout))
		if err == nil {
			response.Position = myproto.ReplicationPositionToProto(position)
		}
		return err
	})
}
开发者ID:ImadBouirmane,项目名称:vitess,代码行数:11,代码来源:server.go


示例5: InitSlave

// InitSlave is part of the tmclient.TabletManagerClient interface
func (client *Client) InitSlave(ctx context.Context, tablet *topo.TabletInfo, parent topo.TabletAlias, replicationPosition myproto.ReplicationPosition, timeCreatedNS int64) error {
	cc, c, err := client.dial(ctx, tablet)
	if err != nil {
		return err
	}
	defer cc.Close()
	_, err = c.InitSlave(ctx, &pb.InitSlaveRequest{
		Parent:              topo.TabletAliasToProto(parent),
		ReplicationPosition: myproto.ReplicationPositionToProto(replicationPosition),
		TimeCreatedNs:       timeCreatedNS,
	})
	return err
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:14,代码来源:client.go


示例6: PromoteSlaveWhenCaughtUp

// PromoteSlaveWhenCaughtUp is part of the tmclient.TabletManagerClient interface
func (client *Client) PromoteSlaveWhenCaughtUp(ctx context.Context, tablet *topo.TabletInfo, pos myproto.ReplicationPosition) (myproto.ReplicationPosition, error) {
	cc, c, err := client.dial(ctx, tablet)
	if err != nil {
		return myproto.ReplicationPosition{}, err
	}
	defer cc.Close()
	response, err := c.PromoteSlaveWhenCaughtUp(ctx, &pb.PromoteSlaveWhenCaughtUpRequest{
		Position: myproto.ReplicationPositionToProto(pos),
	})
	if err != nil {
		return myproto.ReplicationPosition{}, err
	}
	return myproto.ProtoToReplicationPosition(response.Position), err
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:15,代码来源:client.go


示例7: PopulateReparentJournal

// PopulateReparentJournal is part of the tmclient.TabletManagerClient interface
func (client *Client) PopulateReparentJournal(ctx context.Context, tablet *topo.TabletInfo, timeCreatedNS int64, actionName string, masterAlias topo.TabletAlias, pos myproto.ReplicationPosition) error {
	cc, c, err := client.dial(ctx, tablet)
	if err != nil {
		return err
	}
	defer cc.Close()
	_, err = c.PopulateReparentJournal(ctx, &pb.PopulateReparentJournalRequest{
		TimeCreatedNs:       timeCreatedNS,
		ActionName:          actionName,
		MasterAlias:         topo.TabletAliasToProto(masterAlias),
		ReplicationPosition: myproto.ReplicationPositionToProto(pos),
	})
	return err
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:15,代码来源:client.go


示例8: StopSlaveMinimum

// StopSlaveMinimum is part of the tmclient.TabletManagerClient interface
func (client *Client) StopSlaveMinimum(ctx context.Context, tablet *topo.TabletInfo, minPos myproto.ReplicationPosition, 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.StopSlaveMinimum(ctx, &pb.StopSlaveMinimumRequest{
		Position:    myproto.ReplicationPositionToProto(minPos),
		WaitTimeout: int64(waitTime),
	})
	if err != nil {
		return myproto.ReplicationPosition{}, err
	}
	return myproto.ProtoToReplicationPosition(response.Position), err
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:16,代码来源:client.go


示例9: BlpPositionToProto

// BlpPositionToProto converts a BlpPosition to a proto3
func BlpPositionToProto(b *BlpPosition) *pbt.BlpPosition {
	return &pbt.BlpPosition{
		Uid:      b.Uid,
		Position: myproto.ReplicationPositionToProto(b.Position),
	}
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:7,代码来源:proto3.go



注:本文中的github.com/youtube/vitess/go/vt/mysqlctl/proto.ReplicationPositionToProto函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang proto.SchemaDefinitionToProto函数代码示例发布时间:2022-05-28
下一篇:
Golang proto.ProtoToReplicationPosition函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap