2019-04-11 06:16:00 +02:00
|
|
|
// Matrix Construct
|
|
|
|
//
|
|
|
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
|
|
|
// Copyright (C) 2016-2019 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_FETCH_H
|
|
|
|
|
|
|
|
/// Event Fetcher (remote). This is probably not the interface you want
|
|
|
|
/// because there is no ordinary reason for developers fetch a remote event
|
|
|
|
/// directly. This is an interface to the low-level fetch system.
|
|
|
|
///
|
|
|
|
namespace ircd::m::fetch
|
|
|
|
{
|
|
|
|
struct request;
|
|
|
|
|
2019-04-12 13:02:09 +02:00
|
|
|
// Observers
|
|
|
|
bool for_each(const std::function<bool (request &)> &);
|
|
|
|
bool exists(const m::event::id &);
|
2019-06-05 03:50:17 +02:00
|
|
|
size_t count();
|
2019-04-12 12:13:40 +02:00
|
|
|
|
2019-04-12 13:02:09 +02:00
|
|
|
// Control panel
|
|
|
|
bool cancel(request &);
|
2019-04-19 04:12:37 +02:00
|
|
|
bool start(const m::room::id &, const m::event::id &);
|
|
|
|
bool prefetch(const m::room::id &, const m::event::id &);
|
2019-04-22 21:32:54 +02:00
|
|
|
bool synchronize(const m::room &);
|
2019-04-12 13:02:09 +02:00
|
|
|
|
|
|
|
// Composed operations
|
|
|
|
void auth_chain(const room &, const net::hostport &);
|
2019-04-11 06:16:00 +02:00
|
|
|
void state_ids(const room &);
|
|
|
|
|
|
|
|
extern log::log log;
|
|
|
|
}
|
2019-04-12 12:13:40 +02:00
|
|
|
|
|
|
|
/// Fetch entity state. This is not meant for construction by users of this
|
|
|
|
/// interface.
|
|
|
|
struct ircd::m::fetch::request
|
|
|
|
:m::v1::event
|
|
|
|
{
|
|
|
|
using is_transparent = void;
|
|
|
|
|
|
|
|
m::room::id::buf room_id;
|
|
|
|
m::event::id::buf event_id;
|
|
|
|
unique_buffer<mutable_buffer> buf;
|
|
|
|
std::set<std::string, std::less<>> attempted;
|
|
|
|
string_view origin;
|
|
|
|
time_t started {0};
|
|
|
|
time_t last {0};
|
|
|
|
time_t finished {0};
|
|
|
|
std::exception_ptr eptr;
|
|
|
|
|
|
|
|
request(const m::room::id &, const m::event::id &, const size_t &bufsz = 8_KiB);
|
|
|
|
request(request &&) = delete;
|
|
|
|
request(const request &) = delete;
|
2019-04-15 21:17:45 +02:00
|
|
|
request &operator=(request &&) = delete;
|
|
|
|
request &operator=(const request &) = delete;
|
2019-04-12 12:13:40 +02:00
|
|
|
};
|