From 3965b261d1f945741a18d2628c4199a6e6013847 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Sat, 27 Jun 2020 00:59:31 -0700 Subject: [PATCH] vere: refactors ovum scheduling api --- pkg/urbit/include/vere/vere.h | 6 +----- pkg/urbit/vere/auto.c | 8 +------- pkg/urbit/vere/io/ames.c | 5 +++-- pkg/urbit/vere/io/behn.c | 4 ++-- pkg/urbit/vere/io/cttp.c | 4 ++-- pkg/urbit/vere/io/fore.c | 6 +++--- pkg/urbit/vere/io/hind.c | 2 +- pkg/urbit/vere/io/http.c | 8 ++++---- pkg/urbit/vere/io/term.c | 2 +- pkg/urbit/vere/io/unix.c | 4 ++-- 10 files changed, 20 insertions(+), 29 deletions(-) diff --git a/pkg/urbit/include/vere/vere.h b/pkg/urbit/include/vere/vere.h index 38e3d4aba8..f3e12e8654 100644 --- a/pkg/urbit/include/vere/vere.h +++ b/pkg/urbit/include/vere/vere.h @@ -842,11 +842,7 @@ /* u3_auto_plan(): create and enqueue an ovum. */ u3_ovum* - u3_auto_plan(u3_auto* car_u, - c3_w mil_w, - u3_noun tar, - u3_noun wir, - u3_noun cad); + u3_auto_plan(u3_auto* car_u, u3_ovum* egg_u); /* u3_auto_peer(): subscribe to updates. */ diff --git a/pkg/urbit/vere/auto.c b/pkg/urbit/vere/auto.c index d163d576fc..9fedc7017b 100644 --- a/pkg/urbit/vere/auto.c +++ b/pkg/urbit/vere/auto.c @@ -22,14 +22,8 @@ /* u3_auto_plan(): create and enqueue an ovum. */ u3_ovum* -u3_auto_plan(u3_auto* car_u, - c3_w mil_w, - u3_noun tar, - u3_noun wir, - u3_noun cad) +u3_auto_plan(u3_auto* car_u, u3_ovum *egg_u) { - u3_ovum *egg_u = u3_ovum_init(mil_w, tar, wir, cad); - egg_u->car_u = car_u; // [pre_u] points towards [ext_u] (back in time) diff --git a/pkg/urbit/vere/io/ames.c b/pkg/urbit/vere/io/ames.c index 45c8689cc7..be2c970a2c 100644 --- a/pkg/urbit/vere/io/ames.c +++ b/pkg/urbit/vere/io/ames.c @@ -471,7 +471,8 @@ _ames_recv_cb(uv_udp_t* wax_u, } u3_auto_peer( - u3_auto_plan(&sam_u->car_u, 0, c3__a, wir, cad), + u3_auto_plan(&sam_u->car_u, + u3_ovum_init(0, c3__a, wir, cad)), 0, _ames_hear_bail); _ames_cap_queue(sam_u); @@ -596,7 +597,7 @@ _ames_io_talk(u3_auto* car_u) u3_noun wir = u3nt(c3__newt, u3k(u3A->sen), u3_nul); u3_noun cad = u3nc(c3__born, u3_nul); - u3_auto_plan(car_u, 0, c3__a, wir, cad); + u3_auto_plan(car_u, u3_ovum_init(0, c3__a, wir, cad)); } } diff --git a/pkg/urbit/vere/io/behn.c b/pkg/urbit/vere/io/behn.c index 4885c1c3b2..5fa639da22 100644 --- a/pkg/urbit/vere/io/behn.c +++ b/pkg/urbit/vere/io/behn.c @@ -47,7 +47,7 @@ _behn_time_cb(uv_timer_t* tim_u) u3_noun wir = u3nc(c3__behn, u3_nul); u3_noun cad = u3nc(c3__wake, u3_nul); - u3_auto_plan(&teh_u->car_u, 0, c3__b, wir, cad); + u3_auto_plan(&teh_u->car_u, u3_ovum_init(0, c3__b, wir, cad)); } } @@ -143,7 +143,7 @@ _behn_io_talk(u3_auto* car_u) u3_noun cad = u3nc(c3__born, u3_nul); u3_auto_peer( - u3_auto_plan(car_u, 0, c3__b, wir, cad), + u3_auto_plan(car_u, u3_ovum_init(0, c3__b, wir, cad)), _behn_born_news, _behn_born_bail); } diff --git a/pkg/urbit/vere/io/cttp.c b/pkg/urbit/vere/io/cttp.c index 81ad44384e..691278b3a1 100644 --- a/pkg/urbit/vere/io/cttp.c +++ b/pkg/urbit/vere/io/cttp.c @@ -721,7 +721,7 @@ _cttp_http_client_receive(u3_creq* ceq_u, c3_w sas_w, u3_noun mes, u3_noun uct) ceq_u->num_l, u3nq(u3i_string("start"), u3nc(sas_w, mes), uct, c3y)); - u3_auto_plan(&ceq_u->ctp_u->car_u, 0, c3__i, wir, cad); + u3_auto_plan(&ceq_u->ctp_u->car_u, u3_ovum_init(0, c3__i, wir, cad)); } /* _cttp_creq_fail(): dispatch error response @@ -1020,7 +1020,7 @@ _cttp_io_talk(u3_auto* car_u) u3_noun wir = u3nt(u3i_string("http-client"), u3k(u3A->sen), u3_nul); u3_noun cad = u3nc(c3__born, u3_nul); - u3_auto_plan(car_u, 0, c3__i, wir, cad); + u3_auto_plan(car_u, u3_ovum_init(0, c3__i, wir, cad)); } /* _cttp_io_kick(): apply effects diff --git a/pkg/urbit/vere/io/fore.c b/pkg/urbit/vere/io/fore.c index 32b5436e45..4691e8a6e6 100644 --- a/pkg/urbit/vere/io/fore.c +++ b/pkg/urbit/vere/io/fore.c @@ -60,7 +60,7 @@ _fore_inject(u3_auto* car_u, c3_c* pax_c) } u3_auto_peer( - u3_auto_plan(car_u, 0, u3k(tar), u3k(wir), u3k(cad)), + u3_auto_plan(car_u, u3_ovum_init(0, u3k(tar), u3k(wir), u3k(cad))), 0, _fore_inject_bail); } @@ -83,7 +83,7 @@ _fore_io_talk(u3_auto* car_u) wir = u3nc(c3__arvo, u3_nul); cad = u3nc(c3__wack, u3i_words(16, eny_w)); - u3_auto_plan(car_u, 0, u3_blip, wir, cad); + u3_auto_plan(car_u, u3_ovum_init(0, u3_blip, wir, cad)); } // set verbose as per -v @@ -96,7 +96,7 @@ _fore_io_talk(u3_auto* car_u) wir = u3nt(c3__term, '1', u3_nul); cad = u3nc(c3__verb, u3_nul); - u3_auto_plan(car_u, 0, u3_blip, wir, cad); + u3_auto_plan(car_u, u3_ovum_init(0, u3_blip, wir, cad)); } // inject arbitrary diff --git a/pkg/urbit/vere/io/hind.c b/pkg/urbit/vere/io/hind.c index 082a718ee0..be83a9f66e 100644 --- a/pkg/urbit/vere/io/hind.c +++ b/pkg/urbit/vere/io/hind.c @@ -45,7 +45,7 @@ _hind_io_kick(u3_auto* car_u, u3_noun wir, u3_noun cad) // case c3__trim: { ret_o = c3y; - u3_auto_plan(car_u, 0, u3_blip, u3k(wir), u3k(cad)); + u3_auto_plan(car_u, u3_ovum_init(0, u3_blip, u3k(wir), u3k(cad))); } case c3__vega: { diff --git a/pkg/urbit/vere/io/http.c b/pkg/urbit/vere/io/http.c index f74da5a966..42c2d9b8a9 100644 --- a/pkg/urbit/vere/io/http.c +++ b/pkg/urbit/vere/io/http.c @@ -382,7 +382,7 @@ _http_req_kill(u3_hreq* req_u) u3_noun wir = _http_req_to_duct(req_u); u3_noun cad = u3nc(u3i_string("cancel-request"), u3_nul); - u3_auto_plan(&htd_u->car_u, 0, c3__e, wir, cad); + u3_auto_plan(&htd_u->car_u, u3_ovum_init(0, c3__e, wir, cad)); } typedef struct _u3_hgen { @@ -475,7 +475,7 @@ _http_req_dispatch(u3_hreq* req_u, u3_noun req) : u3nc(u3i_string("request"), dat); } - u3_auto_plan(&htd_u->car_u, 0, c3__e, wir, cad); + u3_auto_plan(&htd_u->car_u, u3_ovum_init(0, c3__e, wir, cad)); } } @@ -1556,7 +1556,7 @@ _http_serv_start_all(u3_httd* htd_u) u3_noun wir = u3nt(u3i_string("http-server"), u3k(u3A->sen), u3_nul); u3_noun cad = u3nt(c3__live, non, sec); - u3_auto_plan(&htd_u->car_u, 0, c3__e, wir, cad); + u3_auto_plan(&htd_u->car_u, u3_ovum_init(0, c3__e, wir, cad)); } _http_write_ports_file(htd_u, u3_Host.dir_c); @@ -1668,7 +1668,7 @@ _http_io_talk(u3_auto* car_u) u3_noun wir = u3nt(u3i_string("http-server"), u3k(u3A->sen), u3_nul); u3_noun cad = u3nc(c3__born, u3_nul); - u3_auto_plan(car_u, 0, c3__e, wir, cad); + u3_auto_plan(car_u, u3_ovum_init(0, c3__e, wir, cad)); // XX set liv_o on done/swap? // diff --git a/pkg/urbit/vere/io/term.c b/pkg/urbit/vere/io/term.c index c21f5f5b8f..3eb24050cd 100644 --- a/pkg/urbit/vere/io/term.c +++ b/pkg/urbit/vere/io/term.c @@ -607,7 +607,7 @@ _term_it_save(u3_noun pax, u3_noun pad) static u3_ovum* _term_ovum_plan(u3_auto* car_u, u3_noun wir, u3_noun cad) { - u3_ovum* egg_u = u3_auto_plan(car_u, 0, c3__d, wir, cad); + u3_ovum* egg_u = u3_auto_plan(car_u, u3_ovum_init(0, c3__d, wir, cad)); // term events have no spinner label // diff --git a/pkg/urbit/vere/io/unix.c b/pkg/urbit/vere/io/unix.c index 77d3d9f0ec..9376d46715 100644 --- a/pkg/urbit/vere/io/unix.c +++ b/pkg/urbit/vere/io/unix.c @@ -959,7 +959,7 @@ _unix_update_mount(u3_unix* unx_u, u3_umon* mon_u, u3_noun all) u3_noun wir = u3nt(c3__sync, u3k(u3A->sen), u3_nul); u3_noun cad = u3nq(c3__into, u3i_string(mon_u->nam_c), all, can); - u3_auto_plan(&unx_u->car_u, 0, c3__c, wir, cad); + u3_auto_plan(&unx_u->car_u, u3_ovum_init(0, c3__c, wir, cad)); } } } @@ -1377,7 +1377,7 @@ _unix_io_talk(u3_auto* car_u) u3_noun wir = u3nc(c3__boat, u3_nul); u3_noun cad = u3nc(c3__boat, u3_nul); - u3_auto_plan(car_u, 0, c3__c, wir, cad); + u3_auto_plan(car_u, u3_ovum_init(0, c3__c, wir, cad)); } /* _unix_io_kick(): apply effects.