// getBlameLegacy fetches blame information from Gitiles.  This requires the
// BuildSummary to be indexed in Milo.
433786
func getBlameLegacy(c context.Context, msg *bbv1.ApiCommonBuildMessage) []*ui.Commit {
	host, err := getHost(c)
	if err != nil {
		return []*ui.Commit{{
			Description: fmt.Sprintf("Failed to fetch blame information\n%s", err.Error()),
		}}
	}
	tags := strpair.ParseMap(msg.Tags)
	bSet, _ := tags["buildset"]
	bid := NewBuilderID(msg.Bucket, tags.Get("builder"))
	bs := &model.BuildSummary{
		BuildKey:  MakeBuildKey(c, host, tags.Get("build_address")),
		BuildSet:  bSet,
		BuilderID: bid.String(),
	}
	blame, err := simplisticBlamelist(c, bs)
	if err != nil {
		logging.WithError(err).Warningf(c, "getting blamelist")
	}
	return blame
}
986372
func (b *MiloBuildLegacy) BuildSummary() *BuildSummary {
	if b == nil {
		return nil
	}
	result := &BuildSummary{
		Link:          b.Summary.Label,
		Status:        b.Summary.Status,
		PendingTime:   b.Summary.PendingTime,
		ExecutionTime: b.Summary.ExecutionTime,
		Text:          b.Summary.Text,
		Blame:         b.Blame,
	}
	if b.Trigger != nil {
		result.Revision = &b.Trigger.Commit
	}
	return result
}
1374893
func GetBuild(c context.Context, host, taskId string) (*ui.MiloBuildLegacy, error) {
	if taskId == "" {
		return nil, errors.New("no swarming task id", grpcutil.InvalidArgumentTag)
	}

	sf, err := NewProdService(c, host)
	if err != nil {
		return nil, err
	}

	return SwarmingBuildImpl(c, sf, taskId)
}
1120562
func (c *BuildloggerConfig) GetGlobalLogURL() string {
	return fmt.Sprintf("%s/build/%s", c.URL, c.buildID)
}
192597
func (client *RenderingControl2) GetBrightness(InstanceID uint32) (CurrentBrightness uint16, err error) {
	// Request structure.
	request := &struct {
		InstanceID string
	}{}
	// BEGIN Marshal arguments into request.

	if request.InstanceID, err = soap.MarshalUi4(InstanceID); err != nil {
		return
	}
	// END Marshal arguments into request.

	// Response structure.
	response := &struct {
		CurrentBrightness string
	}{}

	// Perform the SOAP call.
	if err = client.SOAPClient.PerformAction(URN_RenderingControl_2, "GetBrightness", request, response); err != nil {
		return
	}

	// BEGIN Unmarshal arguments from response.

	if CurrentBrightness, err = soap.UnmarshalUi2(response.CurrentBrightness); err != nil {
		return
	}
	// END Unmarshal arguments from response.
	return
}
1039321
func (s Slice) GetBinary() ([]byte, error) {
	if !s.IsBinary() {
		return nil, InvalidTypeError{"Expecting type Binary"}
	}

	h := s.head()
	vpackAssert(h >= 0xc0 && h <= 0xc7)

	lengthSize := uint(h - 0xbf)
	length := readIntegerNonEmpty(s[1:], lengthSize)
	checkOverflow(ValueLength(length))
	return s[1+lengthSize : 1+uint64(lengthSize)+length], nil
}
1192666
func (store *EvidenceStore) getEvidenceInfo(evidence types.Evidence) EvidenceInfo {
	return store.GetEvidenceInfo(evidence.Height(), evidence.Hash())
}
269116
func (c *Client) GetLeagueMetadata(leagueKey string) (*League, error) {
	content, err := c.GetFantasyContent(
		fmt.Sprintf("%s/league/%s/metadata",
			YahooBaseURL,
			leagueKey))
	if err != nil {
		return nil, err
	}
	return &content.League, nil
}
1372250
func (store *EvidenceStore) GetEvidenceInfo(height int64, hash []byte) EvidenceInfo {
	key := keyLookupFromHeightAndHash(height, hash)
	val := store.db.Get(key)

	if len(val) == 0 {
		return EvidenceInfo{}
	}
	var ei EvidenceInfo
	err := cdc.UnmarshalBinaryBare(val, &ei)
	if err != nil {
		panic(err)
	}
	return ei
}
567247
func (d *stiDocker) GetImageEntrypoint(name string) ([]string, error) {
	image, err := d.InspectImage(name)
	if err != nil {
		return nil, err
	}
	return image.Config.Entrypoint, nil
}
855267
func GetBuild(c context.Context, id buildbot.BuildID) (*ui.MiloBuildLegacy, error) {
	if err := id.Validate(); err != nil {
		return nil, err
	}
	if err := buildstore.CanAccessMaster(c, id.Master); err != nil {
		return nil, err
	}

	switch b, err := buildstore.GetBuild(c, id); {
	case err != nil:
		return nil, err
	case b == nil:
		return nil, errors.Reason("build %s not found", &id).Tag(grpcutil.NotFoundTag).Err()
	default:
		return renderBuild(c, b, true), nil
	}
}
945500
func (texture *Texture) GetBlendMode() (bm BlendMode, err error) {
	ret := C.SDL_GetTextureBlendMode(texture.cptr(), bm.cptr())
	return bm, errorFromInt(int(ret))
}
1134686
func getSummary(c context.Context, host string, project string, id int64) (*model.BuildSummary, error) {
	client, err := buildbucketClient(c, host, auth.AsProject, auth.WithProject(project))
	if err != nil {
		return nil, err
	}
	b, err := client.GetBuild(c, &buildbucketpb.GetBuildRequest{
		Id:     id,
		Fields: summaryBuildMask,
	})
	if err != nil {
		return nil, err
	}
	buildAddress := fmt.Sprintf("%d", b.Id)
	if b.Number != 0 {
		buildAddress = fmt.Sprintf("luci.%s.%s/%s/%d", b.Builder.Project, b.Builder.Bucket, b.Builder.Builder, b.Number)
	}

	// Note: The parent for buildbucket build summaries is currently a fake entity.
	// In the future, builds can be cached here, but we currently don't do that.
	buildKey := datastore.MakeKey(c, "buildbucket.Build", fmt.Sprintf("%s:%s", host, buildAddress))
	swarming := b.GetInfra().GetSwarming()

	bs := &model.BuildSummary{
		ProjectID:  b.Builder.Project,
		BuildKey:   buildKey,
		BuilderID:  BuilderID{*b.Builder}.String(),
		BuildID:    "buildbucket/" + buildAddress,
		BuildSet:   protoutil.BuildSets(b),
		ContextURI: []string{fmt.Sprintf("buildbucket://%s/build/%d", host, id)},
		Created:    mustTimestamp(b.CreateTime),
		Summary: model.Summary{
			Start:  mustTimestamp(b.StartTime),
			End:    mustTimestamp(b.EndTime),
			Status: statusMap[b.Status],
		},
		Version:      mustTimestamp(b.UpdateTime).UnixNano(),
		Experimental: b.GetInput().GetExperimental(),
	}
	if task := swarming.GetTaskId(); task != "" {
		bs.ContextURI = append(
			bs.ContextURI,
			fmt.Sprintf("swarming://%s/task/%s", swarming.GetHostname(), swarming.GetTaskId()))
	}
	return bs, nil
}
922048
func getCollectionMB(coll *mgo.Collection) (int, error) {
	var result bson.M
	err := coll.Database.Run(bson.D{
		{"collStats", coll.Name},
		{"scale", humanize.MiByte},
	}, &result)
	if err != nil {
		return 0, errors.Trace(err)
	}
	return dbCollectionSizeToInt(result, coll.Name)
}
1363531
func (bh *blobHandler) GetBlob(w http.ResponseWriter, r *http.Request) {
	context.GetLogger(bh).Debug("GetBlob")
	blobs := bh.Repository.Blobs(bh)
	desc, err := blobs.Stat(bh, bh.Digest)
	if err != nil {
		if err == distribution.ErrBlobUnknown {
			bh.Errors = append(bh.Errors, v2.ErrorCodeBlobUnknown.WithDetail(bh.Digest))
		} else {
			bh.Errors = append(bh.Errors, errcode.ErrorCodeUnknown.WithDetail(err))
		}
		return
	}

	if err := blobs.ServeBlob(bh, w, r, desc.Digest); err != nil {
		context.GetLogger(bh).Debugf("unexpected error getting blob HTTP handler: %v", err)
		bh.Errors = append(bh.Errors, errcode.ErrorCodeUnknown.WithDetail(err))
		return
	}
}
1154338
func (_class GPUGroupClass) GetAllocationAlgorithm(sessionID SessionRef, self GPUGroupRef) (_retval AllocationAlgorithm, _err error) {
	_method := "GPU_group.get_allocation_algorithm"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertGPUGroupRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
	if _err != nil {
		return
	}
	_retval, _err = convertEnumAllocationAlgorithmToGo(_method + " -> ", _result.Value)
	return
}
259714
func (NoopBlockMetadataStore) GetMetadata(ctx context.Context,
	blockID kbfsblock.ID) (value BlockMetadataValue, err error) {
	return BlockMetadataValue{}, ldberrors.ErrNotFound
}