Exemplo n.º 1
0
func Init(posting *store.Store, log *commit.Logger) {
	lhmap = gotomic.NewHash()
	dirtymap = gotomic.NewHash()
	pstore = posting
	clog = log
	go checkMemoryUsage()
}
Exemplo n.º 2
0
func BenchmarkGotomic(b *testing.B) {
	h := gotomic.NewHash()
	b.RunParallel(func(pb *testing.PB) {
		for pb.Next() {
			key := uint64(rand.Int63())
			_, has := h.Get(gotomic.IntKey(key))
			if !has {
				l := posting.NewList()
				h.Put(gotomic.IntKey(key), l)
			}
		}
	})
}
Exemplo n.º 3
0
func MergeLists(numRoutines int) {
	// We're merging all the lists, so just create a new dirtymap.
	dirtymap = gotomic.NewHash()

	ch := make(chan gotomic.Hashable, 10000)
	c := NewCounters()
	go c.periodicLog()
	defer c.ticker.Stop()
	go queueAll(ch, c)

	wg := new(sync.WaitGroup)
	for i := 0; i < numRoutines; i++ {
		wg.Add(1)
		go process(ch, c, wg)
	}
	wg.Wait()
	c.ticker.Stop()
}
Exemplo n.º 4
0
func NewGotomicMap() HashMap {
	return GotomicMap{gotomic.NewHash()}
}
Exemplo n.º 5
0
func Init(log *commit.Logger) {
	lhmap = gotomic.NewHash()
	dirtymap = gotomic.NewHash()
	clog = log
	go checkMemoryUsage()
}
Exemplo n.º 6
0
func (self *God) setupHashes() {
	for i := 0; i < len(self.hashes); i++ {
		self.hashes[i] = gotomic.NewHash()
	}
}