ipfs-chromium
ipns_names.h
1 #ifndef IPNS_NAME_RESOLVER_H_
2 #define IPNS_NAME_RESOLVER_H_
3 
4 #include <ipfs_client/ipns_record.h>
5 #include <vocab/flat_mapset.h>
6 
7 #include <string>
8 
9 namespace ipfs {
10 
14 class IpnsNames {
15  flat_map<std::string, ValidatedIpns> names_;
16 
17  public:
18  IpnsNames();
19  ~IpnsNames();
20 
31  std::string_view NameResolvedTo(std::string_view name) const;
32 
38  void AssignName(std::string const& name, ValidatedIpns rec);
39 
45  void AssignDnsLink(std::string const& host, std::string_view target);
46 
53  void NoSuchName(std::string const& name);
54 
60  ValidatedIpns const* Entry(std::string const& name);
61 
65  static constexpr std::string_view kNoSuchName{"NO_SUCH_NAME"};
66 };
67 } // namespace ipfs
68 
69 #endif // IPNS_NAME_RESOLVER_H_
Fast synchronous access to IPNS & DNSLink name resolution.
Definition: ipns_names.h:14
void AssignDnsLink(std::string const &host, std::string_view target)
Assign a target path to a DNSLink host.
ValidatedIpns const * Entry(std::string const &name)
Fetch the all the stored IPNS record data.
std::string_view NameResolvedTo(std::string_view name) const
Get the already-known "value"/target of a given name.
void NoSuchName(std::string const &name)
Store the definitive absence of a resolution.
void AssignName(std::string const &name, ValidatedIpns rec)
Store an IPNS record that already validated for this name.
static constexpr std::string_view kNoSuchName
A special value constant.
Definition: ipns_names.h:65
Data from IPNS record modulo the verification parts.
Definition: ipns_record.h:38