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:
35  ResolutionState(SlashDelimited path_to_resolve, ResponseSemantic semantic, BlockLookup lookup);
36 
37  SlashDelimited MyPath() const;
38  SlashDelimited PathToResolve() const;
39  bool IsFinalComponent() const;
40  std::string NextComponent(Client*) const;
41  NodePtr GetBlock(std::string const& block_key) const;
42 
43  ResolutionState WithPath(std::string_view) const;
44  ResolutionState RestartResolvedPath() const;
45  ResponseSemantic Semantic() const;
46 
47  void Descend();
48 
49  ipld::DagHeaders headers;
50 };
51 } // namespace ipfs::ipld
52 
53 #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:13
Definition: resolution_state.h:21
ResolutionState(SlashDelimited path_to_resolve, ResponseSemantic semantic, BlockLookup lookup)
Definition: slash_delimited.h:15