ipfs-chromium
Public Member Functions | Static Public Attributes | List of all members
ipfs::IpnsNames Class Reference

Fast synchronous access to IPNS & DNSLink name resolution. More...

#include <library/include/ipfs_client/ipns_names.h>

Collaboration diagram for ipfs::IpnsNames:
Collaboration graph
[legend]

Public Member Functions

std::string_view NameResolvedTo (std::string_view name) const
 Get the already-known "value"/target of a given name. More...
 
void AssignName (std::string const &name, ValidatedIpns rec)
 Store an IPNS record that already validated for this name. More...
 
void AssignDnsLink (std::string const &host, std::string_view target)
 Assign a target path to a DNSLink host. More...
 
void NoSuchName (std::string const &name)
 Store the definitive absence of a resolution. More...
 
ValidatedIpns const * Entry (std::string const &name)
 Fetch the all the stored IPNS record data. More...
 

Static Public Attributes

static constexpr std::string_view kNoSuchName {"NO_SUCH_NAME"}
 A special value constant.
 

Detailed Description

Fast synchronous access to IPNS & DNSLink name resolution.

Member Function Documentation

◆ AssignDnsLink()

void ipfs::IpnsNames::AssignDnsLink ( std::string const &  host,
std::string_view  target 
)

Assign a target path to a DNSLink host.

Parameters
host- The original host NOT including a "_dnslink." prefix
target- an IPFS path witout leading /

◆ AssignName()

void ipfs::IpnsNames::AssignName ( std::string const &  name,
ValidatedIpns  rec 
)

Store an IPNS record that already validated for this name.

Parameters
name- The name that resolves with this
rec- The record modulo validation bits

◆ Entry()

ValidatedIpns const* ipfs::IpnsNames::Entry ( std::string const &  name)

Fetch the all the stored IPNS record data.

Parameters
name- the IPNS name it was stored with
Returns
nullptr if missing, otherwise non-owning pointer to record

◆ NameResolvedTo()

std::string_view ipfs::IpnsNames::NameResolvedTo ( std::string_view  name) const

Get the already-known "value"/target of a given name.

Parameters
name- either a mb-mf IPNS (key) name, or a host with DNSLink
Returns
  • if resolution is incomplete: ""
  • if it is known not to resolve: kNoSuchName
  • otherwise an IPFS path witout leading /, e.g.:
    • ipfs/bafybeicfqz46dj67nkhxaylqd5sknnidsr4oaw4hhsjrgdmcwt73sow2d4/
    • ipns/k51qzi5uqu5dlvj2baxnqndepeb86cbk3ng7n3i46uzyxzyqj2xjonzllnv0v8

◆ NoSuchName()

void ipfs::IpnsNames::NoSuchName ( std::string const &  name)

Store the definitive absence of a resolution.

This is useful because code will check resolution here before trying to resolve it fresh again, and you can stop that if you know it will never work.


The documentation for this class was generated from the following file: