本文整理汇总了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
}
示例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
})
}
示例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
})
}
示例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
})
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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),
}
}