mirror of
https://github.com/matrix-construct/construct
synced 2024-06-07 20:48:55 +02:00
ircd:Ⓜ️:room::events: Add lower_bound to seek_idx() for relaxed seek.
This commit is contained in:
parent
b39f574ba9
commit
53806a7973
|
@ -68,7 +68,7 @@ struct ircd::m::room::events
|
|||
explicit operator event::idx() const;
|
||||
|
||||
// Perform a new lookup / iterator
|
||||
bool seek_idx(const event::idx &);
|
||||
bool seek_idx(const event::idx &, const bool &lower_bound = false);
|
||||
bool seek(const uint64_t &depth = -1);
|
||||
bool seek(const event::id &);
|
||||
|
||||
|
|
|
@ -381,7 +381,8 @@ ircd::m::room::events::seek(const uint64_t &depth)
|
|||
}
|
||||
|
||||
bool
|
||||
ircd::m::room::events::seek_idx(const event::idx &event_idx)
|
||||
ircd::m::room::events::seek_idx(const event::idx &event_idx,
|
||||
const bool &lower_bound)
|
||||
try
|
||||
{
|
||||
uint64_t depth(0);
|
||||
|
@ -401,9 +402,10 @@ try
|
|||
if(!bool(*this))
|
||||
return false;
|
||||
|
||||
// Check if this event_idx is actually in this room
|
||||
if(event_idx && event_idx != this->event_idx())
|
||||
return false;
|
||||
// When lower_bound=false we need to find the exact event being sought
|
||||
if(event_idx && !lower_bound)
|
||||
if(event_idx != this->event_idx())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue