func (p *MemPostings) Get(name, value string) Postings {
	var lp []uint64
	p.mtx.RLock()
	l := p.m[name]
	if l != nil {
		lp = l[value]
	}
	p.mtx.RUnlock()
	if lp == nil {
		return EmptyPostings()
	}
	return newListPostings(lp...)
}
Get returns a postings list for the given label pair.
package index
import (
	"container/heap"
	"encoding/binary"
	"runtime"
	"sort"
	"strings"
	"sync"
	"github.com/prometheus/prometheus/tsdb/labels"
)
var allPostingsKey = labels.Label{}
func AllPostingsKey() (name, value string) {
	return allPostingsKey.Name, allPostingsKey.Value
}
type MemPostings struct {
	mtx     sync.RWMutex
	m       map[string]map[string][]uint64
	ordered bool
}
func NewMemPostings() *MemPostings {
	return &MemPostings{
		m:       make(map[string]map[string][]uint64, 512),
		ordered: true,
	}
}
func NewUnorderedMemPostings() *MemPostings {
	return &MemPostings{
		m:       make(map[string]map[string][]uint64, 512),
		ordered: false,
	}
}
func (p *MemPostings) SortedKeys() []labels.Label {
	p.mtx.RLock()
	keys := make([]labels.Label, 0, len(p.m))
	for n, e := range p.m {
		for v := range e {
			keys = append(keys, labels.Label{Name: n, Value: v})
		}
	}
	p.mtx.RUnlock()
	sort.Slice(keys, func(i, j int) bool {
		if d := strings.Compare(keys[i].Name, keys[j].Name); d != 0 {
			return d < 0
		}
		return keys[i].Value < keys[j].Value
	})
	return keys
}
type PostingsStats struct {
	CardinalityMetricsStats []Stat
	CardinalityLabelStats   []Stat
	LabelValueStats         []Stat
	LabelValuePairsStats    []Stat
}
func (p *MemPostings) Stats(label string) *PostingsStats {
	const maxNumOfRecords = 10
	var size uint64
	p.mtx.RLock()
	metrics := &maxHeap{}
	labels := &maxHeap{}
	labelValueLenght := &maxHeap{}
	labelValuePairs := &maxHeap{}
	metrics.init(maxNumOfRecords)
	labels.init(maxNumOfRecords)
	labelValueLenght.init(maxNumOfRecords)
	labelValuePairs.init(maxNumOfRecords)
	for n, e := range p.m {
		if n == "" {
			continue
		}
		labels.push(Stat{Name: n, Count: uint64(len(e))})
		size = 0
		for name, values := range e {
			if n == label {
				metrics.push(Stat{Name: name, Count: uint64(len(values))})
			}
			labelValuePairs.push(Stat{Name: n + "=" + name, Count: uint64(len(values))})
			size += uint64(len(name))
		}
		labelValueLenght.push(Stat{Name: n, Count: size})
	}
	p.mtx.RUnlock()
	return &PostingsStats{
		CardinalityMetricsStats: metrics.get(),
		CardinalityLabelStats:   labels.get(),
		LabelValueStats:         labelValueLenght.get(),
		LabelValuePairsStats:    labelValuePairs.get(),
	}
}