mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com> Co-authored-by: Bart <bthomee@users.noreply.github.com>
50 lines
863 B
C++
50 lines
863 B
C++
#pragma once
|
|
|
|
#include <xrpl/beast/net/IPEndpoint.h>
|
|
#include <xrpl/beast/utility/instrumentation.h>
|
|
#include <xrpl/resource/detail/Kind.h>
|
|
|
|
#include <utility>
|
|
|
|
namespace xrpl::Resource {
|
|
|
|
// The consumer key
|
|
struct Key
|
|
{
|
|
Kind kind;
|
|
beast::IP::Endpoint address;
|
|
|
|
Key() = delete;
|
|
|
|
Key(Kind k, beast::IP::Endpoint addr) : kind(k), address(std::move(addr))
|
|
{
|
|
}
|
|
|
|
struct hasher
|
|
{
|
|
std::size_t
|
|
operator()(Key const& v) const
|
|
{
|
|
return m_addr_hash(v.address);
|
|
}
|
|
|
|
private:
|
|
beast::uhash<> m_addr_hash;
|
|
};
|
|
|
|
struct key_equal
|
|
{
|
|
key_equal() = default;
|
|
|
|
bool
|
|
operator()(Key const& lhs, Key const& rhs) const
|
|
{
|
|
return lhs.kind == rhs.kind && lhs.address == rhs.address;
|
|
}
|
|
|
|
private:
|
|
};
|
|
};
|
|
|
|
} // namespace xrpl::Resource
|