mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 15:04:10 +01:00
modules/console: Remove old cruft.
This commit is contained in:
parent
01df07717b
commit
87c2520b29
1 changed files with 0 additions and 122 deletions
|
@ -14599,128 +14599,6 @@ console_cmd__fed__send(opt &out, const string_view &line)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
console_cmd__fed__sync(opt &out, const string_view &line)
|
||||
{
|
||||
const params param{line, " ",
|
||||
{
|
||||
"room_id", "remote", "limit", "event_id", "timeout"
|
||||
}};
|
||||
|
||||
const auto &room_id
|
||||
{
|
||||
m::room_id(param.at(0))
|
||||
};
|
||||
|
||||
const string_view remote
|
||||
{
|
||||
param.at(1, room_id.host())
|
||||
};
|
||||
|
||||
const auto &limit
|
||||
{
|
||||
param.at(2, size_t(128))
|
||||
};
|
||||
|
||||
const string_view &event_id
|
||||
{
|
||||
param[3]
|
||||
};
|
||||
|
||||
const auto timeout
|
||||
{
|
||||
param.at(4, out.timeout)
|
||||
};
|
||||
|
||||
// Used for out.head, out.content, in.head, but in.content is dynamic
|
||||
const unique_buffer<mutable_buffer> buf
|
||||
{
|
||||
32_KiB
|
||||
};
|
||||
|
||||
m::fed::state::opts stopts;
|
||||
stopts.remote = remote;
|
||||
stopts.event_id = event_id;
|
||||
const mutable_buffer stbuf
|
||||
{
|
||||
data(buf), size(buf) / 2
|
||||
};
|
||||
|
||||
m::fed::state strequest
|
||||
{
|
||||
room_id, stbuf, std::move(stopts)
|
||||
};
|
||||
|
||||
m::fed::backfill::opts bfopts;
|
||||
bfopts.remote = remote;
|
||||
bfopts.event_id = event_id;
|
||||
bfopts.limit = limit;
|
||||
const mutable_buffer bfbuf
|
||||
{
|
||||
buf + size(stbuf)
|
||||
};
|
||||
|
||||
m::fed::backfill bfrequest
|
||||
{
|
||||
room_id, bfbuf, std::move(bfopts)
|
||||
};
|
||||
|
||||
const auto when
|
||||
{
|
||||
now<system_point>() + timeout
|
||||
};
|
||||
|
||||
bfrequest.wait_until(when);
|
||||
strequest.wait_until(when);
|
||||
|
||||
bfrequest.get();
|
||||
strequest.get();
|
||||
|
||||
const json::array &auth_chain
|
||||
{
|
||||
json::object{strequest}.get("auth_chain")
|
||||
};
|
||||
|
||||
const json::array &pdus
|
||||
{
|
||||
json::object{strequest}.get("pdus")
|
||||
};
|
||||
|
||||
const json::array &messages
|
||||
{
|
||||
json::object{bfrequest}.get("pdus")
|
||||
};
|
||||
|
||||
std::vector<m::event> events;
|
||||
events.reserve(auth_chain.size() + pdus.size() + messages.size());
|
||||
|
||||
for(const json::object &event : auth_chain)
|
||||
events.emplace_back(event);
|
||||
|
||||
for(const json::object &event : pdus)
|
||||
events.emplace_back(event);
|
||||
|
||||
for(const json::object &event : messages)
|
||||
events.emplace_back(event);
|
||||
|
||||
std::sort(begin(events), end(events));
|
||||
events.erase(std::unique(begin(events), end(events)), end(events));
|
||||
|
||||
m::vm::opts vmopts;
|
||||
vmopts.nothrows = -1;
|
||||
vmopts.debuglog_accept = true;
|
||||
vmopts.phase.set(m::vm::phase::FETCH_PREV, false);
|
||||
vmopts.phase.set(m::vm::phase::FETCH_STATE, false);
|
||||
vmopts.notify_servers = false;
|
||||
vmopts.node_id = remote;
|
||||
m::vm::eval
|
||||
{
|
||||
events, vmopts
|
||||
};
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
console_cmd__fed__state(opt &out, const string_view &line)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue