Пример #1
0
void rice::p2p::past::gc::GCPastImpl::reInsert(::rice::p2p::commonapi::Id* id, ::rice::Continuation* command)
{
    if(dynamic_cast< GCId* >(id) != nullptr) {
        npc(storage)->getObject(npc((java_cast< GCId* >(id)))->getId(), new GCPastImpl_reInsert_11(this, id, command));
    } else {
        auto metadata = java_cast< GCPastMetadata* >(npc(storage)->getMetadata(id));
        if(metadata == nullptr) {
            super::reInsert(id, command);
        } else {
            reInsert(static_cast< ::rice::p2p::commonapi::Id* >(new GCId(id, npc(metadata)->getExpiration())), command);
        }
    }
}
Пример #2
0
/** Invoke ChooseSubtree, with the level as a parameter, to find an appropriate node N, in which to place the new entry E.
  *
  * If N has less than M entries, accommodate E in N.
  * If N has M entries, invoke OverflowTreatment with the level of N as a parameter [for reinsertion or split].
  *
  * If OverflowTreatment was called and a plit was performed, propagate OverflowTreatment upwards if necessary.
  * If OverflowTreatment caused a split of the root, create a new root.
  *
  * Adjust all covering rectangles in the insertion path such that they are minimum bounding boxes enclosing their children rectangles.
  *
  * --------------------------------------------------
  *
  * [OverflowTreatment]
  * If the level is not the root level and this is the first call of OverflowTreatment in the given level during the insertion of one data rectangle, then invoke ReInsert.
  * Else invoke Split.
  */
void RSTree::insert(NodePtr cPtr, EntryPtr ePtr, int desiredLevel, int &overflowLevel)
{
    /// Bits of overflowLevel indicate first time overflow of the corresponding level
    Mbr &mbr = (desiredLevel ? cPtr->mbr : ePtr->mbr);
    NodePtr nPtr = chooseSubtree(mbr, desiredLevel);
    if(desiredLevel) // if desiredLevel is not leaf node level
        nPtr->insert(cPtr);
    else // if desiredLevel is leaf node level
        nPtr->insert(ePtr);

    while(nPtr) // while node is not NULL
    {
        while(nPtr->size() > RSTree::maxChild)
        {
            if(overflowLevel & (1<<nPtr->level))
                split(*nPtr);
            else
                reInsert(*nPtr, overflowLevel);
        }
        nPtr = nPtr->parent;
    }
}