当前位置: 首页>>代码示例>>Golang>>正文


Golang proto.ProtoToReplicationPosition函数代码示例

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


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

示例1: InitSlave

func (s *server) InitSlave(ctx context.Context, request *pb.InitSlaveRequest) (*pb.InitSlaveResponse, error) {
	ctx = callinfo.GRPCCallInfo(ctx)
	response := &pb.InitSlaveResponse{}
	return response, s.agent.RPCWrapLockAction(ctx, actionnode.TabletActionInitSlave, request, response, true, func() error {
		return s.agent.InitSlave(ctx, topo.ProtoToTabletAlias(request.Parent), myproto.ProtoToReplicationPosition(request.ReplicationPosition), request.TimeCreatedNs)
	})
}
开发者ID:ImadBouirmane,项目名称:vitess,代码行数:7,代码来源:server.go

示例2: StreamUpdate

// StreamUpdate is part of the pbs.UpdateStreamServer interface
func (server *UpdateStream) StreamUpdate(req *pb.StreamUpdateRequest, stream pbs.UpdateStream_StreamUpdateServer) (err error) {
	defer server.updateStream.HandlePanic(&err)
	return server.updateStream.ServeUpdateStream(&proto.UpdateStreamRequest{
		Position: myproto.ProtoToReplicationPosition(req.Position),
	}, func(reply *proto.StreamEvent) error {
		return stream.Send(&pb.StreamUpdateResponse{
			StreamEvent: proto.StreamEventToProto(reply),
		})
	})
}
开发者ID:zhzhy917,项目名称:vitess,代码行数:11,代码来源:streamer.go

示例3: PromoteSlaveWhenCaughtUp

func (s *server) PromoteSlaveWhenCaughtUp(ctx context.Context, request *pb.PromoteSlaveWhenCaughtUpRequest) (*pb.PromoteSlaveWhenCaughtUpResponse, error) {
	ctx = callinfo.GRPCCallInfo(ctx)
	response := &pb.PromoteSlaveWhenCaughtUpResponse{}
	return response, s.agent.RPCWrapLockAction(ctx, actionnode.TabletActionPromoteSlaveWhenCaughtUp, request, response, true, func() error {
		position, err := s.agent.PromoteSlaveWhenCaughtUp(ctx, myproto.ProtoToReplicationPosition(request.Position))
		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: PromoteSlave

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

示例6: StreamTables

// StreamTables is part of the pbs.UpdateStreamServer interface
func (server *UpdateStream) StreamTables(req *pb.StreamTablesRequest, stream pbs.UpdateStream_StreamTablesServer) (err error) {
	defer server.updateStream.HandlePanic(&err)
	return server.updateStream.StreamTables(&proto.TablesRequest{
		Position: myproto.ProtoToReplicationPosition(req.Position),
		Tables:   req.Tables,
		Charset:  mproto.ProtoToCharset(req.Charset),
	}, func(reply *proto.BinlogTransaction) error {
		return stream.Send(&pb.StreamTablesResponse{
			BinlogTransaction: proto.BinlogTransactionToProto(reply),
		})
	})
}
开发者ID:zhzhy917,项目名称:vitess,代码行数:13,代码来源:streamer.go

示例7: StreamKeyRange

// StreamKeyRange is part of the pbs.UpdateStreamServer interface
func (server *UpdateStream) StreamKeyRange(req *pb.StreamKeyRangeRequest, stream pbs.UpdateStream_StreamKeyRangeServer) (err error) {
	defer server.updateStream.HandlePanic(&err)
	return server.updateStream.StreamKeyRange(&proto.KeyRangeRequest{
		Position:       myproto.ProtoToReplicationPosition(req.Position),
		KeyspaceIdType: key.ProtoToKeyspaceIdType(req.KeyspaceIdType),
		KeyRange:       key.ProtoToKeyRange(req.KeyRange),
		Charset:        mproto.ProtoToCharset(req.Charset),
	}, func(reply *proto.BinlogTransaction) error {
		return stream.Send(&pb.StreamKeyRangeResponse{
			BinlogTransaction: proto.BinlogTransactionToProto(reply),
		})
	})
}
开发者ID:zhzhy917,项目名称:vitess,代码行数:14,代码来源:streamer.go

示例8: RunBlpUntil

// 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
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:16,代码来源:client.go

示例9: 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

示例10: ProtoToBlpPosition

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

示例11: PopulateReparentJournal

func (s *server) PopulateReparentJournal(ctx context.Context, request *pb.PopulateReparentJournalRequest) (*pb.PopulateReparentJournalResponse, error) {
	ctx = callinfo.GRPCCallInfo(ctx)
	response := &pb.PopulateReparentJournalResponse{}
	return response, s.agent.RPCWrap(ctx, actionnode.TabletActionPopulateReparentJournal, request, response, func() error {
		return s.agent.PopulateReparentJournal(ctx, request.TimeCreatedNs, request.ActionName, topo.ProtoToTabletAlias(request.MasterAlias), myproto.ProtoToReplicationPosition(request.ReplicationPosition))
	})
}
开发者ID:ImadBouirmane,项目名称:vitess,代码行数:7,代码来源:server.go


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