xrpld
Loading...
Searching...
No Matches
Key.h
1#pragma once
2
3#include <xrpl/beast/hash/uhash.h>
4#include <xrpl/beast/net/IPEndpoint.h>
5#include <xrpl/resource/detail/Kind.h>
6
7#include <cstddef>
8#include <utility>
9
10namespace xrpl::resource {
11
12// The consumer key
13struct Key
14{
17
18 Key() = delete;
19
20 Key(Kind k, beast::ip::Endpoint addr) : kind(k), address(std::move(addr))
21 {
22 }
23
24 struct Hasher
25 {
27 operator()(Key const& v) const
28 {
29 return addrHash_(v.address);
30 }
31
32 private:
34 };
35
36 struct KeyEqual
37 {
38 KeyEqual() = default;
39
40 bool
41 operator()(Key const& lhs, Key const& rhs) const
42 {
43 return lhs.kind == rhs.kind && lhs.address == rhs.address;
44 }
45
46 private:
47 };
48};
49
50} // namespace xrpl::resource
A version-independent IP address and port combination.
Definition IPEndpoint.h:24
STL namespace.
Kind
Kind of consumer.
Definition Kind.h:13
std::size_t operator()(Key const &v) const
Definition Key.h:27
beast::Uhash addrHash_
Definition Key.h:33
bool operator()(Key const &lhs, Key const &rhs) const
Definition Key.h:41
Key(Kind k, beast::ip::Endpoint addr)
Definition Key.h:20
beast::ip::Endpoint address
Definition Key.h:16