1 #ifndef IPFS_TRUSTLESS_REQUEST_H_
2 #define IPFS_TRUSTLESS_REQUEST_H_
4 #include <ipfs_client/ipld/block_source.h>
6 #include <ipfs_client/cid.h>
7 #include <ipfs_client/client.h>
9 #include <vocab/flat_mapset.h>
10 #include <vocab/slash_delimited.h>
16 #include "gateway_request_type.h"
29 std::string_view name(GatewayRequestType);
31 constexpr std::size_t BLOCK_RESPONSE_BUFFER_SIZE = 2 * 1024 * 1024;
37 using BytesReceivedHook =
41 std::shared_ptr<Partition> orchestrator_;
42 std::vector<BytesReceivedHook> bytes_received_hooks;
46 void AddBlock(std::string_view bytes,
49 std::shared_ptr<Client>
const& api,
53 GatewayRequestType type = GatewayRequestType::Zombie;
58 std::shared_ptr<IpfsRequest> dependent;
59 std::optional<Cid> cid;
62 flat_set<std::string> failures;
64 std::string url_suffix()
const;
65 std::string_view accept()
const;
66 std::string_view identity_data()
const;
67 short timeout_seconds()
const;
69 std::optional<std::size_t> max_response_size()
const;
70 std::optional<HttpRequestDescription> describe_http(std::string_view)
const;
71 std::string debug_string()
const;
72 void orchestrator(std::shared_ptr<Partition>
const&);
73 bool cachable()
const;
75 bool RespondSuccessfully(std::string_view,
76 std::shared_ptr<Client>
const& api,
78 std::string_view roots =
"",
79 bool* valid =
nullptr);
80 void Hook(BytesReceivedHook);
81 bool PartiallyRedundant()
const;
82 std::string Key()
const;
83 bool Finished()
const;
85 static std::shared_ptr<GatewayRequest> fromIpfsPath(
SlashDelimited);
90 inline std::ostream& operator<<(std::ostream& s,
91 ipfs::gw::GatewayRequestType t) {
Definition: gateway_request.h:35
std::string path
For CAR requests.
Definition: gateway_request.h:57
std::string main_param
CID, IPNS name, hostname.
Definition: gateway_request.h:56
Definition: slash_delimited.h:15
Definition: block_source.h:12