ircd:Ⓜ️ Fix m::index() interface for consistent leading std::nothrow_t.

This commit is contained in:
Jason Volk 2020-04-01 16:12:41 -07:00
parent 93665cc587
commit d1812f0c44
15 changed files with 29 additions and 29 deletions

View File

@ -13,11 +13,11 @@
namespace ircd::m namespace ircd::m
{ {
bool index(const event::id &, std::nothrow_t, const event::closure_idx &); bool index(std::nothrow_t, const event::id &, const event::closure_idx &);
event::idx index(const event::id &, std::nothrow_t); event::idx index(std::nothrow_t, const event::id &);
event::idx index(const event::id &); event::idx index(const event::id &);
event::idx index(const event &, std::nothrow_t); event::idx index(std::nothrow_t, const event &);
event::idx index(const event &); event::idx index(const event &);
} }

View File

@ -38,7 +38,7 @@ inline
ircd::m::redacted::redacted(const event::id &event_id) ircd::m::redacted::redacted(const event::id &event_id)
:redacted :redacted
{ {
index(event_id, std::nothrow) index(std::nothrow, event_id)
} }
{} {}

View File

@ -398,7 +398,7 @@ ircd::m::dbs::find_event_idx(const event::id &event_id,
ret = wopts.interpose->val(db::op::SET, "_event_idx", event_id, 0UL); ret = wopts.interpose->val(db::op::SET, "_event_idx", event_id, 0UL);
if(wopts.allow_queries && !ret) if(wopts.allow_queries && !ret)
ret = m::index(event_id, std::nothrow); // query ret = m::index(std::nothrow, event_id); // query
return ret; return ret;
} }

View File

