//----- update fingers ----------------------------------------------------- void update_fingers (f_node *nu) { chordID n = nu->ID; chord_nodelistextres *res = New chord_nodelistextres (); if (accordion) doRPC (nu, accordion_program_1, ACCORDIONPROC_GETFINGERS_EXT, &n, res, wrap (&update_fingers_got_fingers, nu->ID, nu->host, nu->port, res)); else doRPC (nu, fingers_program_1, FINGERSPROC_GETFINGERS_EXT, &n, res, wrap (&update_fingers_got_fingers, nu->ID, nu->host, nu->port, res)); }
void print_fingers (const chord_node &dst) { ptr<chordID> ga = New refcounted<chordID> (dst.x); chord_nodelistextres *lst = New chord_nodelistextres (); if (do_accordion) doRPC (dst, accordion_program_1, ACCORDIONPROC_GETFINGERS_EXT, ga, lst, wrap (processreslist_cb, "fingers", &fingers, lst)); else doRPC (dst, fingers_program_1, FINGERSPROC_GETFINGERS_EXT, ga, lst, wrap (processreslist_cb, "fingers", &fingers, lst)); outstanding++; }
long tcp_manager::doRPC_dead (ptr<location> l, const rpc_program &prog, int procno, ptr<void> in, void *out, aclnt_cb cb) { return doRPC (NULL, l, prog, procno, in, out, cb, NULL); }
int docmd(Client *C, char cmd) { int rc = 1; switch (cmd) { case 'd': proto_debug_on(); break; case 'D': proto_debug_off(); break; case 'r': rc = doRPC(C); break; case 'q': rc=-1; break; case '\n': rc=1; break; default: printf("Unkown Command\n"); } return rc; }
void getsucc (const chord_node &n) { chord_nodelistextres *res = New chord_nodelistextres (); doRPC (n, chord_program_1, succproc, &n.x, res, wrap (&getsucc_cb, getusec (), n, res)); }
long vnode_impl::doRPC (const chord_node &n, const rpc_program &prog, int procno, ptr<void> in, void *out, aclnt_cb cb, cbtmo_t cb_tmo, bool stream) { ptr<location> l = locations->lookup_or_create (n); return doRPC (l, prog, procno, in, out, cb, cb_tmo, stream); }
//----- update predecessor ------------------------------------------------- void update_pred (f_node *nu) { chordID n = nu->ID; chord_nodelistextres *res = New chord_nodelistextres (); doRPC (nu, chord_program_1, CHORDPROC_GETPRED_EXT, &n, res, wrap (&update_pred_got_pred, nu->ID, nu->host, nu->port, res)); }
void update_succlist (f_node *nu) { chordID n = nu->ID; chord_nodelistextres *res = New chord_nodelistextres (); doRPC (nu, chord_program_1, CHORDPROC_GETSUCC_EXT, &n, res, wrap (&update_succ_got_succ, nu->ID, nu->host, nu->port, res)); }
void vnode_impl::get_predecessor (ptr<location> n, cbchordID_t cb) { ptr<chordID> v = New refcounted<chordID> (n->id ()); ngetpredecessor++; chord_noderes *res = New chord_noderes (CHORD_OK); doRPC (n, chord_program_1, CHORDPROC_GETPREDECESSOR, v, res, wrap (mkref (this), &vnode_impl::get_predecessor_cb, n->id (), cb, res)); }
void getsucc (const chord_node &n) { chord_nodelistextres *res = New chord_nodelistextres (); u_int64_t start = getusec (); doRPC (n, CHORDPROC_GETSUCC_EXT, &n.x, res, wrap (&getsucc_cb, n.x, n.r.hostname, res, start)); }
void vnode_impl::get_succlist (ptr<location> n, cbchordIDlist_t cb) { ngetsucclist++; chord_nodelistres *res = New chord_nodelistres (CHORD_OK); ptr<chordID> v = New refcounted<chordID> (n->id ()); doRPC (n, chord_program_1, CHORDPROC_GETSUCCLIST, v, res, wrap (mkref (this), &vnode_impl::get_succlist_cb, cb, res)); }
void print_predecessors (const chord_node &dst) { ptr<chordID> ga = New refcounted<chordID> (dst.x); chord_nodelistextres *lst = New chord_nodelistextres (); doRPC (dst, chord_program_1, CHORDPROC_GETPRED_EXT, ga, lst, wrap (processreslist_cb, "predecessors", &predecessors, lst)); outstanding++; }
void vnode_impl::get_successor (ptr<location> n, cbchordID_t cb) { // warn << "get successor of " << n << "\n"; ngetsuccessor++; chord_noderes *res = New chord_noderes (CHORD_OK); ptr<chordID> v = New refcounted<chordID> (n->id ()); doRPC (n, chord_program_1, CHORDPROC_GETSUCCESSOR, v, res, wrap (mkref (this), &vnode_impl::get_successor_cb, n->id (), cb, res)); }
void vnode_impl::alert (ptr<location> n, ptr<location> x) { ptr<chord_nodearg> na = New refcounted<chord_nodearg>; chordstat *res = New chordstat; nalert++; warnx << "alert: " << x->id() << " died; notify " << n->id () << "\n"; x->fill_node (na->n); doRPC (n, chord_program_1, CHORDPROC_ALERT, na, res, wrap (mkref (this), &vnode_impl::alert_cb, res)); }
void vnode_impl::notify (ptr<location> n, chordID &x) { ptr<chord_nodearg> na = New refcounted<chord_nodearg>; chordstat *res = New chordstat; nnotify++; // warnx << gettime () << ": notify " << n << " about " << x << "\n"; locations->lookup (x)->fill_node (na->n); doRPC (n, chord_program_1, CHORDPROC_NOTIFY, na, res, wrap (mkref (this), &vnode_impl::notify_cb, n->id (), res)); }
void merkle_getkeyrange::go () { if (!betweenbothincl (rngmin, rngmax, current)) { trace << "merkle_getkeyrange::go () ==> DONE\n"; delete this; return; } ref<getkeys_arg> arg = New refcounted<getkeys_arg> (); arg->ctype = ctype; arg->vnode = vnode; arg->rngmin = current; arg->rngmax = rngmax; ref<getkeys_res> res = New refcounted<getkeys_res> (); doRPC (MERKLESYNC_GETKEYS, arg, res, wrap (this, &merkle_getkeyrange::getkeys_cb, arg, res)); }
void merkle_syncer::sendnode (u_int depth, const merkle_hash &prefix) { ref<sendnode_arg> arg = New refcounted<sendnode_arg> (); ref<sendnode_res> res = New refcounted<sendnode_res> (); u_int lnode_depth; merkle_node *lnode = ltree->lookup (&lnode_depth, depth, prefix); // OK to assert this: since depth-1 is an index node, we know that // it created all of its depth children when // it split. --FED assert (lnode); assert (lnode_depth == depth); format_rpcnode (ltree, depth, prefix, lnode, &arg->node); arg->vnode = vnode; arg->ctype = ctype; arg->rngmin = local_rngmin; arg->rngmax = local_rngmax; ltree->lookup_release(lnode); doRPC (MERKLESYNC_SENDNODE, arg, res, wrap (this, &merkle_syncer::sendnode_cb, deleted, arg, res)); }