func (p *memPostings) All() index.Postings {
	return p.Get(AllPostingsKey())
}
All returns a postings list over all documents ever added.
package prom
import (
	"runtime"
	"sort"
	"strings"
	"sync"
	"github.com/prometheus/prometheus/pkg/labels"
	"github.com/prometheus/prometheus/tsdb/index"
)
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
}
func (p *memPostings) Get(name, value string) index.Postings {
	var lp []uint64
	p.mtx.RLock()
	l := p.m[name]
	if l != nil {
		lp = l[value]
	}
	p.mtx.RUnlock()
	if lp == nil {
		return index.EmptyPostings()
	}
	return index.NewListPostings(lp)
}
func (p *memPostings) UnsafeGet(name, value string) index.Postings {
	var lp []uint64
	l := p.m[name]
	if l != nil {
		lp = l[value]
	}
	if lp == nil {
		return index.EmptyPostings()
	}
	return index.NewListPostings(lp)
}