// Returns a new ValueChangePublisher
15702
func NewValueChangePublisher(initialValue interface{}) ValueChangePublisher {
	return ValueChangePublisher{
		value:  initialValue,
		mutex:  sync.RWMutex{},
		notify: make(chan struct{}),
	}
}
1073555
func (s *VirtualMachineService) NewChangeServiceForVirtualMachineParams(id string, serviceofferingid string) *ChangeServiceForVirtualMachineParams {
	p := &ChangeServiceForVirtualMachineParams{}
	p.p = make(map[string]interface{})
	p.p["id"] = id
	p.p["serviceofferingid"] = serviceofferingid
	return p
}
81493
func (w *offerStatusWatcher) mergeChanges(current, new []watcher.OfferStatusChange) []watcher.OfferStatusChange {
	chMap := make(map[string]watcher.OfferStatusChange)
	for _, c := range current {
		chMap[c.Name] = c
	}
	for _, c := range new {
		chMap[c.Name] = c
	}
	var result []watcher.OfferStatusChange
	for _, c := range chMap {
		result = append(result, c)
	}
	return result
}
1256580
func (ev *ChangeWatchResp) GetChangeType() datasync.Op {
	if ev.message.OperationType == PutDel_DEL {
		return datasync.Delete
	}

	return datasync.Put
}
1251242
func NewMemberChangeEmailDetails(NewValue string) *MemberChangeEmailDetails {
	s := new(MemberChangeEmailDetails)
	s.NewValue = NewValue
	return s
}
795095
func (v *ValueChangePublisher) Set(value interface{}) {
	v.mutex.Lock()
	defer v.mutex.Unlock()
	v.value = value
	close(v.notify)
	v.notify = make(chan struct{})
}
332546
func (ui *UI) DisplayChangesForPush(changeSet []Change) error {
	if len(changeSet) == 0 {
		return nil
	}

	var columnWidth int
	for _, change := range changeSet {
		if width := wordSize(ui.TranslateText(change.Header)); width > columnWidth {
			columnWidth = width
		}
	}

	for _, change := range changeSet {
		padding := columnWidth - wordSize(ui.TranslateText(change.Header)) + 3
		err := ui.DisplayChangeForPush(change.Header, padding, change.HiddenValue, change.CurrentValue, change.NewValue)
		if err != nil {
			return err
		}
	}

	return nil
}
1279779
func NewPaperChangePolicyType(Description string) *PaperChangePolicyType {
	s := new(PaperChangePolicyType)
	s.Description = Description
	return s
}
529621
func NewMemberSuggestionsChangePolicyDetails(NewValue *MemberSuggestionsPolicy) *MemberSuggestionsChangePolicyDetails {
	s := new(MemberSuggestionsChangePolicyDetails)
	s.NewValue = NewValue
	return s
}
92376
func (c *pollChangeManager) pollChangeAgent(dummyQuit chan bool) error {

	changesUri, err := url.Parse(config.GetString(configChangeServerBaseURI))
	if err != nil {
		log.Errorf("bad url value for config %s: %s", changesUri, err)
		return err
	}
	changesUri.Path = path.Join(changesUri.Path, "changes")

	/*
	 * Check to see if we have lastSequence already saved in the DB,
	 * in which case, it has to be used to prevent re-reading same data
	 */
	c.lastSequence = c.dbMan.getLastSequence()
	for {
		select {
		case <-c.quitChan:
			log.Info("pollChangeAgent; Recevied quit signal to stop polling change server, close token manager")
			return quitSignalError
		default:
			scopes, err := c.dbMan.findScopesForId(apidInfo.ClusterID)
			if err != nil {
				return err
			}
			r, err := c.getChanges(scopes, changesUri)
			if err != nil {
				return err
			}
			cl, err := c.parseChangeResp(r)
			if err != nil {
				return err
			}
			if err = c.emitChangeList(scopes, cl); err != nil {
				return err
			}
		}
	}
}
911981
func (api *RemoteRelationsAPI) ConsumeRemoteRelationChanges(
	changes params.RemoteRelationsChanges,
) (params.ErrorResults, error) {
	results := params.ErrorResults{
		Results: make([]params.ErrorResult, len(changes.Changes)),
	}
	for i, change := range changes.Changes {
		relationTag, err := api.st.GetRemoteEntity(change.RelationToken)
		if err != nil {
			if errors.IsNotFound(err) {
				continue
			}
			results.Results[i].Error = common.ServerError(err)
			continue
		}
		if err := commoncrossmodel.PublishRelationChange(api.st, relationTag, change); err != nil {
			results.Results[i].Error = common.ServerError(err)
			continue
		}
	}
	return results, nil
}
635658
func SelectionChange(listener func(*vecty.Event)) *vecty.EventListener {
	return &vecty.EventListener{Name: "selectionchange", Listener: listener}
}
1305274
func (ui *UI) DisplayChangeForPush(header string, stringTypePadding int, hiddenValue bool, originalValue interface{}, newValue interface{}) error {
	ui.terminalLock.Lock()
	defer ui.terminalLock.Unlock()

	originalType := reflect.ValueOf(originalValue).Type()
	newType := reflect.ValueOf(newValue).Type()
	if originalType != newType {
		return ErrValueMissmatch
	}

	offset := strings.Repeat(" ", stringTypePadding)

	switch oVal := originalValue.(type) {
	case int:
		nVal := newValue.(int)
		ui.displayDiffForInt(offset, header, oVal, nVal)
	case types.NullInt:
		nVal := newValue.(types.NullInt)
		ui.displayDiffForNullInt(offset, header, oVal, nVal)
	case uint64:
		nVal := newValue.(uint64)
		ui.displayDiffForUint64(offset, header, oVal, nVal)
	case string:
		nVal := newValue.(string)
		ui.displayDiffForString(offset, header, hiddenValue, oVal, nVal)
	case []string:
		nVal := newValue.([]string)
		if len(oVal) == 0 && len(nVal) == 0 {
			return nil
		}

		ui.displayDiffForStrings(offset, header, oVal, nVal)
	case map[string]string:
		nVal := newValue.(map[string]string)
		if len(oVal) == 0 && len(nVal) == 0 {
			return nil
		}

		ui.displayDiffForMapStringString(offset, header, oVal, nVal)
	default:
		panic(fmt.Sprintf("diff display does not have case for '%s'", header))
	}
	return nil
}
1187286
func RateChange(listener func(*vecty.Event)) *vecty.EventListener {
	return &vecty.EventListener{Name: "ratechange", Listener: listener}
}
256478
func NewChange(key string, value proto.Message, rev int64, changeType datasync.Op) *Change {
	return &Change{
		changeType: changeType,
		KeyVal:     &KeyVal{key, &lazyProto{value}, rev},
	}
}
547591
func (c *Client) ConsumeRemoteRelationChange(change params.RemoteRelationChangeEvent) error {
	args := params.RemoteRelationsChanges{
		Changes: []params.RemoteRelationChangeEvent{change},
	}
	var results params.ErrorResults
	err := c.facade.FacadeCall("ConsumeRemoteRelationChanges", args, &results)
	if err != nil {
		return errors.Trace(err)
	}
	return results.OneError()
}
403175
func NewSfFbInviteChangeRoleDetails(TargetAssetIndex uint64, OriginalFolderName string) *SfFbInviteChangeRoleDetails {
	s := new(SfFbInviteChangeRoleDetails)
	s.TargetAssetIndex = TargetAssetIndex
	s.OriginalFolderName = OriginalFolderName
	return s
}