mirror of
https://github.com/matrix-construct/construct
synced 2024-10-01 05:08:59 +02:00
ircd:Ⓜ️:dbs: Make indexers internal.
This commit is contained in:
parent
a787c51df3
commit
2b011d80df
4 changed files with 42 additions and 36 deletions
|
@ -186,31 +186,3 @@ struct ircd::m::dbs::init
|
||||||
init(std::string dbopts = {});
|
init(std::string dbopts = {});
|
||||||
~init() noexcept;
|
~init() noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Internal interface; not for public. (TODO: renamespace)
|
|
||||||
namespace ircd::m::dbs
|
|
||||||
{
|
|
||||||
void _index_room_joined(db::txn &, const event &, const write_opts &);
|
|
||||||
void _index_room_redact(db::txn &, const event &, const write_opts &);
|
|
||||||
void _index_room_state_space(db::txn &, const event &, const write_opts &);
|
|
||||||
void _index_room_state(db::txn &, const event &, const write_opts &);
|
|
||||||
void _index_room_head_resolve(db::txn &, const event &, const write_opts &);
|
|
||||||
void _index_room_head(db::txn &, const event &, const write_opts &);
|
|
||||||
void _index_room_events(db::txn &, const event &, const write_opts &);
|
|
||||||
void _index_room(db::txn &, const event &, const write_opts &);
|
|
||||||
void _index_event_type(db::txn &, const event &, const write_opts &);
|
|
||||||
void _index_event_sender(db::txn &, const event &, const write_opts &);
|
|
||||||
void _index_event_horizon_resolve(db::txn &, const event &, const write_opts &);
|
|
||||||
void _index_event_horizon(db::txn &, const event &, const write_opts &, const id::event &);
|
|
||||||
void _index_event_refs_m_room_redaction(db::txn &, const event &, const write_opts &);
|
|
||||||
void _index_event_refs_m_receipt_m_read(db::txn &, const event &, const write_opts &);
|
|
||||||
void _index_event_refs_m_relates_m_reply(db::txn &, const event &, const write_opts &);
|
|
||||||
void _index_event_refs_state(db::txn &, const event &, const write_opts &);
|
|
||||||
void _index_event_refs_auth(db::txn &, const event &, const write_opts &);
|
|
||||||
void _index_event_refs_prev(db::txn &, const event &, const write_opts &);
|
|
||||||
void _index_event_refs(db::txn &, const event &, const write_opts &);
|
|
||||||
void _index_event_json(db::txn &, const event &, const write_opts &);
|
|
||||||
void _index_event_cols(db::txn &, const event &, const write_opts &);
|
|
||||||
void _index_event_id(db::txn &, const event &, const write_opts &);
|
|
||||||
void _index_event(db::txn &, const event &, const write_opts &);
|
|
||||||
}
|
|
||||||
|
|
|
@ -212,6 +212,30 @@ ircd::m::dbs::write_opts::appendix_all{[]
|
||||||
|
|
||||||
namespace ircd::m::dbs
|
namespace ircd::m::dbs
|
||||||
{
|
{
|
||||||
|
static void _index_room_joined(db::txn &, const event &, const write_opts &);
|
||||||
|
static void _index_room_redact(db::txn &, const event &, const write_opts &);
|
||||||
|
static void _index_room_state_space(db::txn &, const event &, const write_opts &);
|
||||||
|
static void _index_room_state(db::txn &, const event &, const write_opts &);
|
||||||
|
static void _index_room_head_resolve(db::txn &, const event &, const write_opts &);
|
||||||
|
static void _index_room_head(db::txn &, const event &, const write_opts &);
|
||||||
|
static void _index_room_events(db::txn &, const event &, const write_opts &);
|
||||||
|
static void _index_room(db::txn &, const event &, const write_opts &);
|
||||||
|
static void _index_event_type(db::txn &, const event &, const write_opts &);
|
||||||
|
static void _index_event_sender(db::txn &, const event &, const write_opts &);
|
||||||
|
static void _index_event_horizon_resolve(db::txn &, const event &, const write_opts &);
|
||||||
|
static void _index_event_horizon(db::txn &, const event &, const write_opts &, const id::event &);
|
||||||
|
static void _index_event_refs_m_room_redaction(db::txn &, const event &, const write_opts &);
|
||||||
|
static void _index_event_refs_m_receipt_m_read(db::txn &, const event &, const write_opts &);
|
||||||
|
static void _index_event_refs_m_relates_m_reply(db::txn &, const event &, const write_opts &);
|
||||||
|
static void _index_event_refs_state(db::txn &, const event &, const write_opts &);
|
||||||
|
static void _index_event_refs_auth(db::txn &, const event &, const write_opts &);
|
||||||
|
static void _index_event_refs_prev(db::txn &, const event &, const write_opts &);
|
||||||
|
static void _index_event_refs(db::txn &, const event &, const write_opts &);
|
||||||
|
static void _index_event_json(db::txn &, const event &, const write_opts &);
|
||||||
|
static void _index_event_cols(db::txn &, const event &, const write_opts &);
|
||||||
|
static void _index_event_id(db::txn &, const event &, const write_opts &);
|
||||||
|
static void _index_event(db::txn &, const event &, const write_opts &);
|
||||||
|
|
||||||
static void blacklist(db::txn &txn, const event::id &, const write_opts &);
|
static void blacklist(db::txn &txn, const event::id &, const write_opts &);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2602,8 +2602,9 @@ ircd::m::event::refs::rebuild()
|
||||||
{
|
{
|
||||||
m::dbs::write_opts wopts;
|
m::dbs::write_opts wopts;
|
||||||
wopts.event_idx = event_idx;
|
wopts.event_idx = event_idx;
|
||||||
|
wopts.appendix.reset();
|
||||||
m::dbs::_index_event_refs(txn, json::object{event}, wopts);
|
wopts.appendix.set(dbs::appendix::EVENT_REFS);
|
||||||
|
m::dbs::write(txn, json::object{event}, wopts);
|
||||||
|
|
||||||
if(++j % log_interval == 0) log::info
|
if(++j % log_interval == 0) log::info
|
||||||
{
|
{
|
||||||
|
|
|
@ -1669,10 +1669,13 @@ ircd::m::room::timeline::rebuild(const m::room &room)
|
||||||
for(; it; ++it)
|
for(; it; ++it)
|
||||||
{
|
{
|
||||||
const m::event &event{*it};
|
const m::event &event{*it};
|
||||||
|
|
||||||
m::dbs::write_opts opts;
|
m::dbs::write_opts opts;
|
||||||
opts.event_idx = it.event_idx();
|
opts.event_idx = it.event_idx();
|
||||||
m::dbs::_index_event_refs_prev(txn, event, opts);
|
opts.appendix.reset();
|
||||||
|
opts.appendix.set(dbs::appendix::EVENT_REFS);
|
||||||
|
opts.event_refs.reset();
|
||||||
|
opts.event_refs.set(uint(dbs::ref::NEXT));
|
||||||
|
m::dbs::write(txn, event, opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
txn();
|
txn();
|
||||||
|
@ -3477,7 +3480,9 @@ ircd::m::room::head::rebuild(const head &head)
|
||||||
{
|
{
|
||||||
const m::event &event{*it};
|
const m::event &event{*it};
|
||||||
opts.event_idx = it.event_idx();
|
opts.event_idx = it.event_idx();
|
||||||
m::dbs::_index_room_head(txn, event, opts);
|
opts.appendix.reset();
|
||||||
|
opts.appendix.set(dbs::appendix::ROOM_HEAD);
|
||||||
|
m::dbs::write(txn, event, opts);
|
||||||
++ret;
|
++ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3508,6 +3513,8 @@ ircd::m::room::head::reset(const head &head)
|
||||||
// Iterate all of the existing heads with a delete operation
|
// Iterate all of the existing heads with a delete operation
|
||||||
m::dbs::write_opts opts;
|
m::dbs::write_opts opts;
|
||||||
opts.op = db::op::DELETE;
|
opts.op = db::op::DELETE;
|
||||||
|
opts.appendix.reset();
|
||||||
|
opts.appendix.set(dbs::appendix::ROOM_HEAD);
|
||||||
m::room::head{room}.for_each([&room, &opts, &txn, &ret]
|
m::room::head{room}.for_each([&room, &opts, &txn, &ret]
|
||||||
(const m::event::idx &event_idx, const m::event::id &event_id)
|
(const m::event::idx &event_idx, const m::event::id &event_id)
|
||||||
{
|
{
|
||||||
|
@ -3530,14 +3537,14 @@ ircd::m::room::head::reset(const head &head)
|
||||||
}
|
}
|
||||||
|
|
||||||
opts.event_idx = event_idx;
|
opts.event_idx = event_idx;
|
||||||
m::dbs::_index_room_head(txn, event, opts);
|
m::dbs::write(txn, event, opts);
|
||||||
++ret;
|
++ret;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Finally add the replacement to the txn
|
// Finally add the replacement to the txn
|
||||||
opts.op = db::op::SET;
|
opts.op = db::op::SET;
|
||||||
opts.event_idx = it.event_idx();
|
opts.event_idx = it.event_idx();
|
||||||
m::dbs::_index_room_head(txn, replacement, opts);
|
m::dbs::write(txn, replacement, opts);
|
||||||
|
|
||||||
// Commit txn
|
// Commit txn
|
||||||
txn();
|
txn();
|
||||||
|
@ -3563,7 +3570,9 @@ ircd::m::room::head::modify(const m::event::id &event_id,
|
||||||
m::dbs::write_opts opts;
|
m::dbs::write_opts opts;
|
||||||
opts.op = op;
|
opts.op = op;
|
||||||
opts.event_idx = event.event_idx;
|
opts.event_idx = event.event_idx;
|
||||||
m::dbs::_index_room_head(txn, event, opts);
|
opts.appendix.reset();
|
||||||
|
opts.appendix.set(dbs::appendix::ROOM_HEAD);
|
||||||
|
m::dbs::write(txn, event, opts);
|
||||||
|
|
||||||
// Commit txn
|
// Commit txn
|
||||||
txn();
|
txn();
|
||||||
|
|
Loading…
Reference in a new issue