rippled
Loading...
Searching...
No Matches
Key.h
1#pragma once
2
3#include <xrpl/beast/net/IPEndpoint.h>
4#include <xrpl/beast/utility/instrumentation.h>
5#include <xrpl/resource/detail/Kind.h>
6
7namespace xrpl {
8namespace Resource {
9
10// The consumer key
11struct Key
12{
15
16 Key() = delete;
17
18 Key(Kind k, beast::IP::Endpoint const& addr) : kind(k), address(addr)
19 {
20 }
21
22 struct hasher
23 {
25 operator()(Key const& v) const
26 {
27 return m_addr_hash(v.address);
28 }
29
30 private:
32 };
33
34 struct key_equal
35 {
36 key_equal() = default;
37
38 bool
39 operator()(Key const& lhs, Key const& rhs) const
40 {
41 return lhs.kind == rhs.kind && lhs.address == rhs.address;
42 }
43
44 private:
45 };
46};
47
48} // namespace Resource
49} // namespace xrpl
A version-independent IP address and port combination.
Definition IPEndpoint.h:18
Kind
Kind of consumer.
Definition Kind.h:14
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
beast::uhash m_addr_hash
Definition Key.h:31
std::size_t operator()(Key const &v) const
Definition Key.h:25
bool operator()(Key const &lhs, Key const &rhs) const
Definition Key.h:39
Key(Kind k, beast::IP::Endpoint const &addr)
Definition Key.h:18
beast::IP::Endpoint address
Definition Key.h:14