0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-10-04 14:48:56 +02:00

ircd:Ⓜ️:vm: Remove the depends aborted depends map fetus.

This commit is contained in:
Jason Volk 2018-09-13 19:03:03 -07:00
parent 88c2a22a30
commit 71edf65c7c
2 changed files with 0 additions and 75 deletions

View file

@ -33,8 +33,6 @@ namespace ircd::m::vm
const uint64_t &sequence(const eval &); const uint64_t &sequence(const eval &);
uint64_t retired_sequence(id::event::buf &); uint64_t retired_sequence(id::event::buf &);
uint64_t retired_sequence(); uint64_t retired_sequence();
ctx::future<> evaluated(const event::id &);
} }
/// Event Evaluation Device /// Event Evaluation Device

View file

@ -398,12 +398,6 @@ ircd::m::feds::state::state(const m::room::id &room_id,
// m/vm.h // m/vm.h
// //
namespace ircd::m::vm
{
extern std::map<event::id::buf, ctx::promise<>> depends;
static void notify_depends(const event::id &, std::exception_ptr);
}
decltype(ircd::m::vm::log) decltype(ircd::m::vm::log)
ircd::m::vm::log ircd::m::vm::log
{ {
@ -426,48 +420,6 @@ decltype(ircd::m::vm::default_copts)
ircd::m::vm::default_copts ircd::m::vm::default_copts
{}; {};
decltype(ircd::m::vm::depends)
ircd::m::vm::depends
{};
void
ircd::m::vm::notify_depends(const event::id &event_id,
std::exception_ptr eptr)
{
const auto it
{
depends.find(event_id)
};
if(it == end(depends))
return;
auto &promise(it->second);
if(eptr)
promise.set_exception(std::move(eptr));
else
promise.set_value();
depends.erase(it);
}
ircd::ctx::future<>
ircd::m::vm::evaluated(const event::id &event_id)
{
if(exists(event_id))
return ctx::future<>::already;
const auto iit
{
depends.emplace(event_id, ctx::promise<>{})
};
return ctx::future<>
{
iit.first->second
};
}
const uint64_t & const uint64_t &
ircd::m::vm::sequence(const eval &eval) ircd::m::vm::sequence(const eval &eval)
{ {
@ -655,7 +607,6 @@ ircd::m::vm::eval::operator()(json::iov &event,
enum ircd::m::vm::fault enum ircd::m::vm::fault
ircd::m::vm::eval::operator()(const event &event) ircd::m::vm::eval::operator()(const event &event)
try
{ {
using prototype = fault (eval &, const m::event &); using prototype = fault (eval &, const m::event &);
@ -669,32 +620,8 @@ try
function(*this, event) function(*this, event)
}; };
if(json::get<"event_id"_>(event)) switch(ret)
{
case fault::ACCEPT:
notify_depends(at<"event_id"_>(event), std::exception_ptr{});
break;
default:
{
notify_depends(at<"event_id"_>(event), std::make_exception_ptr(error
{
ret, "fault"
}));
break;
}
}
return ret; return ret;
} }
catch(...)
{
if(json::get<"event_id"_>(event))
notify_depends(at<"event_id"_>(event), std::current_exception());
throw;
}
// //
// accepted // accepted