mirror of
https://github.com/matrix-construct/construct
synced 2024-11-13 21:41:06 +01:00
ircd:Ⓜ️:event::prev: Add suite to check if prev reference exists; minor cleanup.
This commit is contained in:
parent
73ea2ff156
commit
64770c0214
2 changed files with 28 additions and 5 deletions
|
@ -42,8 +42,6 @@ struct ircd::m::event::prev
|
||||||
json::property<name::prev_events, json::array>
|
json::property<name::prev_events, json::array>
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
enum cond :int;
|
|
||||||
|
|
||||||
std::tuple<event::id, string_view> auth_events(const size_t &idx) const;
|
std::tuple<event::id, string_view> auth_events(const size_t &idx) const;
|
||||||
std::tuple<event::id, string_view> prev_states(const size_t &idx) const;
|
std::tuple<event::id, string_view> prev_states(const size_t &idx) const;
|
||||||
std::tuple<event::id, string_view> prev_events(const size_t &idx) const;
|
std::tuple<event::id, string_view> prev_events(const size_t &idx) const;
|
||||||
|
@ -52,14 +50,18 @@ struct ircd::m::event::prev
|
||||||
event::id prev_state(const size_t &idx) const;
|
event::id prev_state(const size_t &idx) const;
|
||||||
event::id prev_event(const size_t &idx) const;
|
event::id prev_event(const size_t &idx) const;
|
||||||
|
|
||||||
size_t auth_events_count() const;
|
bool auth_event_exists(const size_t &idx) const;
|
||||||
size_t prev_states_count() const;
|
bool prev_state_exists(const size_t &idx) const;
|
||||||
size_t prev_events_count() const;
|
bool prev_event_exists(const size_t &idx) const;
|
||||||
|
|
||||||
bool auth_events_has(const event::id &) const;
|
bool auth_events_has(const event::id &) const;
|
||||||
bool prev_states_has(const event::id &) const;
|
bool prev_states_has(const event::id &) const;
|
||||||
bool prev_events_has(const event::id &) const;
|
bool prev_events_has(const event::id &) const;
|
||||||
|
|
||||||
|
size_t auth_events_count() const;
|
||||||
|
size_t prev_states_count() const;
|
||||||
|
size_t prev_events_count() const;
|
||||||
|
|
||||||
using super_type::tuple;
|
using super_type::tuple;
|
||||||
using super_type::operator=;
|
using super_type::operator=;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1656,6 +1656,27 @@ const
|
||||||
// event/prev.h
|
// event/prev.h
|
||||||
//
|
//
|
||||||
|
|
||||||
|
bool
|
||||||
|
ircd::m::event::prev::prev_event_exists(const size_t &idx)
|
||||||
|
const
|
||||||
|
{
|
||||||
|
return m::exists(prev_state(idx));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
ircd::m::event::prev::prev_state_exists(const size_t &idx)
|
||||||
|
const
|
||||||
|
{
|
||||||
|
return m::exists(prev_state(idx));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
ircd::m::event::prev::auth_event_exists(const size_t &idx)
|
||||||
|
const
|
||||||
|
{
|
||||||
|
return m::exists(auth_event(idx));
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ircd::m::event::prev::prev_events_has(const event::id &event_id)
|
ircd::m::event::prev::prev_events_has(const event::id &event_id)
|
||||||
const
|
const
|
||||||
|
|
Loading…
Reference in a new issue