ipfs-chromium
resolution_state.h
1 #ifndef IPFS_RESOLUTION_STATE_H_
2 #define IPFS_RESOLUTION_STATE_H_
3 
4 #include <ipfs_client/ipld/dag_headers.h>
5 #include <ipfs_client/response_semantic.h>
6 
7 #include <vocab/slash_delimited.h>
8 
9 #include <functional>
10 #include <memory>
11 
12 namespace ipfs {
13 class Client;
14 }
15 
16 namespace ipfs::ipld {
17 class DagNode;
18 using NodePtr = std::shared_ptr<DagNode>;
19 using BlockLookup = std::function<NodePtr(std::string const&)>;
20 
22  std::string resolved_path_components;
23  SlashDelimited unresolved_path;
24  ResponseSemantic semantic_;
25  BlockLookup get_available_block;
26 
27  public:
28  ResolutionState(SlashDelimited path_to_resolve, ResponseSemantic, BlockLookup);
29 
30  SlashDelimited MyPath() const;
31  SlashDelimited PathToResolve() const;
32  bool IsFinalComponent() const;
33  std::string NextComponent(Client*) const;
34  NodePtr GetBlock(std::string const& block_key) const;
35 
36  ResolutionState WithPath(std::string_view) const;
37  ResolutionState RestartResolvedPath() const;
38  ResponseSemantic Semantic() const;
39 
40  void Descend();
41 
42  ipld::DagHeaders headers;
43 };
44 } // namespace ipfs::ipld
45 
46 #endif // IPFS_RESOLUTION_STATE_H_
Interface that provides functionality from whatever environment you're using this library in.
Definition: client.h:42
Definition: dag_headers.h:11
Definition: resolution_state.h:21
Definition: slash_delimited.h:15