// bestVersion tries to find the newest version in the version list that we can
// use.
431591
func bestVersion(desiredVersion int, versions []int) int {
	best := 0
	for _, version := range versions {
		if version <= desiredVersion && version > best {
			best = version
		}
	}
	return best
}
498021
func (mr *MockAPICallerMockRecorder) BestFacadeVersion(arg0 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BestFacadeVersion", reflect.TypeOf((*MockAPICaller)(nil).BestFacadeVersion), arg0)
}
613192
func (s *IndicesPutTemplateService) Version(version int) *IndicesPutTemplateService {
	s.version = &version
	return s
}
527646
func (c *ClientupdateListCall) Version(version string) *ClientupdateListCall {
	c.urlParams_.Set("version", version)
	return c
}
923349
func ParseVersion(s string) (Version, error) {
	var vv Version
	for _, suffix := range versionSuffixes {
		if strings.HasSuffix(s, suffix) {
			vv.Suffix = suffix
			s = strings.TrimSuffix(s, suffix)
		}
	}

	v, p := parseVersion(s)

	vv.Number = v
	vv.PatchLevel = p

	return vv, nil
}
1169961
func (g *GistCommit) GetVersion() string {
	if g == nil || g.Version == nil {
		return ""
	}
	return *g.Version
}
802666
func Version(url, migrationsPath string) (version file.Version, err error) {
	d, err := driver.New(url)
	if err != nil {
		return 0, err
	}
	return d.Version()
}
1120872
func Version(name string, url string, kvdbOptions map[string]string) (string, error) {
	lock.RLock()
	defer lock.RUnlock()

	if dsVersion, exists := datastoreVersions[name]; exists {
		return dsVersion(url, kvdbOptions)
	}
	return "", ErrNotSupported
}
1307825
func (s *ConfigService) GetVersion() (string, *Response, error) {
	u := "config/server/version"
	return getStringResponseWithoutOptions(s.client, u)
}
963263
func (c *AppversionListCall) Version(version string) *AppversionListCall {
	c.urlParams_.Set("version", version)
	return c
}
1037913
func (s *SearchService) Version(version bool) *SearchService {
	s.searchSource = s.searchSource.Version(version)
	return s
}
228617
func (c *Changelog) GetVersion(versionNum string) *Version {
	for _, v := range c.Versions {
		if v.Version == versionNum {
			return v
		}
	}
	return nil
}
68993
func (d *diagnosticsCollector) compareVersion(value string) error {
	currentVersion := versionSegments(value)
	localVersion := versionSegments(d.version)

	if localVersion[0] < currentVersion[0] { //Major
		return fmt.Errorf("you are running Pilosa %s, a newer version (%s) is available: https://github.com/pilosa/pilosa/releases", d.version, value)
	} else if localVersion[1] < currentVersion[1] && localVersion[0] == currentVersion[0] { // Minor
		return fmt.Errorf("you are running Pilosa %s, the latest minor release is %s: https://github.com/pilosa/pilosa/releases", d.version, value)
	} else if localVersion[2] < currentVersion[2] && localVersion[0] == currentVersion[0] && localVersion[1] == currentVersion[1] { // Patch
		return fmt.Errorf("there is a new patch release of Pilosa available: %s: https://github.com/pilosa/pilosa/releases", value)
	}

	return nil
}
35641
func Version(url string, kvdbOptions map[string]string) (string, error) {
	return kvdb.BoltVersion1, nil
}
384068
func (p GatewayProfile) GetVersion() string {
	return p.UpdatedAt.UTC().Format(time.RFC3339Nano)
}
837903
func parseVersion(s string) (Version, error) {
	if validPkgver(s) {
		return Version(s), nil
	}

	return "", fmt.Errorf("invalid version string: %s", s)
}
432172
func MaxVersions(versions uint32) func(Call) error {
	return func(hc Call) error {
		if c, ok := hc.(hasQueryOptions); ok {
			if versions > math.MaxInt32 {
				return errors.New("'MaxVersions' exceeds supported number of versions")
			}
			c.setMaxVersions(versions)
			return nil
		}
		return errors.New("'MaxVersions' option can only be used with Get or Scan request")
	}
}