// run the command or send it to the right nodes char *route_command(struct nli *nli, int who, char *rmt, char *cmd, char *buf, char *uq) { char *r = NULL; switch (who) { // run local case 0: r = run_local(nli, cmd); break; // run on specified remote case 1: r = run_remote(rmt, buf, cmd, uq); break; // run on all case 2: r = run_all(nli, cmd, buf, uq); if (check_if_trace(cmd)) { char *tmp = NULL; tmp = str_replace("\n|", "\n ", r); if (r) free(r); r = tmp; } break; } return r; }
group create_global_group(client<mailing_list_state>& ct, groups g){ assert(g._ro); #ifdef USE_PRECOMPILED constexpr #include "mailing_list_create_group.cpp.precompiled" txn; #else constexpr auto txn = TRANSACTION( var new_group = g->value, /* cut off the users list */ new_group.users->next = new_group.users->next.nulled(), var new_grouplist_node = *g, new_grouplist_node.value = new_group, g->next = g.new(new_grouplist_node), return new_group ).WITH(g); #endif using connections = typename DECT(ct.trk)::connection_references; auto strong_connection = ct.get_relay<Level::strong>().lock(); auto causal_connection = ct.get_relay<Level::causal>().lock(); return txn.run_remote(ct.trk,&ct.dsm, connections{ConnectionReference<Label<strong> >{*strong_connection},ConnectionReference<Label<causal> >{*causal_connection}},g); }
static int run_interactive(int fd, int argc, char *argv[]) { printf("[....] attaching interactive session"); return run_remote(fd, "INTERACTIVE"); }
static int run_debug(int fd, int argc, char *argv[]) { printf("[....] attaching remote debugger"); return run_remote(fd, "DEBUG"); }