func (tree *tree) init(bufferSize, ary uint64) { tree.bufferSize = bufferSize tree.ary = ary tree.cache = make([]interface{}, 0, bufferSize) tree.root = newNode(true, newKeys(ary), newNodes(ary)) tree.root.mbr = &rectangle{} tree.actions = queue.NewRingBuffer(tree.bufferSize) }
func (ptree *ptree) init(bufferSize, ary uint64) { ptree.bufferSize = bufferSize ptree.ary = ary ptree.cache = make([]interface{}, 0, bufferSize) ptree.root = newNode(true, newKeys(ary), newNodes(ary)) ptree.actions = queue.NewRingBuffer(ptree.bufferSize) ptree.kbRing = queue.NewRingBuffer(1024) for i := uint64(0); i < ptree.kbRing.Cap(); i++ { ptree.kbRing.Put(&keyBundle{}) } ptree.disposeChannel = make(chan bool) ptree.mpChannel = make(chan map[*node][]*keyBundle, 1024) var wg sync.WaitGroup wg.Add(1) go ptree.disposer(&wg) wg.Wait() }
func newCtrie(root *iNode, hashFactory HashFactory, readOnly bool) *Ctrie { hasherPool := queue.NewRingBuffer(hasherPoolSize) for i := 0; i < hasherPoolSize; i++ { hasherPool.Put(hashFactory()) } return &Ctrie{ root: root, hashFactory: hashFactory, hasherPool: hasherPool, readOnly: readOnly, } }