Пример #1
0
//  Snapshot places a snapshot request onto the snapshot queue.
func (bh *BufferHist) Snapshot(buff buffer.Buffer, mc cursor.MultiCursor) {
	request := BufferState{
		buff: buff.Dup(),
		mc:   mc.Dup(),
	}

	bh.reqMutex.Lock()
	bh.snapReq = request
	bh.reqMutex.Unlock()

	select {
	case bh.snapChan <- struct{}{}:
	default:
	}
}
Пример #2
0
// ForceSnapshot forces a snapshot rather than requesting one.
func (bh *BufferHist) ForceSnapshot(buff buffer.Buffer, mc cursor.MultiCursor) {
	bh.snapshot(buff.Dup(), mc.Dup())
}