1 #ifndef IPFS_TRUSTLESS_REQUEST_H_
2 #define IPFS_TRUSTLESS_REQUEST_H_
4 #include "gateway_request_type.h"
6 #include <ipfs_client/ipld/block_source.h>
7 #include <ipfs_client/cid.h>
8 #include <ipfs_client/client.h>
10 #include <vocab/slash_delimited.h>
16 #include <unordered_set>
30 std::string_view name(GatewayRequestType);
32 constexpr std::size_t BLOCK_RESPONSE_BUFFER_SIZE = 2UL * 1024UL * 1024UL;
33 constexpr std::size_t CAR_RESPONSE_BUFFER_SIZE = 5UL * 1024UL * 1024UL;
41 using BytesReceivedHook =
45 std::shared_ptr<Partition> orchestrator_;
46 std::vector<BytesReceivedHook> bytes_received_hooks;
47 std::string main_param;
51 void AddBlock(std::string_view bytes,
54 std::shared_ptr<Client>
const& api,
56 void AddBlocks(
Car& car,
57 std::shared_ptr<Client>
const& api,
59 bool IpnsResponse(ByteView bytes, std::shared_ptr<Client>
const& api,
bool& success,
bool* valid,
ipld::BlockSource src);
62 GatewayRequestType type = GatewayRequestType::Zombie;
66 std::shared_ptr<IpfsRequest> dependent;
67 std::optional<Cid> cid;
70 std::unordered_set<std::string> failures;
72 std::string url_suffix()
const;
73 std::string_view accept()
const;
74 std::string_view identity_data()
const;
75 short timeout_seconds()
const;
77 std::optional<std::size_t> max_response_size()
const;
78 std::optional<HttpRequestDescription> describe_http(std::string_view)
const;
79 std::string debug_string()
const;
80 void orchestrator(std::shared_ptr<Partition>
const&);
81 bool cachable()
const;
82 std::string_view root_component()
const;
83 void root_component(std::string_view);
85 bool RespondSuccessfully(std::string_view,
86 std::shared_ptr<Client>
const& api,
88 std::string_view roots =
"",
89 bool* valid =
nullptr);
90 void Hook(BytesReceivedHook);
91 bool PartiallyRedundant()
const;
92 std::string Key()
const;
93 bool Finished()
const;
95 static std::shared_ptr<GatewayRequest> fromIpfsPath(
SlashDelimited ipfs_path);
100 inline std::ostream& operator<<(std::ostream& s,
101 ipfs::gw::GatewayRequestType t) {
Definition: gateway_request.h:39
std::string path
For CAR requests.
Definition: gateway_request.h:65
Definition: slash_delimited.h:15
Definition: block_source.h:12