示例#1
0
func (mh *MossHerder) OnPersisterProgress(c moss.Collection) {
	if c.Options().LowerLevelUpdate == nil {
		return
	}

	mh.m.Lock()

	if mh.waiting > 0 {
		log.Printf("moss_herder: persistence progess, waiting: %d", mh.waiting)
	}

	mh.waitCond.Broadcast()

	mh.m.Unlock()
}
示例#2
0
func (mh *MossHerder) OnBatchExecuteStart(c moss.Collection) {
	if c.Options().LowerLevelUpdate == nil {
		return
	}

	mh.m.Lock()

	mh.collections[c] = struct{}{}

	for mh.overMemQuotaLOCKED() {
		// If we're over the memory quota, then wait for persister progress.
		mh.waiting++
		mh.waitCond.Wait()
		mh.waiting--
	}

	mh.m.Unlock()
}