Пример #1
0
        // Create a new SkipList object that will use "cmp" for comparing keys,
        // and will allocate memory using "*arena".  Objects allocated in the arena
        // must remain allocated for the lifetime of the skiplist object.
        public SkipList(KeyComparator cmp)
        {
            compare_ = cmp;

            head_ = NewNode(new ByteArrayPointer(0), kMaxHeight);
            max_height_ = new AtomicInteger(1);
            // 0xdeadbeef
            rnd_ = new Random(-559038737);
            for (int i = 0; i < kMaxHeight; i++)
            {
                head_.SetNext(i, null);
            }
        }
Пример #2
0
 public MemTable(InternalKeyComparator cmp)
 {
     m_comparator = new KeyComparator(cmp);
     m_refs = 0;
     m_table = new SkipList(m_comparator);
 }