ipfs-chromium
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ipfs::ipld::DagNode Class Referenceabstract

A block, an IPNS record, etc. More...

#include <library/include/ipfs_client/ipld/dag_node.h>

Inheritance diagram for ipfs::ipld::DagNode:
Inheritance graph
[legend]
Collaboration diagram for ipfs::ipld::DagNode:
Collaboration graph
[legend]

Public Member Functions

ResolveResult Resolve (ResolutionState &params)
 
virtual NodePtr rooted ()
 
virtual NodePtr deroot ()
 
virtual DnsLinkName const * as_dnslink () const
 
virtual DirShardas_hamt ()
 
virtual IpnsName const * as_ipns () const
 
virtual bool expired () const
 
virtual bool PreferOver (DagNode const &another) const
 
void set_api (std::shared_ptr< Client >)
 
void source (BlockSource src)
 

Static Public Member Functions

static NodePtr fromBytes (std::shared_ptr< Client > const &api, Cid const &, ByteView bytes)
 
static NodePtr fromBytes (std::shared_ptr< Client > const &api, Cid const &, std::string_view bytes)
 
static NodePtr fromBlock (PbDag const &)
 

Protected Member Functions

ResolveResult CallChild (ResolutionState &)
 As before, but it might be possible to create on the fly if not known.
 
ResolveResult CallChild (ResolutionState &, std::function< NodePtr(std::string_view)> gen_child)
 
ResolveResult CallChild (ResolutionState &, std::string_view link_key)
 Add the link if not present, then CallChild(ResolutionState)
 
ResolveResult CallChild (ResolutionState &, std::string_view link_key, std::string_view block_key)
 

Protected Attributes

std::vector< std::pair< std::string, Link > > links_
 
std::shared_ptr< Clientapi_
 

Detailed Description

A block, an IPNS record, etc.

Member Function Documentation

◆ CallChild()

auto Node::CallChild ( ResolutionState state,
std::function< NodePtr(std::string_view)>  gen_child 
)
protected

When the child's name is not the next element in the path, but it must be known about. e.g. index.html for a path ending in a directory

◆ deroot()

auto Node::deroot ( )
virtual
Returns
*this if it's not a Root, otherwise its child

◆ expired()

auto Node::expired ( ) const
virtual
Returns
Whether the node should be considered expired.
Note
immutable data never expires

Reimplemented in ipfs::ipld::IpnsName, and ipfs::ipld::DnsLinkName.

◆ PreferOver()

auto Node::PreferOver ( DagNode const &  another) const
virtual
Returns
Whether this is a "better"/more-up-to-date replacement
Parameters
anotherThe node to compare to.

◆ Resolve()

auto Node::Resolve ( ResolutionState params)

Query the DAG

Parameters
paramsInformation about what you're looking for
Returns
The data needed or how to get it or some additional info needed before asking again.

◆ rooted()

auto Node::rooted ( )
virtual

Get a root node that is logically this node

Returns
this iff this is of type ipfs::ipld::Root Otherwise a Root that has this as a child.

Member Data Documentation

◆ api_

std::shared_ptr<Client> ipfs::ipld::DagNode::api_
protected

When the next path element is what's needed, and it should already be a link known about...


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