0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 07:23:53 +01:00

ircd::db: Add cached membership test to row interface.

This commit is contained in:
Jason Volk 2018-12-26 19:45:04 -08:00
parent 13621feca0
commit 2f5d175957
2 changed files with 27 additions and 0 deletions

View file

@ -38,6 +38,9 @@ struct ircd::db::row
bool valid() const; // true on any cell valid; false on empty
bool valid(const string_view &) const; // true on any cell valid equal; false on empty
bool cached() const; // true on all cell cached
bool cached(const string_view &) const; // true on all columns cached key
// [GET] Find cell by name
const_iterator find(const string_view &column) const;
iterator find(const string_view &column);

View file

@ -9251,6 +9251,30 @@ const
});
}
bool
ircd::db::row::cached()
const
{
return std::all_of(std::begin(*this), std::end(*this), []
(const auto &cell)
{
db::column &column(const_cast<db::cell &>(cell));
return cell.valid() && db::cached(column, cell.key());
});
}
bool
ircd::db::row::cached(const string_view &key)
const
{
return std::all_of(std::begin(*this), std::end(*this), [&key]
(const auto &cell)
{
db::column &column(const_cast<db::cell &>(cell));
return db::cached(column, key);
});
}
bool
ircd::db::row::valid()
const