ipfs-chromium
gateway_spec.h
1 #ifndef IPFS_GATEWAY_SPEC_H_
2 #define IPFS_GATEWAY_SPEC_H_
3 
4 #include <ipfs_client/gw/gateway_request_type.h>
5 #include <array>
6 #include <string>
7 
8 namespace ipfs {
11 struct GatewaySpec {
12  std::string prefix;
13  unsigned rate;
14  std::array<int, gw::RequestTypeCount> request_type_affinity;
15 
16  bool operator<(GatewaySpec const& r) const {
17  if (rate == r.rate) {
18  return prefix < r.prefix;
19  }
20  return rate > r.rate;
21  }
22  explicit GatewaySpec(std::string_view pre, unsigned r)
23  : prefix{pre}, rate{r} {
24  request_type_affinity.fill(0);
25  }
26 };
27 } // namespace ipfs
28 
29 #endif // IPFS_GATEWAY_SPEC_H_
Definition: gateway_spec.h:11