// fragCombos returns a map (by uri) of lists of fragments for a given index
// by creating every combination of field/view specified in `fieldViews` up
// for the given set of shards with data.
10072
func (c *cluster) fragCombos(idx string, availableShards *roaring.Bitmap, fieldViews viewsByField) fragsByHost {
	t := make(fragsByHost)
	availableShards.ForEach(func(i uint64) {
		nodes := c.shardNodes(idx, i)
		for _, n := range nodes {
			// for each field/view combination:
			for field, views := range fieldViews {
				for _, view := range views {
					t[n.ID] = append(t[n.ID], frag{field, view, i})
				}
			}
		}
	})
	return t
}
902094
func tagsToMapEFS(ts []*efs.Tag) map[string]string {
	result := make(map[string]string)
	for _, t := range ts {
		if !tagIgnoredEFS(t) {
			result[*t.Key] = *t.Value
		}
	}

	return result
}
1255179
func ParseTagSliceToMap(tags []string) map[string]string {
	mappedTags := make(map[string]string)
	for _, tag := range tags {
		splt := strings.SplitN(tag, ":", 2)
		if len(splt) < 2 {
			mappedTags[splt[0]] = ""
		} else {
			mappedTags[splt[0]] = splt[1]
		}
	}
	return mappedTags
}
472263
func SimpleHashFromMap(m map[string][]byte) []byte {
	sm := newSimpleMap()
	for k, v := range m {
		sm.Set(k, v)
	}
	return sm.Hash()
}
928551
func (h *Holder) fragment(index, field, view string, shard uint64) *fragment {
	v := h.view(index, field, view)
	if v == nil {
		return nil
	}
	return v.Fragment(shard)
}
758575
func (o *L2Domain) EgressACLTemplates(info *bambou.FetchingInfo) (EgressACLTemplatesList, *bambou.Error) {

	var list EgressACLTemplatesList
	err := bambou.CurrentSession().FetchChildren(o, EgressACLTemplateIdentity, &list, info)
	return list, err
}
50206
func tagsFromMapECS(tagMap map[string]interface{}) []*ecs.Tag {
	tags := make([]*ecs.Tag, 0, len(tagMap))
	for tagKey, tagValueRaw := range tagMap {
		tag := &ecs.Tag{
			Key:   aws.String(tagKey),
			Value: aws.String(tagValueRaw.(string)),
		}
		if !tagIgnoredECS(tag) {
			tags = append(tags, tag)
		}
	}

	return tags
}
363717
func (c *Client) IndexSegments(indices ...string) *IndicesSegmentsService {
	return NewIndicesSegmentsService(c).Index(indices...)
}
931018
func (e Event) GoEvtxMap(c *Chunk) (pge *GoEvtxMap, err error) {
	// An Event can contain only BinXMLFragments
	if !e.IsValid() {
		err = ErrInvalidEvent
		return
	}
	reader := bytes.NewReader(c.Data)
	GoToSeeker(reader, e.Offset+EventHeaderSize)
	// Bug here if we put c
	element, err := Parse(reader, c, false)
	if err != nil && err != io.EOF {
		//panic(err)
		log.Error(err)
	}
	// If not a BinXMLFragment a panic will be raised
	fragment, ok := element.(*Fragment)
	switch {
	case !ok && ModeCarving:
		return
	case !ok:
		// Way to raise panic
		_ = element.(*Fragment)
	}
	return fragment.GoEvtxMap(), err
}
1262808
func newFragment(path, index, field, view string, shard uint64) *fragment {
	return &fragment{
		path:      path,
		index:     index,
		field:     field,
		view:      view,
		shard:     shard,
		CacheType: DefaultCacheType,
		CacheSize: DefaultCacheSize,

		Logger: logger.NopLogger,
		MaxOpN: defaultFragmentMaxOpN,

		stats: stats.NopStatsClient,
	}
}
1146861
func (v *view) allFragments() []*fragment {
	v.mu.Lock()
	defer v.mu.Unlock()

	other := make([]*fragment, 0, len(v.fragments))
	for _, fragment := range v.fragments {
		other = append(other, fragment)
	}
	return other
}
237788
func processIndexMap(jsonFragment map[string]interface{}) error {

	//iterate the item in the map
	for jsonKey, jsonValue := range jsonFragment {

		switch jsonKey {

		case "fields":

			switch jsonValueType := jsonValue.(type) {

			case []interface{}:

				//iterate the index field objects
				for _, itemValue := range jsonValueType {

					switch reflect.TypeOf(itemValue).Kind() {

					case reflect.String:
						//String is a valid field descriptor  ex: "color", "size"
						logger.Debugf("Found index field name: \"%s\"", itemValue)

					case reflect.Map:
						//Handle the case where a sort is included  ex: {"size":"asc"}, {"color":"desc"}
						err := validateFieldMap(itemValue.(map[string]interface{}))
						if err != nil {
							return err
						}

					}
				}

			default:
				return fmt.Errorf("Expecting a JSON array of fields")
			}

		case "partial_filter_selector":

			//TODO - add support for partial filter selector, for now return nil
			//Take no other action, will be considered valid for now

		default:

			//if anything other than "fields" or "partial_filter_selector" was found,
			//return an error
			return fmt.Errorf("Invalid Entry.  Entry %s", jsonKey)

		}

	}

	return nil

}
982305
func (op *Operator) SegmentList(q *QueryOptions) ([]string, *QueryMeta, error) {
	var out []string
	qm, err := op.c.query("/v1/operator/segment", &out, q)
	if err != nil {
		return nil, nil, err
	}
	return out, qm, nil
}
1333756
func (o *L2DomainTemplate) OverlayMirrorDestinationTemplates(info *bambou.FetchingInfo) (OverlayMirrorDestinationTemplatesList, *bambou.Error) {

	var list OverlayMirrorDestinationTemplatesList
	err := bambou.CurrentSession().FetchChildren(o, OverlayMirrorDestinationTemplateIdentity, &list, info)
	return list, err
}
70268
func FragmentFlags(flags uint8) NetworkChecker {
	return func(t *testing.T, h []header.Network) {
		t.Helper()

		// We only do this of IPv4 for now.
		switch ip := h[0].(type) {
		case header.IPv4:
			if v := ip.Flags(); v != flags {
				t.Errorf("Bad fragment offset, got %v, want %v", v, flags)
			}
		}
	}
}
612522
func (f *fragment) Snapshot() error {
	f.mu.Lock()
	defer f.mu.Unlock()
	return f.snapshot()
}
769136
func (cm AsStandard) MColumnGroupSet(resource, class string) *metadata.MColumnGroupSet {
	mcgs := metadata.MColumnGroupSet{}
	for _, cd := range cm.Elements[metadata.MIColumnGroupSet.Name] {
		if cd.Attr["Resource"] != resource {
			continue
		}
		if cd.Attr["Class"] != class {
			continue
		}
		metadata.FieldTransfer(cd.Attr).To(&mcgs)
		for _, entry := range cd.Entries() {
			tmp := metadata.ColumnGroupSet{}
			entry.SetFields(&tmp)
			mcgs.ColumnGroupSet = append(mcgs.ColumnGroupSet, tmp)
		}
	}
	return &mcgs
}