From f67eafd078f79eb23d13c4875258978cd829c091 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 5 Sep 2019 13:17:04 -0700 Subject: [PATCH] ircd::m::vm::fetch: Remove/reorg stale fetch related options. --- include/ircd/m/vm.h | 33 ++++----------------------------- modules/console.cc | 8 ++++---- modules/federation/invite.cc | 1 - modules/federation/invite2.cc | 1 - modules/m_room_bootstrap.cc | 8 ++++---- modules/m_vm_fetch.cc | 8 ++++---- 6 files changed, 16 insertions(+), 43 deletions(-) diff --git a/include/ircd/m/vm.h b/include/ircd/m/vm.h index b0d93a387..409b15cc1 100644 --- a/include/ircd/m/vm.h +++ b/include/ircd/m/vm.h @@ -232,45 +232,16 @@ struct ircd::m::vm::opts // Verify the origin signature bool verify {true}; - /// Performs a query during the fetch stage to check if the event's auth - /// exists locally. This query is required for any fetching to be - /// possible. - bool fetch_auth_check {true}; - /// Whether to automatically fetch the auth events when they do not exist. bool fetch_auth {true}; - /// Waits for auth events to be processed before continuing. Without - /// waiting, if any auth events are missing fault::EVENT is thrown. - /// Note that fault::AUTH is only thrown for authentication failures - /// while fault::EVENT is when the data is missing. - bool fetch_auth_wait {true}; - - /// Performs a query during the fetch stage to check if the room's state - /// exists locally. This query is required for any fetching to be - /// possible. - bool fetch_state_check {true}; - /// Whether to automatically fetch the room state when there is no state /// or incomplete state for the room found on the this server. bool fetch_state {true}; - /// Waits for a condition where fault::STATE would not be thrown before - /// continuing with the eval. - bool fetch_state_wait {true}; - - /// Performs a query during the fetch stage to check if the referenced - /// prev_events exist locally. This query is required for any fetching - /// to be possible. - bool fetch_prev_check {true}; - /// Dispatches a fetch operation when a prev_event does not exist locally. bool fetch_prev {true}; - /// Waits for prev_events have been acquired before continuing with this - /// evaluation. - bool fetch_prev_wait {false}; - /// Throws fault::EVENT if *all* of the prev_events do not exist locally. /// This is used to enforce that at least one path is traversable. This /// test is conducted after waiting if fetch_prev and fetch_prev_wait. @@ -281,6 +252,10 @@ struct ircd::m::vm::opts /// corollary conditions are similar to fetch_prev_any. bool fetch_prev_all {false}; + /// The limit on the number of events to backfill if any of the prev_events + /// are missing. -1 is auto / conf. + size_t fetch_prev_limit = -1; + /// Evaluators can set this value to optimize the creation of the database /// transaction where the event will be stored. This value should be set /// to the amount of space the event consumes; the JSON-serialized size is diff --git a/modules/console.cc b/modules/console.cc index 215adfb6e..c8231fd29 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -12542,8 +12542,8 @@ console_cmd__fed__sync(opt &out, const string_view &line) m::vm::opts vmopts; vmopts.nothrows = -1; vmopts.debuglog_accept = true; - vmopts.fetch_prev_check = false; - vmopts.fetch_state_check = false; + vmopts.fetch_prev = false; + vmopts.fetch_state = false; char rembuf[256]; vmopts.node_id = string(rembuf, remote); m::vm::eval eval @@ -12808,8 +12808,8 @@ console_cmd__fed__backfill(opt &out, const string_view &line) vmopts.nothrows = -1; vmopts.room_head = false; vmopts.room_head_resolve = true; - vmopts.fetch_prev_check = false; - vmopts.fetch_state_check = false; + vmopts.fetch_prev = false; + vmopts.fetch_state = false; char rembuf[256]; vmopts.node_id = string(rembuf, remote); m::vm::eval eval diff --git a/modules/federation/invite.cc b/modules/federation/invite.cc index cbaa5c630..3dfbabc39 100644 --- a/modules/federation/invite.cc +++ b/modules/federation/invite.cc @@ -157,7 +157,6 @@ put__invite(client &client, vmopts.node_id = request.origin; // Synapse may 403 a fetch of the prev_event of the invite event. - vmopts.fetch_prev_check = false; vmopts.fetch_prev = false; // We don't want this eval throwing an exception because the response has diff --git a/modules/federation/invite2.cc b/modules/federation/invite2.cc index 7a2eaf993..6c0a1e0c1 100644 --- a/modules/federation/invite2.cc +++ b/modules/federation/invite2.cc @@ -234,7 +234,6 @@ try vmopts.node_id = request.origin; // Synapse may 403 a fetch of the prev_event of the invite event. - vmopts.fetch_prev_check = false; vmopts.fetch_prev = false; // Don't throw an exception for a re-evaluation; this will just be a no-op diff --git a/modules/m_room_bootstrap.cc b/modules/m_room_bootstrap.cc index a8af26094..5ad678185 100644 --- a/modules/m_room_bootstrap.cc +++ b/modules/m_room_bootstrap.cc @@ -406,8 +406,8 @@ try m::vm::opts vmopts; vmopts.nothrows = -1; vmopts.warnlog &= ~vm::fault::EXISTS; - vmopts.fetch_state_check = false; - vmopts.fetch_prev_check = false; + vmopts.fetch_state = false; + vmopts.fetch_prev = false; vmopts.infolog_accept = false; m::vm::eval { @@ -446,8 +446,8 @@ try m::vm::opts opts; opts.nothrows = -1; opts.warnlog &= ~vm::fault::EXISTS; - opts.fetch_prev_check = false; - opts.fetch_state_check = false; + opts.fetch_state = false; + opts.fetch_prev = false; opts.infolog_accept = true; m::vm::eval { diff --git a/modules/m_vm_fetch.cc b/modules/m_vm_fetch.cc index fc17fc43b..3b1346986 100644 --- a/modules/m_vm_fetch.cc +++ b/modules/m_vm_fetch.cc @@ -93,10 +93,10 @@ try m::room room{room_id}; room.event_id = event_id; - if(opts.fetch_auth_check) + if(opts.fetch_auth) hook_handle_auth(event, eval, room); - if(opts.fetch_prev_check) + if(opts.fetch_prev) hook_handle_prev(event, eval, room); log::debug @@ -231,8 +231,8 @@ try m::vm::opts vmopts; vmopts.infolog_accept = true; - vmopts.fetch_prev_check = false; - vmopts.fetch_state_check = false; + vmopts.fetch_prev = false; + vmopts.fetch_state = false; vmopts.warnlog &= ~vm::fault::EXISTS; m::vm::eval {