xrpld
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
7#include <utility>
8
9namespace xrpl::Resource {
10
11// The consumer key
12struct Key
13{
16
17 Key() = delete;
18
19 Key(Kind k, beast::IP::Endpoint addr) : kind(k), address(std::move(addr))
20 {
21 }
22
23 struct Hasher
24 {
26 operator()(Key const& v) const
27 {
28 return addrHash_(v.address);
29 }
30
31 private:
33 };
34
35 struct KeyEqual
36 {
37 KeyEqual() = default;
38
39 bool
40 operator()(Key const& lhs, Key const& rhs) const
41 {
42 return lhs.kind == rhs.kind && lhs.address == rhs.address;
43 }
44
45 private:
46 };
47};
48
49} // namespace xrpl::Resource
A version-independent IP address and port combination.
Definition IPEndpoint.h:17
STL namespace.
Kind
Kind of consumer.
Definition Kind.h:13
std::size_t operator()(Key const &v) const
Definition Key.h:26
beast::Uhash addrHash_
Definition Key.h:32
bool operator()(Key const &lhs, Key const &rhs) const
Definition Key.h:40
beast::IP::Endpoint address
Definition Key.h:15
Key(Kind k, beast::IP::Endpoint addr)
Definition Key.h:19