// PromoteSlaveWhenCaughtUp is part of the tmclient.TabletManagerClient interface.
973367
func (client *Client) PromoteSlaveWhenCaughtUp(ctx context.Context, tablet *topodatapb.Tablet, pos string) (string, error) {
	cc, c, err := client.dial(tablet)
	if err != nil {
		return "", err
	}
	defer cc.Close()
	response, err := c.PromoteSlaveWhenCaughtUp(ctx, &tabletmanagerdatapb.PromoteSlaveWhenCaughtUpRequest{
		Position: pos,
	})
	if err != nil {
		return "", err
	}
	return response.Position, nil
}
223262
func promoteConstNumbers(x, y ConstType) ConstType {
	switch x.(type) {
	case ConstIntType:
		switch y.(type) {
		case ConstIntType:
			return x
		case ConstRuneType, ConstFloatType, ConstComplexType:
			return y
		}
	case ConstRuneType:
		switch y.(type) {
		case ConstIntType, ConstRuneType:
			return x
		case ConstFloatType, ConstComplexType:
			return y
		}
	case ConstFloatType:
		switch y.(type) {
		case ConstIntType, ConstRuneType, ConstFloatType:
			return x
		case ConstComplexType:
			return y
		}
	case ConstComplexType:
		switch y.(type) {
		case ConstIntType, ConstRuneType, ConstFloatType, ConstComplexType:
			return x
		}
	}
	panic("go-interactive: promoteConstNumbers called with non-numbers")
}
1136950
func (pool *BlockPool) IsCaughtUp() bool {
	pool.mtx.Lock()
	defer pool.mtx.Unlock()

	// Need at least 1 peer to be considered caught up.
	if len(pool.peers) == 0 {
		pool.Logger.Debug("Blockpool has no peers")
		return false
	}

	// Some conditions to determine if we're caught up.
	// Ensures we've either received a block or waited some amount of time,
	// and that we're synced to the highest known height.
	// Note we use maxPeerHeight - 1 because to sync block H requires block H+1
	// to verify the LastCommit.
	receivedBlockOrTimedOut := pool.height > 0 || time.Since(pool.startTime) > 5*time.Second
	ourChainIsLongestAmongPeers := pool.maxPeerHeight == 0 || pool.height >= (pool.maxPeerHeight-1)
	isCaughtUp := receivedBlockOrTimedOut && ourChainIsLongestAmongPeers
	return isCaughtUp
}
992366
func (r *renoState) updateCongestionAvoidance(packetsAcked int) {
	// Consume the packets in congestion avoidance mode.
	r.s.sndCAAckCount += packetsAcked
	if r.s.sndCAAckCount >= r.s.sndCwnd {
		r.s.sndCwnd += r.s.sndCAAckCount / r.s.sndCwnd
		r.s.sndCAAckCount = r.s.sndCAAckCount % r.s.sndCwnd
	}
}
430628
func (v *autoEscapeVisitor) push(name string) {
	v.stack = append(v.stack, name)
}
1126697
func (b *Driver) Up(val int) error {
	b.pcmdMutex.Lock()
	defer b.pcmdMutex.Unlock()

	b.Pcmd.Flag = 1
	b.Pcmd.Gaz = validatePitch(val)
	return nil
}
582931
func (c *Configuration) PromoteBuffer(size uint32) *Configuration {
	c.promoteBuffer = int(size)
	return c
}
691267
func (s *GenericAPIServer) AddPreShutdownHookOrDie(name string, hook PreShutdownHookFunc) {
	if err := s.AddPreShutdownHook(name, hook); err != nil {
		klog.Fatalf("Error registering PreShutdownHook %q: %v", name, err)
	}
}
894125
func NewServeReplay(t *testing.T) *ServeReplay {
	return &ServeReplay{
		t:            t,
		Handlers:     make([]http.Handler, 0),
		NoneLeftFunc: defaultNoneLeftFunc,
	}
}
150465
func (h *Client) PromotionPosition(promotionPosition string) *Client {
	h.promotionPosition = promotionPosition
	h.promotionPositionSet = true
	return h
}
809630
func (sc *SocketConnection) ExecuteHangup(uuid string, args string, sync bool) (m *Message, err error) {
	if uuid != "" {
		return sc.ExecuteUUID(uuid, "hangup", args, sync)
	}

	return sc.Execute("hangup", args, sync)
}
328853
func (c *Conn) nodesUp() error {
	if !c.one.Up() {
		return fmt.Errorf("one %v is not up", c.One)
	}
	if !c.other.Up() {
		return fmt.Errorf("other %v is not up", c.Other)
	}
	return nil
}
206306
func (menu *Menu) CallWhenDisplayed(command *Command) {
	menu.Sync.DisplayedQueue = append(menu.Sync.DisplayedQueue, command)
}
910856
func (s *BaremetalService) NewNotifyBaremetalProvisionDoneParams(mac string) *NotifyBaremetalProvisionDoneParams {
	p := &NotifyBaremetalProvisionDoneParams{}
	p.p = make(map[string]interface{})
	p.p["mac"] = mac
	return p
}
735731
func (s *service) up() {
	s.active = true
	log.Infof("%v: %v service up", s.vserver, s)

	ncc := s.vserver.ncc
	if err := ncc.Dial(); err != nil {
		log.Fatalf("%v: failed to connect to NCC: %v", s.vserver, err)
	}
	defer ncc.Close()

	log.Infof("%v: adding IPVS service %v", s.vserver, s.ipvsSvc)
	if err := ncc.IPVSAddService(s.ipvsSvc); err != nil {
		log.Fatalf("%v: failed to add service %v: %v", s.vserver, s, err)
	}

	// Update destinations *after* the IPVS service exists.
	s.updateDests()
}
871669
func (builder *Builder) Up(n uint) *Builder {
	return builder.With(Up(n))
}
608295
func (GrowlNotifier) Push(title string, text string, iconPath string) {
	cmd := exec.Command(
		"growlnotify", "-n", prog, "-d", prog, "-m", text, prog,
	)
	go cmd.Run()
}