0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 08:42:34 +01:00

modules/vm: Rename/export core functions.

This commit is contained in:
Jason Volk 2019-03-21 15:00:58 -07:00
parent 82378db816
commit 4b7bc1d5b1
2 changed files with 34 additions and 36 deletions

View file

@ -1389,12 +1389,12 @@ ircd::m::vm::eval::operator()(const room &room,
{
using prototype = fault (eval &, const m::room &, json::iov &, const json::iov &);
static mods::import<prototype> function
static mods::import<prototype> call
{
"vm", "eval__commit_room"
"vm", "ircd::m::vm::inject"
};
return function(*this, room, event, contents);
return call(*this, room, event, contents);
}
/// Inject a new event originating from this server.
@ -1405,12 +1405,12 @@ ircd::m::vm::eval::operator()(json::iov &event,
{
using prototype = fault (eval &, json::iov &, const json::iov &);
static mods::import<prototype> function
static mods::import<prototype> call
{
"vm", "eval__commit"
"vm", "ircd::m::vm::inject"
};
return function(*this, event, contents);
return call(*this, event, contents);
}
enum ircd::m::vm::fault
@ -1418,17 +1418,12 @@ ircd::m::vm::eval::operator()(const event &event)
{
using prototype = fault (eval &, const m::event &);
static mods::import<prototype> function
static mods::import<prototype> call
{
"vm", "eval__event"
"vm", "ircd::m::vm::execute"
};
const vm::fault ret
{
function(*this, event)
};
return ret;
return call(*this, event);
}
//

View file

@ -13,15 +13,15 @@ namespace ircd::m::vm
static void write_commit(eval &);
static void write_append(eval &, const event &);
static void write_prepare(eval &, const event &);
static fault _eval_edu(eval &, const event &);
static fault _eval_pdu(eval &, const event &);
static fault execute_edu(eval &, const event &);
static fault execute_pdu(eval &, const event &);
template<class... args>
static fault handle_error(const opts &opts, const fault &code, const string_view &fmt, args&&... a);
extern "C" fault eval__event(eval &, const event &);
extern "C" fault eval__commit(eval &, json::iov &, const json::iov &);
extern "C" fault eval__commit_room(eval &, const room &, json::iov &, const json::iov &);
fault execute(eval &, const event &);
fault inject(eval &, json::iov &, const json::iov &);
fault inject(eval &, const room &, json::iov &, const json::iov &);
static void init();
static void fini();
@ -190,7 +190,8 @@ ircd::m::vm::fini()
//
enum ircd::m::vm::fault
ircd::m::vm::eval__commit_room(eval &eval,
IRCD_MODULE_EXPORT
ircd::m::vm::inject(eval &eval,
const room &room,
json::iov &event,
const json::iov &contents)
@ -325,11 +326,12 @@ ircd::m::vm::eval__commit_room(eval &eval,
}
};
return eval(event, contents);
return inject(eval, event, contents);
}
enum ircd::m::vm::fault
ircd::m::vm::eval__commit(eval &eval,
IRCD_MODULE_EXPORT
ircd::m::vm::inject(eval &eval,
json::iov &event,
const json::iov &contents)
{
@ -477,11 +479,12 @@ ircd::m::vm::eval__commit(eval &eval,
event, { "content", content },
};
return eval(event);
return execute(eval, event);
}
enum ircd::m::vm::fault
ircd::m::vm::eval__event(eval &eval,
IRCD_MODULE_EXPORT
ircd::m::vm::execute(eval &eval,
const event &event)
try
{
@ -519,8 +522,8 @@ try
const fault ret
{
json::get<"event_id"_>(event)?
_eval_pdu(eval, event):
_eval_edu(eval, event)
execute_pdu(eval, event):
execute_edu(eval, event)
};
if(ret != fault::ACCEPT)
@ -621,7 +624,7 @@ ircd::m::vm::handle_error(const vm::opts &opts,
}
enum ircd::m::vm::fault
ircd::m::vm::_eval_edu(eval &eval,
ircd::m::vm::execute_edu(eval &eval,
const event &event)
{
if(eval.opts->eval)
@ -631,7 +634,7 @@ ircd::m::vm::_eval_edu(eval &eval,
}
enum ircd::m::vm::fault
ircd::m::vm::_eval_pdu(eval &eval,
ircd::m::vm::execute_pdu(eval &eval,
const event &event)
{
assert(eval.opts);