mirror of
https://github.com/matrix-construct/construct
synced 2024-09-25 01:48:58 +02:00
41 lines
1.3 KiB
C
41 lines
1.3 KiB
C
|
// Matrix Construct
|
||
|
//
|
||
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||
|
// Copyright (C) 2016-2023 Jason Volk <jason@zemos.net>
|
||
|
//
|
||
|
// Permission to use, copy, modify, and/or distribute this software for any
|
||
|
// purpose with or without fee is hereby granted, provided that the above
|
||
|
// copyright notice and this permission notice is present in all copies. The
|
||
|
// full license for this software is available in the LICENSE file.
|
||
|
|
||
|
#pragma once
|
||
|
#define HAVE_IRCD_M_ROOM_EVENTS_MISSING_H
|
||
|
|
||
|
/// Find missing room events. This is a breadth-first iteration of missing
|
||
|
/// references from the tophead (or at the event provided in the room arg)
|
||
|
///
|
||
|
/// The closure is invoked with the first argument being the event_id unknown
|
||
|
/// to the server, followed by the depth and event::idx of the event making the
|
||
|
/// reference.
|
||
|
///
|
||
|
struct ircd::m::room::events::missing
|
||
|
{
|
||
|
using closure = std::function<bool (const event::id &, const uint64_t &, const event::idx &)>;
|
||
|
|
||
|
m::room room;
|
||
|
|
||
|
private:
|
||
|
bool _each(m::room::events &, const closure &) const;
|
||
|
|
||
|
public:
|
||
|
bool rfor_each(const pair<int64_t> &depth, const closure &) const;
|
||
|
bool for_each(const pair<int64_t> &depth, const closure &) const;
|
||
|
bool for_each(const closure &) const;
|
||
|
size_t count() const;
|
||
|
|
||
|
missing() = default;
|
||
|
missing(const m::room &room)
|
||
|
:room{room}
|
||
|
{}
|
||
|
};
|