// Converts the old model format to the new version
968613
func (model *Model) convertOldFormat(filename string) error {
	oldmodel := new(OldModel)
	f, err := os.Open(filename)
	if err != nil {
		return err
	}
	defer f.Close()
	d := json.NewDecoder(f)
	err = d.Decode(oldmodel)
	if err != nil {
		return err
	}

	// Correct for old models pre divergence measure
	if model.SuffDivergenceThreshold == 0 {
		model.SuffDivergenceThreshold = SuffDivergenceThresholdDefault
	}

	// Convert fields
	model.Maxcount = oldmodel.Maxcount
	model.Suggest = oldmodel.Suggest
	model.Depth = oldmodel.Depth
	model.Threshold = oldmodel.Threshold
	model.UseAutocomplete = oldmodel.UseAutocomplete

	// Convert the old counts
	if len(oldmodel.Data) > 0 {
		model.Data = make(map[string]*Counts, len(oldmodel.Data))
		for term, cc := range oldmodel.Data {
			model.Data[term] = &Counts{cc, 0}
		}
	}
	return nil
}
844406
func NewVersionConverter(t TypeConverter, o runtime.ObjectConvertor, h schema.GroupVersion) merge.Converter {
	return &versionConverter{
		typeConverter:   t,
		objectConvertor: o,
		hubGetter: func(from schema.GroupVersion) schema.GroupVersion {
			return schema.GroupVersion{
				Group:   from.Group,
				Version: h.Version,
			}
		},
	}
}
312014
func (p *Project) RollbackVersion(version string) error {
	p.Log.Debugf("rolling back %d functions to version %s", len(p.Functions), version)

	for _, fn := range p.Functions {
		if err := fn.RollbackVersion(version); err != nil {
			return fmt.Errorf("function %s: %s", fn.Name, err)
		}
	}

	return nil
}
698579
func (c *Client) UpdateVersion(i *UpdateVersionInput) (*Version, error) {
	if i.Service == "" {
		return nil, ErrMissingService
	}

	if i.Version == 0 {
		return nil, ErrMissingVersion
	}

	path := fmt.Sprintf("/service/%s/version/%d", i.Service, i.Version)
	resp, err := c.PutForm(path, i, nil)
	if err != nil {
		return nil, err
	}

	var e *Version
	if err := decodeJSON(&e, resp.Body); err != nil {
		return nil, err
	}
	return e, nil
}
499376
func (c *ControllerAPI) MongoVersion() (params.StringResult, error) {
	result := params.StringResult{}
	if err := c.checkHasAdmin(); err != nil {
		return result, errors.Trace(err)
	}
	version, err := c.state.MongoVersion()
	if err != nil {
		return result, errors.Trace(err)
	}
	result.Result = version
	return result, nil
}
640842
func (s *DetectModerationLabelsOutput) SetModerationModelVersion(v string) *DetectModerationLabelsOutput {
	s.ModerationModelVersion = &v
	return s
}
1005542
func updateVersionAndTableInfo(t *meta.Meta, job *model.Job, tblInfo *model.TableInfo, shouldUpdateVer bool) (
	ver int64, err error) {
	if shouldUpdateVer {
		ver, err = updateSchemaVersion(t, job)
		if err != nil {
			return 0, errors.Trace(err)
		}
	}

	if tblInfo.State == model.StatePublic {
		tblInfo.UpdateTS = t.StartTS
	}
	return ver, t.UpdateTable(job.SchemaID, tblInfo)
}
1276891
func (ad *ArchiveData) Version() (*version.Number, error) {
	meta, err := ad.Metadata()
	if errors.IsNotFound(err) {
		return &legacyVersion, nil
	}
	if err != nil {
		return nil, errors.Trace(err)
	}

	return &meta.Origin.Version, nil
}
1099099
func (s *EndpointDemographic) SetModelVersion(v string) *EndpointDemographic {
	s.ModelVersion = &v
	return s
}
861705
func (d config) Version() string {
	st := structs.New(d.data)
	f := st.Field("Version")
	return f.Value().(string)
}
180759
func ArchiveVersion(gitCommit string) string {
	vsn := Version
	if VersionMeta != "stable" {
		vsn += "-" + VersionMeta
	}
	if len(gitCommit) >= 8 {
		vsn += "-" + gitCommit[:8]
	}
	return vsn
}
694281
func (c *Client) MongoVersion() (string, error) {
	if c.BestAPIVersion() < 6 {
		return "", errors.NotSupportedf("MongoVersion not supported by this version of Juju")
	}
	var result params.StringResult
	err := c.facade.FacadeCall("MongoVersion", nil, &result)
	if err != nil {
		return "", errors.Trace(err)
	}
	if result.Error != nil {
		return "", result.Error
	}
	return result.Result, nil
}
389576
func (s *OrcSerDe) SetFormatVersion(v string) *OrcSerDe {
	s.FormatVersion = &v
	return s
}
34749
func (s *GetContentModerationOutput) SetModerationModelVersion(v string) *GetContentModerationOutput {
	s.ModerationModelVersion = &v
	return s
}
57724
func NewCRDVersionConverter(t TypeConverter, o runtime.ObjectConvertor, h schema.GroupVersion) merge.Converter {
	return &versionConverter{
		typeConverter:   t,
		objectConvertor: o,
		hubGetter: func(from schema.GroupVersion) schema.GroupVersion {
			return h
		},
	}
}
239873
func (s *SearchFacesOutput) SetFaceModelVersion(v string) *SearchFacesOutput {
	s.FaceModelVersion = &v
	return s
}
649652
func Convert(oldConfig Config) (string, storage.Config) {
	newConfig := storage.NewConfig()
	newConfig.TraceLoggingEnabled = oldConfig.TraceLoggingEnabled
	newConfig.ValidateKeys = oldConfig.ValidateKeys
	newConfig.Engine.MADVWillNeed = oldConfig.TSMWillNeed
	newConfig.Engine.Cache.MaxMemorySize = oldConfig.CacheMaxMemorySize
	newConfig.Engine.Cache.SnapshotMemorySize = oldConfig.CacheSnapshotMemorySize
	newConfig.Engine.Cache.SnapshotWriteColdDuration = oldConfig.CacheSnapshotWriteColdDuration
	newConfig.Engine.Compaction.FullWriteColdDuration = oldConfig.CompactFullWriteColdDuration
	newConfig.Engine.Compaction.Throughput = oldConfig.CompactThroughput
	newConfig.Engine.Compaction.ThroughputBurst = oldConfig.CompactThroughputBurst
	newConfig.Engine.Compaction.MaxConcurrent = oldConfig.MaxConcurrentCompactions
	newConfig.WALPath = oldConfig.WALDir
	newConfig.WAL.FsyncDelay = oldConfig.WALFsyncDelay
	return oldConfig.Dir, newConfig
}