本文整理匯總了Golang中github.com/youtube/vitess/go/vt/proto/tabletmanagerservice.TabletManager_BackupServer.Context方法的典型用法代碼示例。如果您正苦於以下問題:Golang TabletManager_BackupServer.Context方法的具體用法?Golang TabletManager_BackupServer.Context怎麽用?Golang TabletManager_BackupServer.Context使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/youtube/vitess/go/vt/proto/tabletmanagerservice.TabletManager_BackupServer
的用法示例。
在下文中一共展示了TabletManager_BackupServer.Context方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Backup
func (s *server) Backup(request *tabletmanagerdatapb.BackupRequest, stream tabletmanagerservicepb.TabletManager_BackupServer) error {
ctx := callinfo.GRPCCallInfo(stream.Context())
return s.agent.RPCWrapLockAction(ctx, actionnode.TabletActionBackup, request, nil, true, func() error {
// create a logger, send the result back to the caller
logger := logutil.NewChannelLogger(10)
wg := sync.WaitGroup{}
wg.Add(1)
go func() {
for e := range logger {
// Note we don't interrupt the loop here, as
// we still need to flush and finish the
// command, even if the channel to the client
// has been broken. We'll just keep trying
// to send.
stream.Send(&tabletmanagerdatapb.BackupResponse{
Event: logutil.LoggerEventToProto(&e),
})
}
wg.Done()
}()
err := s.agent.Backup(ctx, int(request.Concurrency), logger)
close(logger)
wg.Wait()
return err
})
}
示例2: Backup
func (s *server) Backup(request *tabletmanagerdatapb.BackupRequest, stream tabletmanagerservicepb.TabletManager_BackupServer) error {
ctx := callinfo.GRPCCallInfo(stream.Context())
return s.agent.RPCWrapLockAction(ctx, tabletmanager.TabletActionBackup, request, nil, true, func() error {
// create a logger, send the result back to the caller
logger := logutil.NewCallbackLogger(func(e *logutilpb.Event) {
// If the client disconnects, we will just fail
// to send the log events, but won't interrupt
// the backup.
stream.Send(&tabletmanagerdatapb.BackupResponse{
Event: e,
})
})
return s.agent.Backup(ctx, int(request.Concurrency), logger)
})
}
示例3: Backup
func (s *server) Backup(request *tabletmanagerdatapb.BackupRequest, stream tabletmanagerservicepb.TabletManager_BackupServer) (err error) {
ctx := stream.Context()
defer s.agent.HandleRPCPanic(ctx, "Backup", request, nil, true /*verbose*/, &err)
ctx = callinfo.GRPCCallInfo(ctx)
// create a logger, send the result back to the caller
logger := logutil.NewCallbackLogger(func(e *logutilpb.Event) {
// If the client disconnects, we will just fail
// to send the log events, but won't interrupt
// the backup.
stream.Send(&tabletmanagerdatapb.BackupResponse{
Event: e,
})
})
return s.agent.Backup(ctx, int(request.Concurrency), logger)
}