// VoteVersion extracts the vote version from the input pubkey script.
970367
func VoteVersion(pkScript []byte) uint32 {
	if len(pkScript) < 8 {
		return stake.VoteConsensusVersionAbsent
	}

	return binary.LittleEndian.Uint32(pkScript[4:8])
}
198976
func (c *Client) ElasticsearchVersion(url string) (string, error) {
	res, _, err := c.Ping().URL(url).Do()
	if err != nil {
		return "", err
	}
	return res.Version.Number, nil
}
457751
func GetVersion(uuid []byte) Version {
	ver := uuid[6] >> 4
	if ver > 0 && ver < 6 {
		return Version(ver)
	}

	return VersionUnknown
}
491831
func parseKeyVersion(kid string) string {
	keyVersionParts := strings.Split(kid, "/")
	return keyVersionParts[len(keyVersionParts)-1]
}
641153
func (s *RegisterUsageInput) SetPublicKeyVersion(v int64) *RegisterUsageInput {
	s.PublicKeyVersion = &v
	return s
}
1185181
func (s *IdentityServer) Version(
	ctx context.Context,
	req *api.SdkIdentityVersionRequest,
) (*api.SdkIdentityVersionResponse, error) {

	var (
		version *api.StorageVersion
		err     error
	)
	if s.driver(ctx) == nil {
		version = &api.StorageVersion{
			Driver: "no driver running",
		}
	} else {
		version, err = s.driver(ctx).Version()
		if err != nil {
			return nil, status.Errorf(
				codes.Internal,
				"Failed to get version information: %v", err,
			)
		}
	}

	sdkVersion := &api.SdkVersion{
		Major: int32(api.SdkVersion_Major),
		Minor: int32(api.SdkVersion_Minor),
		Patch: int32(api.SdkVersion_Patch),
		Version: fmt.Sprintf("%d.%d.%d",
			api.SdkVersion_Major,
			api.SdkVersion_Minor,
			api.SdkVersion_Patch,
		),
	}

	return &api.SdkIdentityVersionResponse{
		SdkVersion: sdkVersion,
		Version:    version,
	}, nil
}
444038
func Version() (libVersion string, libVersionNumber int, sourceID string) {
	libVersion = C.GoString(C.sqlite3_libversion())
	libVersionNumber = int(C.sqlite3_libversion_number())
	sourceID = C.GoString(C.sqlite3_sourceid())
	return libVersion, libVersionNumber, sourceID
}
611750
func (p *Peer) ProtocolVersion() uint32 {
	p.flagsMtx.Lock()
	protocolVersion := p.protocolVersion
	p.flagsMtx.Unlock()

	return protocolVersion
}
837903
func parseVersion(s string) (Version, error) {
	if validPkgver(s) {
		return Version(s), nil
	}

	return "", fmt.Errorf("invalid version string: %s", s)
}
207779
func (s *Server) Version(ctx context.Context, req *pb.VersionRequest) (resp *pb.VersionResponse, err error) {
	const operation = "version"
	defer func() {
		recordOperation(operation, time.Now())
		recordError(operation, err)
	}()

	return &pb.VersionResponse{
		Version:           kubeAPIVersion,
		RuntimeName:       containerName,
		RuntimeVersion:    version.Version,
		RuntimeApiVersion: runtimeAPIVersion,
	}, nil
}
116076
func (g *GPG) Version(context.Context) semver.Version {
	return semver.Version{Major: 1}
}
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
}
1079263
func (rdb RethinkDB) GetVersion(gun data.GUN, role data.RoleName, version int) (*time.Time, []byte, error) {
	var file RDBTUFFile
	res, err := gorethink.DB(rdb.dbName).Table(file.TableName(), gorethink.TableOpts{ReadMode: "majority"}).Get([]interface{}{gun.String(), role.String(), version}).Run(rdb.sess)
	if err != nil {
		return nil, nil, err
	}
	defer res.Close()
	if res.IsNil() {
		return nil, nil, ErrNotFound{}
	}
	err = res.One(&file)
	if err == gorethink.ErrEmptyResult {
		return nil, nil, ErrNotFound{}
	}
	return &file.CreatedAt, file.Data, err
}
31528
func ParseVersion(buff []byte, cursor *int, l int) (int, error) {
	if *cursor >= l {
		return NO_VERSION, ErrVersionNotFound
	}

	c := buff[*cursor]
	*cursor++

	// XXX : not a version, not an error though as RFC 3164 does not support it
	if !IsDigit(c) {
		return NO_VERSION, nil
	}

	v, e := strconv.Atoi(string(c))
	if e != nil {
		*cursor--
		return NO_VERSION, e
	}

	return v, nil
}
241971
func Version() IPVSVersion {
	v := uint(info.Version)
	return IPVSVersion{
		Major: (v >> 16) & 0xff,
		Minor: (v >> 8) & 0xff,
		Patch: v & 0xff,
	}
}
999741
func (r *Runc) Version(context context.Context) (Version, error) {
	data, err := cmdOutput(r.command(context, "--version"), false)
	if err != nil {
		return Version{}, err
	}
	return parseVersion(data)
}
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
}