private BTreeRange fieldIndexKeySearch(Transaction trans, BTree btree, Object key) {
   // SearchTarget should not make a difference, HIGHEST is faster
   BTreeNodeSearchResult start =
       btree.searchLeaf(trans, fieldIndexKey(0, key), SearchTarget.LOWEST);
   BTreeNodeSearchResult end =
       btree.searchLeaf(trans, fieldIndexKey(Integer.MAX_VALUE, key), SearchTarget.LOWEST);
   return start.createIncludingRange(end);
 }
Esempio n. 2
0
 public void mapId(int id, Slot slot) {
   _slotTree.add(trans(), new IdSlotMapping(id, slot.address(), slot.length()));
   if (_commitFrequency > 0) {
     _slotInsertCount++;
     if (_commitFrequency == _slotInsertCount) {
       _slotTree.commit(trans());
       _slotInsertCount = 0;
     }
   }
 }
Esempio n. 3
0
 protected void mapNonClassIDs(int origID, int mappedID) {
   _cache = new MappedIDPair(origID, mappedID);
   _idTree.add(trans(), _cache);
   if (_commitFrequency > 0) {
     _idInsertCount++;
     if (_commitFrequency == _idInsertCount) {
       _idTree.commit(trans());
       _idInsertCount = 0;
     }
   }
 }
Esempio n. 4
0
 public int addressForId(int id) {
   BTreeRange range = _slotTree.searchRange(trans(), new IdSlotMapping(id, 0, 0));
   Iterator4 pointers = range.pointers();
   if (pointers.moveNext()) {
     BTreePointer pointer = (BTreePointer) pointers.current();
     return ((IdSlotMapping) pointer.key())._address;
   }
   return 0;
 }
Esempio n. 5
0
 public int mappedId(int oldID) {
   if (_cache.orig() == oldID) {
     return _cache.mapped();
   }
   int classID = mappedClassID(oldID);
   if (classID != 0) {
     return classID;
   }
   BTreeRange range = _idTree.searchRange(trans(), new MappedIDPair(oldID, 0));
   Iterator4 pointers = range.pointers();
   if (pointers.moveNext()) {
     BTreePointer pointer = (BTreePointer) pointers.current();
     _cache = (MappedIDPair) pointer.key();
     return _cache.mapped();
   }
   return 0;
 }
 public void processBTree(final DefragmentServicesImpl context, BTree btree)
     throws CorruptionException, IOException {
   btree.defragBTree(context);
 }