ipfs-chromium
Loading...
Searching...
No Matches
partition.h
1#ifndef IPFS_ORCHESTRATOR_H_
2#define IPFS_ORCHESTRATOR_H_
3
4#include "ipfs_client/ipld/dag_node.h"
5
6#include <ipfs_client/gw/requestor.h>
7#include <vocab/flat_mapset.h>
8
9#include <memory>
10#include <string>
11
12namespace ipfs {
13
14class Client;
18class Partition : public std::enable_shared_from_this<Partition> {
19 public:
20 using MimeDetection = std::function<
21 std::string(std::string, std::string_view, std::string const&)>;
22 void build_response(std::shared_ptr<IpfsRequest>);
23 bool add_node(std::string key, ipld::NodePtr);
24 bool has_key(std::string const& k) const;
25 std::size_t Stored() const { return dags_.size(); }
26
27 explicit Partition(std::shared_ptr<gw::Requestor> requestor,
28 std::shared_ptr<Client>);
29
30 private:
31 flat_map<std::string, ipld::NodePtr> dags_;
32 std::shared_ptr<Client> api_;
33 std::shared_ptr<gw::Requestor> requestor_;
34
35 void from_tree(std::shared_ptr<IpfsRequest>,
36 ipld::NodePtr&,
38 std::string const&);
39 bool gw_request(std::shared_ptr<IpfsRequest>,
40 SlashDelimited path,
41 std::string const& aff);
42 std::string sniff(SlashDelimited, std::string const&) const;
43};
44} // namespace ipfs::ipld
45
46#endif // IPFS_ORCHESTRATOR_H_
Definition partition.h:18
Definition slash_delimited.h:15