Beispiel #1
0
void petabricks::DistributedGC::onNotify(int stage) {
  if(stage == FLUSH_MSGS) {
    remoteNotify(DO_SCAN);
  }else if(stage == DO_SCAN) {
    std::vector<EncodedPtr> response;
    scan(response);
    if(! response.empty() ) {
      unlock();
      send(&response[0], sizeof(EncodedPtr)*response.size());
      lock();
    }else{
      remoteNotify(ABORT_GC);
      finishup();
    }
  }else if(stage == ABORT_GC) {
    finishup();
  }else UNIMPLEMENTED();
}
Beispiel #2
0
/* This function is called periodically. It checks the immediate successor of the current node. */
void Node::stabilize()
{
  XBT_DEBUG("Stabilizing node");

  // get the predecessor of my immediate successor
  int candidate_id = pred_id_;
  int successor_id = fingers_[0];
  if (successor_id != id_)
    candidate_id = remoteGetPredecessor(successor_id);

  // this node is a candidate to become my new successor
  if (candidate_id != -1 && is_in_interval(candidate_id, id_ + 1, successor_id - 1)) {
    setFinger(0, candidate_id);
  }
  if (successor_id != id_) {
    remoteNotify(successor_id, id_);
  }
}
Beispiel #3
0
void petabricks::DistributedGC::onCreated() {
  host()->swapObjects(_objects, _gen);
  remoteNotify(FLUSH_MSGS);
}