Beispiel #1
0
func NewRecognizableBptree(maxDegree, maxDepth int, allowOverlap bool) (*RecognizableBptree, error) {
	bptree, err := NewBptree(maxDegree, maxDepth, allowOverlap)
	if err != nil {
		return nil, err
	}

	return &RecognizableBptree{
		Bptree:           bptree,
		lastModified:     -1,
		lastModifiedLock: new(sync.RWMutex),
		notifyQueue:      lfreequeue.NewQueue(),
	}, nil
}
Beispiel #2
0
// init memdb
func initMemdb() *luxStor {

	runtime.GOMAXPROCS(runtime.NumCPU())

	ls := &luxStor{memdb: memstore.New()}
	ls.memdb.SetKeyComparator(byteItemKeyCompare)
	ls.workQueue = lfreequeue.NewQueue()
	for i := 0; i < runtime.GOMAXPROCS(0); i++ {
		ls.writers = append(ls.writers, ls.memdb.NewWriter())
	}

	// create a queue of writers
	for i := 0; i < 128; i++ {
		w := ls.memdb.NewWriter()
		ls.workQueue.Enqueue(w)
	}

	return ls
}