mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 15:04:10 +01:00
ircd:Ⓜ️ Fix event_id() interface for consistent leading std::nothrow_t.
This commit is contained in:
parent
88987b0e85
commit
93665cc587
17 changed files with 41 additions and 38 deletions
|
@ -17,11 +17,11 @@
|
|||
|
||||
namespace ircd::m
|
||||
{
|
||||
bool event_id(const event::idx &, std::nothrow_t, const event::id::closure &);
|
||||
bool event_id(std::nothrow_t, const event::idx &, const event::id::closure &);
|
||||
|
||||
event::id event_id(const event::idx &, event::id::buf &, std::nothrow_t);
|
||||
event::id event_id(std::nothrow_t, const event::idx &, event::id::buf &);
|
||||
event::id event_id(const event::idx &, event::id::buf &);
|
||||
|
||||
event::id::buf event_id(const event::idx &, std::nothrow_t);
|
||||
event::id::buf event_id(std::nothrow_t, const event::idx &);
|
||||
event::id::buf event_id(const event::idx &);
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ ircd::m::device::del(const m::user &user,
|
|||
|
||||
const auto event_id
|
||||
{
|
||||
m::event_id(event_idx, std::nothrow)
|
||||
m::event_id(std::nothrow, event_idx)
|
||||
};
|
||||
|
||||
if(!event_id)
|
||||
|
|
|
@ -270,7 +270,7 @@ try
|
|||
id(json::string(source.at("event_id"))):
|
||||
event_id_buf?
|
||||
id(event_id_buf):
|
||||
m::event_id(event_idx, event_id_buf, std::nothrow)
|
||||
m::event_id(std::nothrow, event_idx, event_id_buf)
|
||||
};
|
||||
|
||||
assert(fopts);
|
||||
|
@ -292,7 +292,7 @@ catch(const json::parse_error &e)
|
|||
{
|
||||
event_id_buf?
|
||||
id(event_id_buf):
|
||||
m::event_id(event_idx, event_id_buf, std::nothrow)
|
||||
m::event_id(std::nothrow, event_idx, event_id_buf)
|
||||
};
|
||||
|
||||
log::critical
|
||||
|
@ -326,7 +326,7 @@ try
|
|||
id{json::get<"event_id"_>(event)}:
|
||||
event_id_buf?
|
||||
id{event_id_buf}:
|
||||
m::event_id(event_idx, event_id_buf, std::nothrow)
|
||||
m::event_id(std::nothrow, event_idx, event_id_buf)
|
||||
};
|
||||
|
||||
assert(event_id);
|
||||
|
@ -341,7 +341,7 @@ catch(const json::parse_error &e)
|
|||
{
|
||||
event_id_buf?
|
||||
id(event_id_buf):
|
||||
m::event_id(event_idx, event_id_buf, std::nothrow)
|
||||
m::event_id(std::nothrow, event_idx, event_id_buf)
|
||||
};
|
||||
|
||||
log::critical
|
||||
|
|
|
@ -17,11 +17,11 @@ ircd::m::event_id(const event::idx &event_idx)
|
|||
}
|
||||
|
||||
ircd::m::event::id::buf
|
||||
ircd::m::event_id(const event::idx &event_idx,
|
||||
std::nothrow_t)
|
||||
ircd::m::event_id(std::nothrow_t,
|
||||
const event::idx &event_idx)
|
||||
{
|
||||
event::id::buf ret;
|
||||
event_id(event_idx, ret, std::nothrow);
|
||||
event_id(std::nothrow, event_idx, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -31,35 +31,38 @@ ircd::m::event_id(const event::idx &event_idx,
|
|||
{
|
||||
const event::id ret
|
||||
{
|
||||
event_id(event_idx, buf, std::nothrow)
|
||||
event_id(std::nothrow, event_idx, buf)
|
||||
};
|
||||
|
||||
if(!ret)
|
||||
throw m::NOT_FOUND
|
||||
{
|
||||
"Cannot find event ID from idx[%lu]", event_idx
|
||||
"Cannot find event ID from idx[%lu]",
|
||||
event_idx
|
||||
};
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
ircd::m::event::id
|
||||
ircd::m::event_id(const event::idx &event_idx,
|
||||
event::id::buf &buf,
|
||||
std::nothrow_t)
|
||||
ircd::m::event_id(std::nothrow_t,
|
||||
const event::idx &event_idx,
|
||||
event::id::buf &buf)
|
||||
{
|
||||
event_id(event_idx, std::nothrow, [&buf]
|
||||
event_id(std::nothrow, event_idx, [&buf]
|
||||
(const event::id &eid)
|
||||
{
|
||||
buf = eid;
|
||||
});
|
||||
|
||||
return buf? event::id{buf} : event::id{};
|
||||
return buf?
|
||||
event::id{buf}:
|
||||
event::id{};
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::m::event_id(const event::idx &event_idx,
|
||||
std::nothrow_t,
|
||||
ircd::m::event_id(std::nothrow_t,
|
||||
const event::idx &event_idx,
|
||||
const event::id::closure &closure)
|
||||
{
|
||||
return get(std::nothrow, event_idx, "event_id", closure);
|
||||
|
|
|
@ -572,7 +572,7 @@ ircd::m::top(std::nothrow_t,
|
|||
event::id::buf{}, depth, event_idx
|
||||
};
|
||||
|
||||
m::event_id(event_idx, std::nothrow, [&ret]
|
||||
m::event_id(std::nothrow, event_idx, [&ret]
|
||||
(const event::id &event_id)
|
||||
{
|
||||
std::get<event::id::buf>(ret) = event_id;
|
||||
|
@ -1283,7 +1283,7 @@ const
|
|||
(const event::idx &idx)
|
||||
{
|
||||
bool ret{true};
|
||||
m::event_id(idx, std::nothrow, [&ret, &closure]
|
||||
m::event_id(std::nothrow, idx, [&ret, &closure]
|
||||
(const event::id &event_id)
|
||||
{
|
||||
ret = closure(event_id);
|
||||
|
|
|
@ -167,7 +167,7 @@ ircd::m::room::aliases::cache::del(const alias &alias)
|
|||
|
||||
const auto event_id
|
||||
{
|
||||
m::event_id(event_idx, std::nothrow)
|
||||
m::event_id(std::nothrow, event_idx)
|
||||
};
|
||||
|
||||
if(!event_id)
|
||||
|
|
|
@ -112,7 +112,7 @@ ircd::m::room::bootstrap::bootstrap(m::event::id::buf &event_id_buf,
|
|||
};
|
||||
|
||||
if(existing_join)
|
||||
event_id_buf = m::event_id(member_event_idx, std::nothrow);
|
||||
event_id_buf = m::event_id(std::nothrow, member_event_idx);
|
||||
|
||||
if(!event_id_buf)
|
||||
event_id_buf = m::bootstrap::make_join(host, room_id, user_id, room_version_buf);
|
||||
|
|
|
@ -154,7 +154,7 @@ try
|
|||
|
||||
const auto event_id
|
||||
{
|
||||
m::event_id(it.event_idx(), std::nothrow)
|
||||
m::event_id(std::nothrow, it.event_idx())
|
||||
};
|
||||
|
||||
if(unlikely(!event_id))
|
||||
|
|
|
@ -77,7 +77,7 @@ ircd::m::join(const m::room &room,
|
|||
const event::id::buf event_id
|
||||
{
|
||||
event_idx?
|
||||
m::event_id(event_idx, std::nothrow):
|
||||
m::event_id(std::nothrow, event_idx):
|
||||
event::id::buf{}
|
||||
};
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ const
|
|||
get(type, state_key, event::closure_idx{[&]
|
||||
(const event::idx &idx)
|
||||
{
|
||||
if(!m::event_id(idx, std::nothrow, closure))
|
||||
if(!m::event_id(std::nothrow, idx, closure))
|
||||
throw m::NOT_FOUND
|
||||
{
|
||||
"(%s,%s) in %s idx:%lu event_id :not found",
|
||||
|
@ -214,7 +214,7 @@ const
|
|||
return get(std::nothrow, type, state_key, event::closure_idx{[&closure]
|
||||
(const event::idx &idx)
|
||||
{
|
||||
m::event_id(idx, std::nothrow, closure);
|
||||
m::event_id(std::nothrow, idx, closure);
|
||||
}});
|
||||
}
|
||||
|
||||
|
@ -405,7 +405,7 @@ const
|
|||
(const event::idx &idx)
|
||||
{
|
||||
bool ret{true};
|
||||
m::event_id(idx, std::nothrow, [&ret, &closure]
|
||||
m::event_id(std::nothrow, idx, [&ret, &closure]
|
||||
(const event::id &id)
|
||||
{
|
||||
ret = closure(id);
|
||||
|
@ -607,7 +607,7 @@ const
|
|||
(const event::idx &idx)
|
||||
{
|
||||
bool ret{true};
|
||||
m::event_id(idx, std::nothrow, [&ret, &closure]
|
||||
m::event_id(std::nothrow, idx, [&ret, &closure]
|
||||
(const event::id &id)
|
||||
{
|
||||
ret = closure(id);
|
||||
|
|
|
@ -29,7 +29,7 @@ const
|
|||
|
||||
const m::event::id::buf event_id
|
||||
{
|
||||
m::event_id(event_idx, std::nothrow)
|
||||
m::event_id(std::nothrow, event_idx)
|
||||
};
|
||||
|
||||
if(!event_id)
|
||||
|
|
|
@ -35,7 +35,7 @@ const
|
|||
|
||||
const m::event::id::buf event_id
|
||||
{
|
||||
m::event_id(event_idx, std::nothrow)
|
||||
m::event_id(std::nothrow, event_idx)
|
||||
};
|
||||
|
||||
if(!event_id)
|
||||
|
|
|
@ -290,7 +290,7 @@ ircd::m::sync::_room_timeline_polylog_events(data &data,
|
|||
ret |= _room_timeline_append(data, array, it.event_idx(), event);
|
||||
}
|
||||
|
||||
return m::event_id(event_idx, std::nothrow);
|
||||
return m::event_id(std::nothrow, event_idx);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -7497,7 +7497,7 @@ console_cmd__event__horizon(opt &out, const string_view &line)
|
|||
{
|
||||
const auto _event_id
|
||||
{
|
||||
m::event_id(event_idx, std::nothrow)
|
||||
m::event_id(std::nothrow, event_idx)
|
||||
};
|
||||
|
||||
out << event_id
|
||||
|
@ -7522,7 +7522,7 @@ console_cmd__event__horizon__list(opt &out, const string_view &line)
|
|||
{
|
||||
const auto _event_id
|
||||
{
|
||||
m::event_id(event_idx, std::nothrow)
|
||||
m::event_id(std::nothrow, event_idx)
|
||||
};
|
||||
|
||||
out << event_id
|
||||
|
|
|
@ -259,7 +259,7 @@ send_join__response(client &client,
|
|||
{
|
||||
const auto &event_id
|
||||
{
|
||||
m::event_id(event_idx, std::nothrow)
|
||||
m::event_id(std::nothrow, event_idx)
|
||||
};
|
||||
|
||||
if(event_id)
|
||||
|
|
|
@ -97,7 +97,7 @@ get__state_ids(client &client,
|
|||
ac.for_each([&auth_chain_ids]
|
||||
(const m::event::idx &event_idx)
|
||||
{
|
||||
m::event_id(event_idx, std::nothrow, [&auth_chain_ids]
|
||||
m::event_id(std::nothrow, event_idx, [&auth_chain_ids]
|
||||
(const auto &event_id)
|
||||
{
|
||||
auth_chain_ids.append(event_id);
|
||||
|
|
|
@ -1097,7 +1097,7 @@ github_handle__status(std::ostream &out,
|
|||
if(!m::query(std::nothrow, it.event_idx(), "content", content_match))
|
||||
continue;
|
||||
|
||||
push_event_id = m::event_id(it.event_idx(), std::nothrow);
|
||||
push_event_id = m::event_id(std::nothrow, it.event_idx());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue