Files
rippled/include/xrpl/peerfinder/detail/Store.h
2026-08-04 13:46:55 +00:00

37 lines
680 B
C++

#pragma once
#include <xrpl/beast/net/IPEndpoint.h>
#include <cstddef>
#include <functional>
#include <vector>
namespace xrpl::peer_finder {
/**
* Abstract persistence for PeerFinder data.
*/
class Store
{
public:
virtual ~Store() = default;
// load the bootstrap cache
using load_callback = std::function<void(beast::ip::Endpoint, int)>;
virtual std::size_t
load(load_callback const& cb) = 0;
// save the bootstrap cache
struct Entry
{
explicit Entry() = default;
beast::ip::Endpoint endpoint;
int valence{};
};
virtual void
save(std::vector<Entry> const& v) = 0;
};
} // namespace xrpl::peer_finder