// RecordChangeSlaveTypeAction records a new ChangeSlaveTypeAction
// into the specified Cleaner
543627
func RecordChangeSlaveTypeAction(cleaner *Cleaner, tabletAlias *topodatapb.TabletAlias, from topodatapb.TabletType, to topodatapb.TabletType) {
	cleaner.Record(ChangeSlaveTypeActionName, topoproto.TabletAliasString(tabletAlias), func(ctx context.Context, wr *Wrangler) error {
		ti, err := wr.ts.GetTablet(ctx, tabletAlias)
		if err != nil {
			return err
		}
		if ti.Type != from {
			return fmt.Errorf("tablet %v is not of the right type (got %v expected %v), not changing it to %v", topoproto.TabletAliasString(tabletAlias), ti.Type, from, to)
		}
		if !topo.IsTrivialTypeChange(ti.Type, to) {
			return fmt.Errorf("tablet %v type change %v -> %v is not an allowed transition for ChangeSlaveType", topoproto.TabletAliasString(tabletAlias), ti.Type, to)
		}

		// ask the tablet to make the change
		return wr.tmc.ChangeType(ctx, ti.Tablet, to)
	})
}
128490
func (c *Change) Action() (merkletrie.Action, error) {
	if c.From == empty && c.To == empty {
		return merkletrie.Action(0),
			fmt.Errorf("malformed change: empty from and to")
	}
	if c.From == empty {
		return merkletrie.Insert, nil
	}
	if c.To == empty {
		return merkletrie.Delete, nil
	}

	return merkletrie.Modify, nil
}
1108319
func (l Listener) OnContextActionChange(e *gumble.ContextActionChangeEvent) {
	if l.ContextActionChange != nil {
		l.ContextActionChange(e)
	}
}
699701
func RecordNodeStatusChange(recorder record.EventRecorder, node *v1.Node, newStatus string) {
	ref := &v1.ObjectReference{
		Kind:      "Node",
		Name:      node.Name,
		UID:       node.UID,
		Namespace: "",
	}
	klog.V(2).Infof("Recording status change %s event message for node %s", newStatus, node.Name)
	// TODO: This requires a transaction, either both node status is updated
	// and event is recorded or neither should happen, see issue #6055.
	recorder.Eventf(ref, v1.EventTypeNormal, newStatus, "Node %s status is now: %s", node.Name, newStatus)
}
757576
func NewPasswordChangeType(Description string) *PasswordChangeType {
	s := new(PasswordChangeType)
	s.Description = Description
	return s
}
417670
func (st *MemStorage) writeChange(gun data.GUN, version int, checksum string) {
	c := Change{
		ID:        strconv.Itoa(len(st.changes) + 1),
		GUN:       gun.String(),
		Version:   version,
		SHA256:    checksum,
		CreatedAt: time.Now(),
		Category:  changeCategoryUpdate,
	}
	st.changes = append(st.changes, c)
}
417314
func (s *RouterService) NewChangeServiceForRouterParams(id string, serviceofferingid string) *ChangeServiceForRouterParams {
	p := &ChangeServiceForRouterParams{}
	p.p = make(map[string]interface{})
	p.p["id"] = id
	p.p["serviceofferingid"] = serviceofferingid
	return p
}
107323
func (mr *MockAgentMockRecorder) ChangeConfig(arg0 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChangeConfig", reflect.TypeOf((*MockAgent)(nil).ChangeConfig), arg0)
}
191342
func (_ *VirtualMachine) CheckChanges(a, e, changes *VirtualMachine) error {
	glog.V(4).Info("VirtualMachine.CheckChanges invoked!")
	return nil
}
1350113
func (agent *ActionAgent) ChangeType(ctx context.Context, tabletType topodatapb.TabletType) error {
	if err := agent.lock(ctx); err != nil {
		return err
	}
	defer agent.unlock()

	// We don't want to allow multiple callers to claim a tablet as drained. There is a race that could happen during
	// horizontal resharding where two vtworkers will try to DRAIN the same tablet. This check prevents that race from
	// causing errors.
	if tabletType == topodatapb.TabletType_DRAINED && agent.Tablet().Type == topodatapb.TabletType_DRAINED {
		return fmt.Errorf("Tablet: %v, is already drained", agent.TabletAlias)
	}
	// change our type in the topology
	_, err := topotools.ChangeType(ctx, agent.TopoServer, agent.TabletAlias, tabletType)
	if err != nil {
		return err
	}

	// let's update our internal state (stop query service and other things)
	if err := agent.refreshTablet(ctx, "ChangeType"); err != nil {
		return err
	}

	// Let's see if we need to fix semi-sync acking.
	if err := agent.fixSemiSyncAndReplication(agent.Tablet().Type); err != nil {
		return vterrors.Wrap(err, "fixSemiSyncAndReplication failed, may not ack correctly")
	}

	// and re-run health check
	agent.runHealthCheckLocked()
	return nil
}
411766
func getChangeCause(obj runtime.Object) string {
	accessor, err := meta.Accessor(obj)
	if err != nil {
		return ""
	}
	return accessor.GetAnnotations()[ChangeCauseAnnotation]
}
1258380
func (s *CacheNodeTypeSpecificParameter) SetChangeType(v string) *CacheNodeTypeSpecificParameter {
	s.ChangeType = &v
	return s
}
1124022
func VersionChange(listener func(*vecty.Event)) *vecty.EventListener {
	return &vecty.EventListener{Name: "versionchange", Listener: listener}
}
840719
func ChangeResourcePatch(info *resource.Info, changeCause string) ([]byte, error) {
	oldData, err := json.Marshal(info.Object)
	if err != nil {
		return nil, err
	}
	if err := RecordChangeCause(info.Object, changeCause); err != nil {
		return nil, err
	}
	newData, err := json.Marshal(info.Object)
	if err != nil {
		return nil, err
	}
	return strategicpatch.CreateTwoWayMergePatch(oldData, newData, info.Object)
}
1347557
func (mr *MockGerritServerMockRecorder) GetChange(arg0, arg1 interface{}) *gomock.Call {
	mr.mock.ctrl.T.Helper()
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetChange", reflect.TypeOf((*MockGerritServer)(nil).GetChange), arg0, arg1)
}
386221
func (wr *Wrangler) ChangeSlaveType(ctx context.Context, tabletAlias *topodatapb.TabletAlias, tabletType topodatapb.TabletType) error {
	// Load tablet to find endpoint, and keyspace and shard assignment.
	ti, err := wr.ts.GetTablet(ctx, tabletAlias)
	if err != nil {
		return err
	}

	if !topo.IsTrivialTypeChange(ti.Type, tabletType) {
		return fmt.Errorf("tablet %v type change %v -> %v is not an allowed transition for ChangeSlaveType", tabletAlias, ti.Type, tabletType)
	}

	// and ask the tablet to make the change
	return wr.tmc.ChangeType(ctx, ti.Tablet, tabletType)
}
666480
func NewActualLRPInstanceChangedEvent(before, after *ActualLRP) *ActualLRPInstanceChangedEvent {
	var (
		actualLRPKey         ActualLRPKey
		actualLRPInstanceKey ActualLRPInstanceKey
	)

	if (before != nil && before.ActualLRPKey != ActualLRPKey{}) {
		actualLRPKey = before.ActualLRPKey
	}
	if (after != nil && after.ActualLRPKey != ActualLRPKey{}) {
		actualLRPKey = after.ActualLRPKey
	}

	if (before != nil && before.ActualLRPInstanceKey != ActualLRPInstanceKey{}) {
		actualLRPInstanceKey = before.ActualLRPInstanceKey
	}
	if (after != nil && after.ActualLRPInstanceKey != ActualLRPInstanceKey{}) {
		actualLRPInstanceKey = after.ActualLRPInstanceKey
	}

	return &ActualLRPInstanceChangedEvent{
		ActualLRPKey:         actualLRPKey,
		ActualLRPInstanceKey: actualLRPInstanceKey,
		Before:               before.ToActualLRPInfo(),
		After:                after.ToActualLRPInfo(),
	}
}