// GetCombinedUseMap counts how many times the property has been used by
// existing and proposed allocations. It also takes into account any stopped
// allocations
321637
func (p *propertySet) GetCombinedUseMap() map[string]uint64 {
	combinedUse := make(map[string]uint64, helper.IntMax(len(p.existingValues), len(p.proposedValues)))
	for _, usedValues := range []map[string]uint64{p.existingValues, p.proposedValues} {
		for propertyValue, usedCount := range usedValues {
			combinedUse[propertyValue] += usedCount
		}
	}

	// Go through and discount the combined count when the value has been
	// cleared by a proposed stop.
	for propertyValue, clearedCount := range p.clearedValues {
		combined, ok := combinedUse[propertyValue]
		if !ok {
			continue
		}

		// Don't clear below 0.
		if combined >= clearedCount {
			combinedUse[propertyValue] = combined - clearedCount
		} else {
			combinedUse[propertyValue] = 0
		}
	}
	return combinedUse
}
456072
func (kf *KunstructuredFactoryImpl) FromMap(
	m map[string]interface{}) ifc.Kunstructured {
	return &UnstructAdapter{Unstructured: unstructured.Unstructured{Object: m}}
}
371148
func (i *ResourceInstance) findUnusedDeposedKey() DeposedKey {
	for {
		key := NewDeposedKey()
		if _, exists := i.Deposed[key]; !exists {
			return key
		}
		// Spin until we find a unique one. This shouldn't take long, because
		// we have a 32-bit keyspace and there's rarely more than one deposed
		// instance.
	}
}
815110
func (c *CmdListTrackers) GetUsage() libkb.Usage {
	return libkb.Usage{
		Config: true,
		API:    true,
	}
}
599687
func (l *Client) GetVariationList() ([]Variation, error) {
	res := ApiResp{}
	data := []Variation{}

	// make the request
	err := l.Get(variationListEndpoint, nil, nil, &res, &data)
	if err != nil {
		return data, err
	}

	return data, nil
}
992028
func GetMappedRBDs(ctx types.Context) (map[string]string, error) {

	cmd := exec.Command(
		rbdCmd, "showmapped", formatOpt, jsonArg)
	out, _, err := RunCommand(ctx, cmd)
	if err != nil {
		return nil, goof.WithError("unable to get rbd map", err)
	}

	devMap := map[string]string{}
	rbdMap := map[string]*rbdMappedEntry{}

	err = json.Unmarshal(out, &rbdMap)
	if err != nil {
		return nil, goof.WithError(
			"unable to parse rbd showmapped", err)
	}

	for _, mapped := range rbdMap {
		volumeID := GetVolumeID(&mapped.Pool, &mapped.Name)
		devMap[*volumeID] = mapped.Device
	}

	return devMap, nil
}
258122
func (f *File) GetMapFlat() map[string]string {
	ret := make(map[string]string)

	for _, section := range f.sections {
		name := section.Name()
		if section.name != "" {
			name = fmt.Sprintf("%s%s", name, DefaultNameKeySeparator)
		}

		for _, key := range section.keys {
			ret[fmt.Sprintf("%s%s", name, key)] = f.ValueManipFunc(section.GetRaw(key))
		}
	}

	return ret
}
136199
func FromMap(m map[string]interface{}, current string, namespace *[]string) error {
	return FromCompositeObject(m, current, namespace,
		InspectNilPointers(AlwaysFalse),
		InspectEmptyContainers(AlwaysFalse),
		ExportJsonFieldNames(AlwaysFalse))
}
1036003
func (v *Widget) GetColormap() *gdk.Colormap {
	return gdk.ColormapFromUnsafe(unsafe.Pointer(C.gtk_widget_get_colormap(v.GWidget)))
}
592082
func (r *SourceRepository) UsedBy(ref ComponentReference) {
	r.usedBy = append(r.usedBy, ref)
}
125958
func (c Client) GetServiceExtensionMap(service *ServiceItem, app *ApplicationItem, extensionKey string) (map[string]string, error) {
	extensionData := ServiceExtensionLabels{}
	err := c.GetServiceExtension(app.TypeName, app.TypeVersion, service.TypeName, extensionKey, &extensionData)
	if err != nil {
		return nil, err
	}

	labels := map[string]string{}
	if extensionData.Label != nil {
		for _, label := range extensionData.Label {
			labels[label.Key] = label.Value
		}
	}

	return labels, nil
}
1097430
func findUnusedGKEClusterByVersion(clusterMap *Map, leaseMap *leases.Map, clusterVersion string) (*container.Cluster, error) {
	clusterNames := clusterMap.ClusterNamesByVersion(clusterVersion)
	if len(clusterNames) > 0 {
		for tries := 0; tries < 10; tries++ {
			clusterName := clusterNames[rand.Intn(len(clusterNames))]
			cluster, err := checkLease(clusterMap, leaseMap, clusterName)
			if err == nil {
				return cluster, nil
			}
		}
	}
	return nil, errUnusedGKEClusterNotFound
}
508708
func (v *NestedMixedx2) GetMapIntStrsetList() (o []map[int32]map[string]struct{}) {
	if v != nil && v.MapIntStrsetList != nil {
		return v.MapIntStrsetList
	}

	return
}
92506
func (r Network_CdnMarketplace_Configuration_Cache_Purge) GetPurgeHistoryPerMapping(uniqueId *string, saved *int) (resp []datatypes.Container_Network_CdnMarketplace_Configuration_Cache_Purge, err error) {
	params := []interface{}{
		uniqueId,
		saved,
	}
	err = r.Session.DoRequest("SoftLayer_Network_CdnMarketplace_Configuration_Cache_Purge", "getPurgeHistoryPerMapping", params, &r.Options, &resp)
	return
}
696
func GetUsage() Usage {
	memStats := new(runtime.MemStats)
	runtime.ReadMemStats(memStats)
	return Usage{
		Mem: memStats.Sys,
	}
}
1345367
func (c *Client) FindUserResourceMappings(ctx context.Context, filter platform.UserResourceMappingFilter, opt ...platform.FindOptions) ([]*platform.UserResourceMapping, int, error) {
	ms := []*platform.UserResourceMapping{}
	err := c.db.View(func(tx *bolt.Tx) error {
		mappings, err := c.findUserResourceMappings(ctx, tx, filter)
		if err != nil {
			return err
		}
		ms = mappings
		return nil
	})

	if err != nil {
		return nil, 0, err
	}

	return ms, len(ms), nil
}
297530
func (tc *WildcardTopicsToNumStreams) GetTopicsToNumStreamsMap() map[string]int {
	result := make(map[string]int)
	result[tc.TopicFilter.Regex()] = tc.NumStreams
	return result
}