Radix Relay
Hybrid mesh communications with Signal Protocol encryption
Loading...
Searching...
No Matches
request_tracker.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <boost/asio/awaitable.hpp>
4#include <chrono>
5#include <concepts>
6#include <functional>
7#include <nostr/protocol.hpp>
8#include <string>
9
10namespace radix_relay::concepts {
11
18template<typename T>
19concept request_tracker = requires(T tracker,
20 const std::string &event_id,
21 std::function<void(const nostr::protocol::ok &)> callback,
22 std::chrono::milliseconds timeout,
23 const nostr::protocol::ok &response,
24 const nostr::protocol::eose &eose_response) {
25 tracker.track(event_id, callback, timeout);
26 tracker.resolve(event_id, response);
27 tracker.resolve(event_id, eose_response);
28 {
29 tracker.template async_track<nostr::protocol::ok>(event_id, timeout)
30 } -> std::same_as<boost::asio::awaitable<nostr::protocol::ok>>;
31 {
32 tracker.template async_track<nostr::protocol::eose>(event_id, timeout)
33 } -> std::same_as<boost::asio::awaitable<nostr::protocol::eose>>;
34};
35
36}// namespace radix_relay::concepts
Concept defining the interface for tracking Nostr request/response pairs.