mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
ircd::db: Add cached membership test to row interface.
This commit is contained in:
parent
13621feca0
commit
2f5d175957
2 changed files with 27 additions and 0 deletions
|
@ -38,6 +38,9 @@ struct ircd::db::row
|
||||||
bool valid() const; // true on any cell valid; false on empty
|
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 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
|
// [GET] Find cell by name
|
||||||
const_iterator find(const string_view &column) const;
|
const_iterator find(const string_view &column) const;
|
||||||
iterator find(const string_view &column);
|
iterator find(const string_view &column);
|
||||||
|
|
24
ircd/db.cc
24
ircd/db.cc
|
@ -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
|
bool
|
||||||
ircd::db::row::valid()
|
ircd::db::row::valid()
|
||||||
const
|
const
|
||||||
|
|
Loading…
Reference in a new issue