vere: effectively removes single-homing from the serf

but leaves the IPC protocol structures as they were
This commit is contained in:
Joe Bryan 2019-11-23 18:50:13 -08:00
parent 9c82eadd11
commit d1b655c5c9
4 changed files with 40 additions and 78 deletions

View File

@ -13,8 +13,8 @@
u3_noun wen; // current time, as text u3_noun wen; // current time, as text
u3_noun sev_l; // instance number u3_noun sev_l; // instance number
u3_noun sen; // instance string u3_noun sen; // instance string
u3_noun our; // identity u3_noun our; // identity XX Remove
u3_noun fak; // c3y is fake u3_noun fak; // c3y is fake XX Remove
u3_noun roc; // kernel core u3_noun roc; // kernel core
} u3v_arvo; } u3v_arvo;

View File

@ -1659,8 +1659,6 @@ u3m_boot(c3_c* dir_c)
/* Basic initialization. /* Basic initialization.
*/ */
memset(u3A, 0, sizeof(*u3A)); memset(u3A, 0, sizeof(*u3A));
u3A->our = u3_none;
return 0; return 0;
} }
} }
@ -1692,8 +1690,6 @@ u3m_boot_lite(void)
/* Basic initialization. /* Basic initialization.
*/ */
memset(u3A, 0, sizeof(*u3A)); memset(u3A, 0, sizeof(*u3A));
u3A->our = u3_none;
return 0; return 0;
} }

View File

@ -254,25 +254,11 @@ _pier_db_load_commits(u3_pier* pir_u,
c3_d lav_d, c3_d lav_d,
c3_d len_d) c3_d len_d)
{ {
if (lav_d == 1) { if ( 1ULL == lav_d ) {
// We are restarting from event 1. That means we need to set the ship from // We are replaying the entire event log, and must
// the log identity information. // read the header to ensure that our %boot msg is correct.
u3_noun who, fak, len; //
c3_o ret = u3_lmdb_read_identity(pir_u->log_u->db_u, _pier_db_read_header(pir_u);
&who,
&fak,
&len);
if (ret == c3n) {
u3l_log("Failed to load identity for replay. Exiting...");
u3_pier_bail();
}
_pier_boot_set_ship(pir_u, u3k(who), u3k(fak));
pir_u->lif_d = u3r_chub(0, len);
u3z(who);
u3z(fak);
u3z(len);
} }
c3_o ret = u3_lmdb_read_events(pir_u, c3_o ret = u3_lmdb_read_events(pir_u,
@ -910,37 +896,30 @@ _pier_work_poke(void* vod_p,
// the worker process starts with a %play task, // the worker process starts with a %play task,
// which tells us where to start playback // which tells us where to start playback
// (and who we are, if it knows) XX remove in favor of event-log header //
// XX [our fak] ignored. Remove
// //
case c3__play: { case c3__play: {
c3_d lav_d; c3_d lav_d;
c3_l mug_l; c3_l mug_l;
if ( (c3n == u3r_qual(u3t(jar), 0, &p_jar, &q_jar, &r_jar)) || if ( u3_nul == u3t(jar) ) {
(c3n == u3ud(p_jar)) || lav_d = 1ULL;
(u3r_met(6, p_jar) != 1) || mug_l = 0;
(c3n == u3ud(q_jar)) || }
(u3r_met(5, p_jar) != 1) || else {
(c3n == u3du(r_jar)) || if ( (c3n == u3r_qual(u3t(jar), 0, &p_jar, &q_jar, 0)) ||
(c3n == u3ud(u3h(r_jar))) || (c3n == u3ud(p_jar)) ||
((c3y != u3t(r_jar)) && (c3n != u3t(r_jar))) ) (u3r_met(6, p_jar) != 1) ||
{ (c3n == u3ud(q_jar)) ||
if ( u3_nul == u3t(jar) ) { (u3r_met(5, q_jar) != 1) )
lav_d = 1ULL; {
mug_l = 0;
}
else {
goto error; goto error;
} }
} else {
lav_d = u3r_chub(0, p_jar);
if ( u3_nul != u3t(jar) ) { mug_l = u3r_word(0, q_jar);
lav_d = u3r_chub(0, p_jar); }
mug_l = u3r_word(0, q_jar);
// single-home
//
_pier_boot_set_ship(pir_u, u3k(u3h(r_jar)), u3k(u3t(r_jar)));
} }
_pier_work_play(pir_u, lav_d, mug_l); _pier_work_play(pir_u, lav_d, mug_l);

View File

@ -857,13 +857,9 @@ _worker_poke_exit(c3_w cod_w) // exit code
/* _worker_poke_boot(): prepare to boot. /* _worker_poke_boot(): prepare to boot.
*/ */
static void static void
_worker_poke_boot(u3_noun who, u3_noun fak, c3_w len_w) _worker_poke_boot(c3_w len_w)
{ {
c3_assert( u3_none == u3A->our );
c3_assert( 0 != len_w ); c3_assert( 0 != len_w );
u3A->our = who;
u3A->fak = fak;
u3V.len_w = len_w; u3V.len_w = len_w;
} }
@ -883,15 +879,13 @@ _worker_poke(void* vod_p, u3_noun mat)
goto error; goto error;
} }
// XX [our fak] ignored. Remove
//
case c3__boot: { case c3__boot: {
u3_noun who, fak, len; u3_noun len;
c3_w len_w; c3_w len_w;
if ( (c3n == u3r_qual(jar, 0, &who, &fak, &len)) || if ( (c3n == u3r_qual(jar, 0, 0, 0, &len)) ||
(c3n == u3ud(who)) ||
(1 < u3r_met(7, who)) ||
(c3n == u3ud(fak)) ||
(1 < u3r_met(0, fak)) ||
(c3n == u3ud(len)) || (c3n == u3ud(len)) ||
(1 < u3r_met(3, len)) ) (1 < u3r_met(3, len)) )
{ {
@ -899,11 +893,8 @@ _worker_poke(void* vod_p, u3_noun mat)
} }
len_w = u3r_word(0, len); len_w = u3r_word(0, len);
u3k(who);
u3k(fak);
u3z(jar); u3z(jar);
return _worker_poke_boot(len_w);
return _worker_poke_boot(who, fak, len_w);
} }
case c3__work: { case c3__work: {
@ -986,22 +977,18 @@ u3_worker_boot(void)
c3_d nex_d = 1ULL; c3_d nex_d = 1ULL;
u3_noun dat = u3_nul; u3_noun dat = u3_nul;
if ( u3_none != u3A->our ) { if ( 0 != u3V.dun_d ) {
u3V.mug_l = u3r_mug(u3A->roc);
nex_d = u3V.dun_d + 1ULL;
dat = u3nc(u3_nul, u3nt(u3i_chubs(1, &nex_d),
u3V.mug_l,
u3nc(u3k(u3A->our), u3k(u3A->fak))));
// disable hashboard for fake ships
//
if ( c3y == u3A->fak ) {
u3C.wag_w |= u3o_hashless;
}
// no boot sequence expected // no boot sequence expected
// //
u3V.len_w = 0; u3V.len_w = 0;
u3V.mug_l = u3r_mug(u3A->roc);
nex_d = u3V.dun_d + 1ULL;
// XX [our fak] is unused/ignored. Remove.
// Temporarily defaulted to [~zod fake=&]
//
dat = u3nc(u3_nul, u3nt(u3i_chubs(1, &nex_d),
u3V.mug_l,
u3nc(0, 0)));
} }
u3l_log("work: play %" PRIu64 "\r\n", nex_d); u3l_log("work: play %" PRIu64 "\r\n", nex_d);