diff --git a/include/ircd/m/dbs.h b/include/ircd/m/dbs.h index b29e5dcbd..082c948cd 100644 --- a/include/ircd/m/dbs.h +++ b/include/ircd/m/dbs.h @@ -33,12 +33,12 @@ namespace ircd::m::dbs // Event metadata columns extern db::column event_idx; // event_id => event_idx + extern db::column event_json; // event_idx => full json extern db::index room_head; // room_id | event_id => event_idx extern db::index room_events; // room_id | depth, event_idx => node_id extern db::index room_joined; // room_id | origin, member => event_idx extern db::index room_state; // room_id | type, state_key => event_idx extern db::column state_node; // node_id => state::node - extern db::column event_json; // event_idx => full json // Lowlevel util constexpr size_t ROOM_HEAD_KEY_MAX_SIZE {id::MAX_SIZE + 1 + id::MAX_SIZE}; @@ -83,8 +83,8 @@ struct ircd::m::dbs::write_opts bool present {true}; bool history {true}; bool indexer {true}; - bool head {true}; - bool refs {true}; + bool room_head {true}; + bool room_refs {true}; bool json_source {false}; }; diff --git a/include/ircd/m/vm.h b/include/ircd/m/vm.h index 30800c8af..1166e2058 100644 --- a/include/ircd/m/vm.h +++ b/include/ircd/m/vm.h @@ -146,12 +146,12 @@ struct ircd::m::vm::opts /// it is considered unreferenced by any other event at this time. It is /// safe for this to always be true if events are evaluated in order. If /// `present` is false this should be set to false but they are not tied. - bool head {true}; + bool room_head {true}; /// Toggles whether the prev_events of this event are removed from the /// room head table, now that this event has referenced them. It is safe /// for this to always be true. - bool refs {true}; + bool room_refs {true}; /// Toggles whether the state btree is updated; this should be consistently /// true or false for all events in a room. diff --git a/ircd/m_dbs.cc b/ircd/m_dbs.cc index 19974a5db..01808b4a6 100644 --- a/ircd/m_dbs.cc +++ b/ircd/m_dbs.cc @@ -320,7 +320,7 @@ ircd::m::dbs::_index_room(db::txn &txn, const event &event, const write_opts &opts) { - if(opts.head || opts.refs) + if(opts.room_head || opts.room_refs) _index__room_head(txn, event, opts); if(defined(json::get<"state_key"_>(event))) @@ -436,7 +436,7 @@ ircd::m::dbs::_index__room_head(db::txn &txn, thread_local char buf[ROOM_HEAD_KEY_MAX_SIZE]; const ctx::critical_assertion ca; - if(opts.head) + if(opts.room_head) { const string_view &key { @@ -458,7 +458,7 @@ ircd::m::dbs::_index__room_head(db::txn &txn, //TODO: potentially creating a gap in the reference graph (just for us //TODO: though) can we *re-add* the prev_events to the head? - if(opts.refs && opts.op == db::op::SET) + if(opts.room_refs && opts.op == db::op::SET) { const m::event::prev &prev{event}; for(const json::array &p : json::get<"prev_events"_>(prev)) diff --git a/modules/console.cc b/modules/console.cc index 076748c92..68a5983c8 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -9725,8 +9725,8 @@ console_cmd__fed__backfill(opt &out, const string_view &line) vmopts.history = false; vmopts.verify = false; vmopts.notify = false; - vmopts.head = false; - vmopts.refs = true; + vmopts.room_head = false; + vmopts.room_refs = true; m::vm::eval eval { vmopts diff --git a/modules/m_room.cc b/modules/m_room.cc index 41c0790d2..bdad8e13d 100644 --- a/modules/m_room.cc +++ b/modules/m_room.cc @@ -365,8 +365,8 @@ state__force_present(const m::event &event) opts.event_idx = index(event); opts.present = true; opts.history = false; - opts.head = false; - opts.refs = false; + opts.room_head = false; + opts.room_refs = false; m::dbs::_index__room_state(txn, event, opts); m::dbs::_index__room_joined(txn, event, opts); @@ -417,8 +417,8 @@ state__rebuild_present(const m::room &room) opts.event_idx = it.event_idx(); opts.present = true; opts.history = false; - opts.head = false; - opts.refs = false; + opts.room_head = false; + opts.room_refs = false; m::dbs::_index__room_state(txn, event, opts); m::dbs::_index__room_joined(txn, event, opts); @@ -468,8 +468,8 @@ state__rebuild_history(const m::room &room) opts.root_out = root[++r % 2]; opts.present = false; opts.history = true; - opts.head = false; - opts.refs = false; + opts.room_head = false; + opts.room_refs = false; int64_t depth{0}; for(; it; ++it) @@ -630,8 +630,8 @@ head__rebuild(const m::room &room) m::dbs::write_opts opts; opts.op = db::op::SET; - opts.head = true; - opts.refs = true; + opts.room_head = true; + opts.room_refs = true; for(; it; ++it) { const m::event &event{*it}; @@ -670,7 +670,7 @@ head__reset(const m::room &room) // Iterate all of the existing heads with a delete operation m::dbs::write_opts opts; opts.op = db::op::DELETE; - opts.head = true; + opts.room_head = true; m::room::head{room}.for_each([&room, &opts, &txn, &ret] (const m::event::idx &event_idx, const m::event::id &event_id) { @@ -725,8 +725,8 @@ head__modify(const m::event::id &event_id, // Iterate all of the existing heads with a delete operation m::dbs::write_opts opts; opts.op = op; - opts.head = true; - opts.refs = refs; + opts.room_head = true; + opts.room_refs = refs; opts.event_idx = index(event); m::dbs::_index__room_head(txn, event, opts); diff --git a/modules/vm.cc b/modules/vm.cc index a679cfdc1..235012b91 100644 --- a/modules/vm.cc +++ b/modules/vm.cc @@ -686,8 +686,8 @@ ircd::m::vm::_write(eval &eval, wopts.root_out = new_root_buf; wopts.present = opts.present; wopts.history = opts.history; - wopts.head = opts.head; - wopts.refs = opts.refs; + wopts.room_head = opts.room_head; + wopts.room_refs = opts.room_refs; wopts.json_source = opts.json_source; wopts.event_idx = eval.sequence;