func (a *AcknowledgedCounter) Acknowledge(value int64) {
	currentSlot := value & WindowMask
	if a.window[currentSlot] {
		panic("Too many unacknowledged insertion keys.")
	}
	a.window[currentSlot] = true
	if !a.lock.TryLock() {
		return
	}
	defer a.lock.Unlock()
	limit := atomic.LoadInt64(&a.limit)
	beforeFirstSlot := limit & WindowMask
	index := limit + 1
	for ; index != beforeFirstSlot; index++ {
		slot := index & WindowMask
		if !a.window[slot] {
			break
		}
		a.window[slot] = false
	}
	atomic.StoreInt64(&a.limit, index-1)
}
Acknowledge makes a generated counter vaailable via Last.
package generator
import (
	"math/rand"
	"sync/atomic"
	"github.com/pingcap/go-ycsb/pkg/util"
)
const (
	WindowSize int64 = 1 << 20
	WindowMask int64 = WindowSize - 1
)
type AcknowledgedCounter struct {
	c Counter
	lock util.SpinLock
	window []bool
	limit  int64
}
func NewAcknowledgedCounter(start int64) *AcknowledgedCounter {
	return &AcknowledgedCounter{
		c:      Counter{counter: start},
		lock:   util.SpinLock{},
		window: make([]bool, WindowSize),
		limit:  start - 1,
	}
}
func (a *AcknowledgedCounter) Next(r *rand.Rand) int64 {
	return a.c.Next(r)
}
func (a *AcknowledgedCounter) Last() int64 {
	return atomic.LoadInt64(&a.limit)
}