1 #ifndef IPFS_DAG_NODE_H_
2 #define IPFS_DAG_NODE_H_
5 #include "resolution_state.h"
7 #include <ipfs_client/gw/gateway_request.h>
8 #include <ipfs_client/ipld/block_source.h>
10 #include <ipfs_client/cid.h>
11 #include <ipfs_client/response.h>
12 #include <vocab/slash_delimited.h>
19 #include <string_view>
29 struct ContentIdentifier;
31 namespace ipfs::ipld {
33 using NodePtr = std::shared_ptr<DagNode>;
49 template <
class Range>
51 : ipfs_abs_paths_(many.begin(), many.end()) {}
56 enum class ProvenAbsent {};
65 std::variant<MoreDataNeeded, Response, ProvenAbsent, PathChange>;
69 class DagNode :
public std::enable_shared_from_this<DagNode> {
70 Link* FindChild(std::string_view);
76 std::vector<std::pair<std::string, Link>> links_;
77 std::shared_ptr<Client>
api_;
85 std::function<NodePtr(std::string_view)> gen_child);
93 std::string_view link_key,
94 std::string_view block_key);
105 static NodePtr fromBytes(std::shared_ptr<Client>
const& api,
108 static NodePtr fromBytes(std::shared_ptr<Client>
const& api,
110 std::string_view bytes);
111 static NodePtr fromBlock(
PbDag const&);
119 virtual NodePtr rooted();
122 virtual NodePtr deroot();
144 virtual bool expired()
const;
148 virtual bool PreferOver(
DagNode const& another)
const;
150 void set_api(std::shared_ptr<Client>);
Something to which a CID may refer directly.
Definition: pb_dag.h:24
A block, an IPNS record, etc.
Definition: dag_node.h:69
std::shared_ptr< Client > api_
Definition: dag_node.h:77
Definition: directory_shard.h:7
Definition: dnslink_name.h:9
Definition: ipns_name.h:11
Definition: resolution_state.h:21
virtual IpnsName const * as_ipns() const
Definition: dag_node.h:137
virtual DirShard * as_hamt()
Definition: dag_node.h:134
Definition: dag_node.h:28
Definition: block_source.h:12
Definition: dag_node.h:41
MoreDataNeeded(Range const &many)
Definition: dag_node.h:50
MoreDataNeeded(std::string one)
Definition: dag_node.h:45
std::vector< std::string > ipfs_abs_paths_
Definition: dag_node.h:54
Definition: dag_node.h:60