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

ircd:Ⓜ️:event: Add conditions to efficiently handle event::idx sentinel value.

This commit is contained in:
Jason Volk 2019-08-12 20:45:57 -07:00
parent 0efc56c9c7
commit 1744ee065b

View file

@ -1101,11 +1101,6 @@ ircd::m::get(std::nothrow_t,
const string_view &key, const string_view &key,
const event::fetch::view_closure &closure) const event::fetch::view_closure &closure)
{ {
const string_view &column_key
{
byte_view<string_view>{event_idx}
};
const auto &column_idx const auto &column_idx
{ {
json::indexof<event>(key) json::indexof<event>(key)
@ -1116,6 +1111,14 @@ ircd::m::get(std::nothrow_t,
dbs::event_column.at(column_idx) dbs::event_column.at(column_idx)
}; };
if(!event_idx)
return false;
const string_view &column_key
{
byte_view<string_view>{event_idx}
};
if(column) if(column)
return column(column_key, std::nothrow, closure); return column(column_key, std::nothrow, closure);
@ -1175,12 +1178,6 @@ ircd::m::seek(event::fetch &fetch,
index(event_id, std::nothrow) index(event_id, std::nothrow)
}; };
if(!event_idx)
{
fetch.valid = false;
return fetch.valid;
}
return seek(fetch, event_idx, event_id, std::nothrow); return seek(fetch, event_idx, event_id, std::nothrow);
} }
@ -1214,6 +1211,12 @@ ircd::m::seek(event::fetch &fetch,
event::id::buf{event_id}: event::id::buf{event_id}:
event::id::buf{}; event::id::buf{};
if(!event_idx)
{
fetch.valid = false;
return fetch.valid;
}
const string_view &key const string_view &key
{ {
byte_view<string_view>(event_idx) byte_view<string_view>(event_idx)