0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 23:44:01 +01:00

ircd:Ⓜ️:vm: Track evaluation hook phase.

This commit is contained in:
Jason Volk 2020-03-02 19:37:38 -08:00
parent d08a4f6f24
commit 14b962a695
4 changed files with 16 additions and 10 deletions

View file

@ -56,6 +56,7 @@ namespace ircd
#include "get.h"
#include "query.h"
#include "dbs/dbs.h"
#include "hook.h"
#include "vm.h"
#include "invite_3pid.h"
#include "createroom.h"
@ -80,7 +81,6 @@ namespace ircd
#include "direct_to_device.h"
#include "relates.h"
#include "txn.h"
#include "hook.h"
#include "visible.h"
#include "redacted.h"
#include "feds.h"

View file

@ -83,11 +83,11 @@ struct ircd::m::vm::eval
vector_view<m::event> pdus;
const json::iov *issue {nullptr};
const event *event_ {nullptr};
string_view room_id;
event::id::buf event_id;
event::conforms report;
string_view room_version;
const hook::base::site *phase {nullptr};
static bool for_each_pdu(const std::function<bool (const event &)> &);
static const event *find_pdu(const eval &, const event::id &);

View file

@ -667,6 +667,12 @@ try
};
#endif
assert(!eval.phase);
const scope_restore hook_phase
{
eval.phase, std::addressof(hook)
};
hook(event, std::forward<T>(data));
#if 0

View file

@ -14254,9 +14254,9 @@ console_cmd__vm(opt &out, const string_view &line)
<< std::right << std::setw(5) << "DONE" << " "
<< std::right << std::setw(9) << "SEQUENCE" << " "
<< std::right << std::setw(9) << "SEQSHARE" << " "
<< std::right << std::setw(9) << "SEQSHARE" << " "
<< std::right << std::setw(8) << "CELLS" << " "
<< std::right << std::setw(8) << "SIZE" << " "
<< std::left << std::setw(9) << "PHASE" << " "
<< std::right << std::setw(6) << "SIZE" << " "
<< std::right << std::setw(5) << "CELLS" << " "
<< std::right << std::setw(8) << "DEPTH" << " "
<< std::right << std::setw(5) << "VER" << " "
<< std::left << std::setw(40) << "ROOM ID" << " "
@ -14286,11 +14286,11 @@ console_cmd__vm(opt &out, const string_view &line)
<< std::right << std::setw(5) << eval->pdus.size() << " "
<< std::right << std::setw(5) << done << " "
<< std::right << std::setw(9) << eval->sequence << " "
<< std::right << std::setw(9) << eval->sequence_shared[0] << " "
<< std::right << std::setw(9) << eval->sequence_shared[1] << " "
<< std::right << std::setw(8) << (eval->txn? eval->txn->size() : 0UL) << " "
<< std::right << std::setw(8) << (eval->txn? eval->txn->bytes() : 0UL) << " "
<< std::right << std::setw(8) << (eval->event_? long(json::get<"depth"_>(*eval->event_)) : -1L) << " "
<< std::right << std::setw(9) << std::max(eval->sequence_shared[0], eval->sequence_shared[1]) << " "
<< std::left << std::setw(9) << (eval->phase? eval->phase->name() : ""_sv) << " "
<< std::right << std::setw(6) << (eval->txn? eval->txn->bytes() : 0UL) << " "
<< std::right << std::setw(5) << (eval->txn? eval->txn->size() : 0UL) << " "
<< std::right << std::setw(8) << (eval->event_ && eval->event_id? long(json::get<"depth"_>(*eval->event_)) : -1L) << " "
<< std::right << std::setw(5) << eval->room_version << " "
<< std::left << std::setw(40) << trunc(eval->room_id, 40) << " "
<< std::left << std::setw(60) << trunc(eval->event_id, 60) << " "