// NewRestartFrameArgs initializes RestartFrameArgs with the required arguments.
184689
func NewRestartFrameArgs(callFrameID CallFrameID) *RestartFrameArgs {
	args := new(RestartFrameArgs)
	args.CallFrameID = callFrameID
	return args
}
1364039
func NewGetResourceContentArgs(frameID FrameID, url string) *GetResourceContentArgs {
	args := new(GetResourceContentArgs)
	args.FrameID = frameID
	args.URL = url
	return args
}
1150527
func ProjectRestart(p project.APIProject, c *cli.Context) error {
	err := p.Restart(context.Background(), c.Int("timeout"), c.Args()...)
	if err != nil {
		return cli.NewExitError(err.Error(), 1)
	}
	return nil
}
618964
func NewArgs(initialArgs ...KeyValuePair) Args {
	args := Args{fields: map[string]map[string]bool{}}
	for _, arg := range initialArgs {
		args.Add(arg.Key, arg.Value)
	}
	return args
}
1345645
func (c *client) BuildRestart(owner, name string, build int, params map[string]string) (*Build, error) {
	out := new(Build)
	val := mapValues(params)
	uri := fmt.Sprintf(pathBuild, c.addr, owner, name, build)
	if len(params) > 0 {
		uri = uri + "?" + val.Encode()
	}
	err := c.post(uri, nil, out)
	return out, err
}
451979
func NewAddInspectedHeapObjectArgs(heapObjectID HeapSnapshotObjectID) *AddInspectedHeapObjectArgs {
	args := new(AddInspectedHeapObjectArgs)
	args.HeapObjectID = heapObjectID
	return args
}
1338405
func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, error) {
	store := &registry.Store{
		NewFunc:                  func() runtime.Object { return &buildapi.BuildConfig{} },
		NewListFunc:              func() runtime.Object { return &buildapi.BuildConfigList{} },
		DefaultQualifiedResource: build.Resource("buildconfigs"),

		TableConvertor: printerstorage.TableConvertor{TablePrinter: printers.NewTablePrinter().With(printersinternal.AddHandlers)},

		CreateStrategy: buildconfig.GroupStrategy,
		UpdateStrategy: buildconfig.GroupStrategy,
		DeleteStrategy: buildconfig.GroupStrategy,
	}

	options := &generic.StoreOptions{RESTOptions: optsGetter}
	if err := store.CompleteWithOptions(options); err != nil {
		return nil, err
	}

	return &REST{store}, nil
}
1036968
func (container *Container) ResetRestartManager(resetCount bool) {
	if container.restartManager != nil {
		container.restartManager.Cancel()
	}
	if resetCount {
		container.RestartCount = 0
	}
	container.restartManager = nil
}
199355
func NewFrame(primitive Primitive) *Frame {
	box := NewBox()

	f := &Frame{
		Box:       box,
		primitive: primitive,
		top:       1,
		bottom:    1,
		header:    1,
		footer:    1,
		left:      1,
		right:     1,
	}

	f.focus = f

	return f
}
302355
func NewDisposeBrowserContextArgs(browserContextID BrowserContextID) *DisposeBrowserContextArgs {
	args := new(DisposeBrowserContextArgs)
	args.BrowserContextID = browserContextID
	return args
}
1339906
func New(n noder.Noder) (*Frame, error) {
	children, err := n.Children()
	if err != nil {
		return nil, err
	}

	sort.Sort(sort.Reverse(byName(children)))
	return &Frame{
		stack: children,
	}, nil
}
819102
func (s *HlsWebdavSettings) SetRestartDelay(v int64) *HlsWebdavSettings {
	s.RestartDelay = &v
	return s
}
1040894
func NewJSONFramedReader(r io.ReadCloser) io.ReadCloser {
	return &jsonFrameReader{
		r:       r,
		decoder: json.NewDecoder(r),
	}
}
789460
func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, *StatusREST) {
	store := &genericregistry.Store{
		NewFunc:                  func() runtime.Object { return &api.ResourceQuota{} },
		NewListFunc:              func() runtime.Object { return &api.ResourceQuotaList{} },
		DefaultQualifiedResource: api.Resource("resourcequotas"),

		CreateStrategy:      resourcequota.Strategy,
		UpdateStrategy:      resourcequota.Strategy,
		DeleteStrategy:      resourcequota.Strategy,
		ReturnDeletedObject: true,
	}
	options := &generic.StoreOptions{RESTOptions: optsGetter}
	if err := store.CompleteWithOptions(options); err != nil {
		panic(err) // TODO: Propagate error up
	}

	statusStore := *store
	statusStore.UpdateStrategy = resourcequota.StatusStrategy

	return &REST{store}, &StatusREST{store: &statusStore}
}
1292490
func NewUploadSessionAppendArg(Cursor *UploadSessionCursor) *UploadSessionAppendArg {
	s := new(UploadSessionAppendArg)
	s.Cursor = Cursor
	s.Close = false
	return s
}
170376
func (f *Facade) rollingRestart(ctx datastore.Context, svc *service.Service, timeout time.Duration, cancel <-chan interface{}) error {
	logger := plog.WithFields(log.Fields{
		"serviceid":   svc.ID,
		"servicename": svc.Name,
	})

	// Run through and set all instances to "Pending Restart"
	for instanceID := 0; instanceID < svc.Instances; instanceID++ {
		err := f.zzk.UpdateInstanceCurrentState(ctx, svc.PoolID, svc.ID, instanceID, service.StatePendingRestart)
		if err != nil {
			logger.WithError(err).Debug("Failed to update instance current state to pending restart")
			return err
		}
	}

	// Keep track of which instances haven't been restarted yet, so we can revert the current state if we exit
	// prematurely
	nextInstance := 0
	defer func() {
		for instance := nextInstance; instance < svc.Instances; instance++ {
			err := f.zzk.UpdateInstanceCurrentState(ctx, svc.PoolID, svc.ID, instance, service.StateRunning)
			if err != nil {
				logger.WithField("instance", instance).WithError(err).Error("Failed to revert instance current state to started")
			}
		}
	}()

	// Build the service health object to use for getting instance health
	svch := service.BuildServiceHealth(*svc)
	var punctualLock sync.RWMutex
	punctualInstances := 0

	for instanceID := 0; instanceID < svc.Instances; instanceID++ {
		ilogger := logger.WithField("instance", instanceID)
		ilogger.Debug("Restarting instance")

		select {
		case <-cancel:
			return nil
		default:
		}

		// Set up the timeout
		cancelWait := make(chan struct{})
		done := make(chan struct{})
		timer := time.NewTimer(timeout)
		go func() {
			select {
			case <-timer.C:
				ilogger.Warn("Timeout waiting for instance to restart")
			case <-done:
				punctualLock.Lock()
				punctualInstances++
				punctualLock.Unlock()
			case <-cancel:
				ilogger.Debug("Rolling restart cancelled")
			}
			timer.Stop()
			close(cancelWait)
		}()

		// Before we restart, check the current instance's container ID
		state, err := f.zzk.GetServiceState(ctx, svc.PoolID, svc.ID, instanceID)
		if err != nil {
			close(done)
			logger.WithError(err).Debug("Failed to get service's current container ID")
			return err
		}

		oldContainer := state.ContainerID

		if err = f.zzk.RestartInstance(ctx, svc.PoolID, svc.ID, instanceID); err != nil {
			close(done)
			logger.WithError(err).Debug("Failed to restart instance")
			return err
		}

		// Increment nextInstance now, since we have started the restart process for this instance
		nextInstance++

		// Wait for the instance's containerID to change
		checkContainer := func(s *zkservice.State, exists bool) bool {
			if !exists {
				return true
			}
			if s.ContainerID != "" && s.ContainerID != oldContainer {
				return service.InstanceCurrentState(s.Status) == service.StateRunning
			}
			return false
		}
		if err = f.zzk.WaitInstance(ctx, svc, instanceID, checkContainer, cancelWait); err != nil {
			close(done)
			logger.WithError(err).Debug("Failed to wait on instance")
			return err
		}

		// Check if we're ready to move on to the next instance on an interval
		ready := func() bool {
			// I don't care if it is the last instance
			if instanceID == svc.Instances-1 {
				return true
			}

			// Wait for health checks to pass
			statuses := f.getInstanceHealth(svch, instanceID)
			for key, status := range statuses {
				ilogger.WithFields(log.Fields{
					"status": status,
					"key":    key,
				}).Debug("Got health status for instance")
				if status != health.OK {
					return false
				}
			}

			return true
		}

		hctimer := time.NewTimer(500 * time.Millisecond)

		// See if we have timed out
		cancelled := false
		select {
		case <-cancelWait:
			cancelled = true
		default:
		}

		for !cancelled && !ready() {
			ilogger.Debug("Instance not ready yet, checking again in 500 ms")
			select {
			case <-cancelWait:
				cancelled = true
			case <-hctimer.C:
				hctimer.Stop()
				hctimer.Reset(500 * time.Millisecond)
			}
		}
		hctimer.Stop()
		ilogger.Debug("Done restarting instance")
		close(done)
		<-cancelWait
	}

	punctualLock.RLock()
	instances := punctualInstances
	punctualLock.RUnlock()
	if instances == svc.Instances {
		f.SetServicesCurrentState(ctx, service.SVCCSRunning, svc.ID)
	}

	return nil
}
1213866
func NewSetPausedArgs(animations []string, paused bool) *SetPausedArgs {
	args := new(SetPausedArgs)
	args.Animations = animations
	args.Paused = paused
	return args
}