當前位置: 首頁>>代碼示例>>Golang>>正文


Golang tabletmanagerservice.TabletManager_BackupServer類代碼示例

本文整理匯總了Golang中github.com/youtube/vitess/go/vt/proto/tabletmanagerservice.TabletManager_BackupServer的典型用法代碼示例。如果您正苦於以下問題:Golang TabletManager_BackupServer類的具體用法?Golang TabletManager_BackupServer怎麽用?Golang TabletManager_BackupServer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了TabletManager_BackupServer類的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
	})
}
開發者ID:tjyang,項目名稱:vitess,代碼行數:28,代碼來源:server.go

示例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)
	})
}
開發者ID:jmptrader,項目名稱:vitess,代碼行數:16,代碼來源:server.go

示例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)
}
開發者ID:erzel,項目名稱:vitess,代碼行數:17,代碼來源:server.go


注:本文中的github.com/youtube/vitess/go/vt/proto/tabletmanagerservice.TabletManager_BackupServer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。