@ -991,7 +991,7 @@ bool
ircd::m::bad(const id::event &event_id) ircd::m::bad(const id::event &event_id)
{ {
bool ret {false}; bool ret {false};
index(event_id, std::nothrow, [&ret] index(std::nothrow, event_id, [&ret]
(const event::idx &event_idx) (const event::idx &event_idx)
{ {
ret = event_idx == 0; ret = event_idx == 0;
@ -1016,7 +1016,7 @@ ircd::m::count(const event::prev &prev)
bool bool
ircd::m::good(const id::event &event_id) ircd::m::good(const id::event &event_id)
{ {
return bool(event_id) && index(event_id, std::nothrow) != 0; return bool(event_id) && index(std::nothrow, event_id) != 0;
} }
bool bool

View File

@ -23,7 +23,7 @@ ircd::m::cached(const id::event &event_id,
const event::idx event_idx const event::idx event_idx
{ {
index(event_id, std::nothrow) index(std::nothrow, event_id)
}; };
return event_idx? return event_idx?

View File

@ -30,7 +30,7 @@ ircd::m::seek(event::fetch &fetch,
{ {
const auto &event_idx const auto &event_idx
{ {
index(event_id, std::nothrow) index(std::nothrow, event_id)
}; };
return seek(fetch, event_idx, event_id, std::nothrow); return seek(fetch, event_idx, event_id, std::nothrow);
@ -130,7 +130,7 @@ ircd::m::event::fetch::fetch(const event::id &event_id,
const opts &opts) const opts &opts)
:fetch :fetch
{ {
index(event_id, std::nothrow), event_id, std::nothrow, opts index(std::nothrow, event_id), event_id, std::nothrow, opts
} }
{ {
} }

View File

@ -119,7 +119,7 @@ ircd::m::get(std::nothrow_t,
const string_view &key, const string_view &key,
const mutable_buffer &buf) const mutable_buffer &buf)
{ {
return get(std::nothrow, index(event_id, std::nothrow), key, buf); return get(std::nothrow, index(std::nothrow, event_id), key, buf);
} }
ircd::const_buffer ircd::const_buffer
@ -172,7 +172,7 @@ 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)
{ {
return get(std::nothrow, index(event_id, std::nothrow), key, closure); return get(std::nothrow, index(std::nothrow, event_id), key, closure);
} }
bool bool

View File

@ -23,10 +23,10 @@ catch(const json::not_found &)
} }
ircd::m::event::idx ircd::m::event::idx
ircd::m::index(const event &event, ircd::m::index(std::nothrow_t,
std::nothrow_t) const event &event)
{ {
return index(event.event_id, std::nothrow); return index(std::nothrow, event.event_id);
} }
ircd::m::event::idx ircd::m::event::idx
@ -35,7 +35,7 @@ ircd::m::index(const event::id &event_id)
assert(event_id); assert(event_id);
const auto ret const auto ret
{ {
index(event_id, std::nothrow) index(std::nothrow, event_id)
}; };
if(!ret) if(!ret)
@ -50,11 +50,11 @@ ircd::m::index(const event::id &event_id)
} }
ircd::m::event::idx ircd::m::event::idx
ircd::m::index(const event::id &event_id, ircd::m::index(std::nothrow_t,
std::nothrow_t) const event::id &event_id)
{ {
event::idx ret{0}; event::idx ret{0};
index(event_id, std::nothrow, [&ret] index(std::nothrow, event_id, [&ret]
(const event::idx &event_idx) (const event::idx &event_idx)
{ {
ret = event_idx; ret = event_idx;
@ -64,8 +64,8 @@ ircd::m::index(const event::id &event_id,
} }
bool bool
ircd::m::index(const event::id &event_id, ircd::m::index(std::nothrow_t,
std::nothrow_t, const event::id &event_id,
const event::closure_idx &closure) const event::closure_idx &closure)
{ {
auto &column auto &column

View File

@ -595,7 +595,7 @@ ircd::m::init::backfill::gossip(const room::id &room_id,
size_t ret{0}; size_t ret{0};
const m::event::refs refs const m::event::refs refs
{ {
m::index(event_id, std::nothrow) m::index(std::nothrow, event_id)
}; };
static const size_t max{48}; static const size_t max{48};

View File

@ -832,7 +832,7 @@ const
const auto &auth_event_idx const auto &auth_event_idx
{ {
m::index(auth_event_id, std::nothrow) m::index(std::nothrow, auth_event_id)
}; };
if(!auth_event_idx) if(!auth_event_idx)

View File

@ -359,7 +359,7 @@ ircd::m::room::events::seek(const event::id &event_id)
{ {
const event::idx &event_idx const event::idx &event_idx
{ {
m::index(event_id, std::nothrow) m::index(std::nothrow, event_id)
}; };
return event_idx? return event_idx?

View File

@ -107,14 +107,14 @@ bool
ircd::m::sync::apropos(const data &d, ircd::m::sync::apropos(const data &d,
const event &event) const event &event)
{ {
return apropos(d, index(event, std::nothrow)); return apropos(d, index(std::nothrow, event));
} }
bool bool
ircd::m::sync::apropos(const data &d, ircd::m::sync::apropos(const data &d,
const event::id &event_id) const event::id &event_id)
{ {
return apropos(d, index(event_id, std::nothrow)); return apropos(d, index(std::nothrow, event_id));
} }
bool bool

View File

@ -173,7 +173,7 @@ ircd::m::get_notifications(client &client,
{ {
object, "read", json::value object, "read", json::value
{ {
last_read && index(last_read, std::nothrow) >= event_idx last_read && index(std::nothrow, last_read) >= event_idx
} }
}; };

View File

@ -129,7 +129,7 @@ try
m::event::idx event_idx m::event::idx event_idx
{ {
index(event_id, std::nothrow) index(std::nothrow, event_id)
}; };
m::event::fetch event m::event::fetch event

View File

@ -73,7 +73,7 @@ ircd::m::auth_room_redaction(const m::event &event,
// the power levels. // the power levels.
const auto redact_target_idx const auto redact_target_idx
{ {
m::index(at<"redacts"_>(event), std::nothrow) m::index(std::nothrow, at<"redacts"_>(event))
}; };
if(!redact_target_idx) if(!redact_target_idx)