sgns::crdt::GraphsyncDAGSyncer¶
A DAGSyncer is an abstraction to an IPLD-based p2p storage layer. A DAGSyncer is a DAGService with the ability to publish new ipld nodes to the network, and retrieving others from it.
#include <graphsync_dagsyncer.hpp>
Inherits from sgns::crdt::DAGSyncer, std::enable_shared_from_this< GraphsyncDAGSyncer >
Public Classes¶
| Name | |
|---|---|
| struct | BlacklistEntry |
Public Types¶
| Name | |
|---|---|
| enum class | Error |
| using ipfs_lite::ipfs::IpfsDatastore | IpfsDatastore |
| using ipfs_lite::ipfs::graphsync::Graphsync | Graphsync |
| using ipfs_lite::ipfs::graphsync::ResponseMetadata | ResponseMetadata |
| using ipfs_lite::ipfs::graphsync::Extension | Extension |
| using ipfs_lite::ipfs::graphsync::MerkleDagBridgeImpl | MerkleDagBridgeImpl |
| using ipfs_lite::ipfs::graphsync::ResponseStatusCode | ResponseStatusCode |
| using libp2p::multi::Multiaddress | Multiaddress |
| using libp2p::multi::Multihash | Multihash |
| using libp2p::peer::PeerId | PeerId |
| using libp2p::protocol::Subscription | Subscription |
| using base::Logger | Logger |
| using Graphsync::BlockCallback | BlockCallback |
| using size_t | PeerKey |
| using std::pair< PeerId, std::vector< Multiaddress > > | PeerEntry |
| using std::map< CID, PeerKey > | RouteMapType |
Public Functions¶
| Name | |
|---|---|
| GraphsyncDAGSyncer(std::shared_ptr< IpfsDatastore > service, std::shared_ptr< Graphsync > graphsync, std::shared_ptr< libp2p::Host > host) | |
| ~GraphsyncDAGSyncer() override | |
| outcome::result< void > | Listen(const Multiaddress & listen_to) |
| outcome::result< void > | StartSync() |
| void | AddRoute(const CID & cid, const PeerId & peer, std::vector< Multiaddress > address) |
| outcome::result< void > | addNode(std::shared_ptr< const ipfs_lite::ipld::IPLDNode > node) override |
| outcome::result< std::shared_ptr< ipfs_lite::ipld::IPLDNode > > | getNode(const CID & cid) const override |
| outcome::result< void > | removeNode(const CID & cid) override |
| outcome::result< size_t > | select(gsl::span< const uint8_t > root_cid, gsl::span< const uint8_t > selector, std::function< bool(std::shared_ptr< const ipfs_lite::ipld::IPLDNode > node)> handler) const override |
| outcome::result< std::shared_ptr< ipfs_lite::ipfs::merkledag::Leaf > > | fetchGraph(const CID & cid) const override |
| outcome::result< std::shared_ptr< ipfs_lite::ipfs::merkledag::Leaf > > | fetchGraphOnDepth(const CID & cid, uint64_t depth) const override |
| virtual outcome::result< bool > | HasBlock(const CID & cid) const override |
| virtual outcome::result< std::shared_ptr< ipfs_lite::ipld::IPLDNode > > | GetNodeWithoutRequest(const CID & cid) const override |
| outcome::result< std::shared_ptr< ipfs_lite::ipld::IPLDNode > > | GetNodeFromMerkleDAG(const CID & cid) const |
| virtual std::pair< LinkInfoSet, LinkInfoSet > | TraverseCIDsLinks(ipfs_lite::ipld::IPLDNode & node, std::string link_name ="", LinkInfoSet visited ={}) const override |
| virtual outcome::result< void > | markResolved(const CID & cid) override |
| virtual outcome::result< bool > | isResolved(const CID & cid) const override |
| outcome::result< PeerId > | GetId() const |
| outcome::result< libp2p::peer::PeerInfo > | GetPeerInfo() const |
| void | AddToBlackList(const PeerId & peer) const |
| bool | IsOnBlackList(const PeerId & peer) const |
| virtual void | InitCIDBlock(const CID & cid) override |
| virtual bool | IsCIDInCache(const CID & cid) const override |
| virtual outcome::result< void > | DeleteCIDBlock(const CID & cid) override |
| virtual void | Stop() override |
Additional inherited members¶
Public Types inherited from sgns::crdt::DAGSyncer
| Name | |
|---|---|
| using std::pair< CID, std::string > | LinkInfoPair |
| using std::set< LinkInfoPair > | LinkInfoSet |
Public Types Documentation¶
enum Error¶
| Enumerator | Value | Description |
|---|---|---|
| CID_NOT_FOUND | 0 | The requested CID wasn't found. |
| ROUTE_NOT_FOUND | Route for the CID wasn't found. | |
| PEER_BLACKLISTED | The peer that has the CID is blacklisted. | |
| TIMED_OUT | The request has timed out. | |
| DAGSYNCER_NOT_STARTED | Start wasn't called, or StopSync was called. | |
| GRAPHSYNC_IS_NULL | Graphsync member is nullptr. | |
| HOST_IS_NULL | Graphsync member is nullptr. |
using IpfsDatastore¶
using Graphsync¶
using ResponseMetadata¶
using sgns::crdt::GraphsyncDAGSyncer::ResponseMetadata = ipfs_lite::ipfs::graphsync::ResponseMetadata;
using Extension¶
using MerkleDagBridgeImpl¶
using sgns::crdt::GraphsyncDAGSyncer::MerkleDagBridgeImpl = ipfs_lite::ipfs::graphsync::MerkleDagBridgeImpl;
using ResponseStatusCode¶
using sgns::crdt::GraphsyncDAGSyncer::ResponseStatusCode = ipfs_lite::ipfs::graphsync::ResponseStatusCode;
using Multiaddress¶
using Multihash¶
using PeerId¶
using Subscription¶
using Logger¶
using BlockCallback¶
using PeerKey¶
using PeerEntry¶
using RouteMapType¶
Public Functions Documentation¶
function GraphsyncDAGSyncer¶
GraphsyncDAGSyncer(
std::shared_ptr< IpfsDatastore > service,
std::shared_ptr< Graphsync > graphsync,
std::shared_ptr< libp2p::Host > host
)
function ~GraphsyncDAGSyncer¶
function Listen¶
function StartSync¶
Starts instance and subscribes to blocks
function AddRoute¶
function addNode¶
function getNode¶
outcome::result< std::shared_ptr< ipfs_lite::ipld::IPLDNode > > getNode(
const CID & cid
) const override
function removeNode¶
function select¶
outcome::result< size_t > select(
gsl::span< const uint8_t > root_cid,
gsl::span< const uint8_t > selector,
std::function< bool(std::shared_ptr< const ipfs_lite::ipld::IPLDNode > node)> handler
) const override
function fetchGraph¶
outcome::result< std::shared_ptr< ipfs_lite::ipfs::merkledag::Leaf > > fetchGraph(
const CID & cid
) const override
function fetchGraphOnDepth¶
outcome::result< std::shared_ptr< ipfs_lite::ipfs::merkledag::Leaf > > fetchGraphOnDepth(
const CID & cid,
uint64_t depth
) const override
function HasBlock¶
Parameters:
- cid Content identifier of the node
Return: true if the block is locally available or outcome::failure on error
Reimplements: sgns::crdt::DAGSyncer::HasBlock
Check if the block with cid is locally available (therefore, it is considered processed).
function GetNodeWithoutRequest¶
virtual outcome::result< std::shared_ptr< ipfs_lite::ipld::IPLDNode > > GetNodeWithoutRequest(
const CID & cid
) const override
Reimplements: sgns::crdt::DAGSyncer::GetNodeWithoutRequest
function GetNodeFromMerkleDAG¶
outcome::result< std::shared_ptr< ipfs_lite::ipld::IPLDNode > > GetNodeFromMerkleDAG(
const CID & cid
) const
function TraverseCIDsLinks¶
virtual std::pair< LinkInfoSet, LinkInfoSet > TraverseCIDsLinks(
ipfs_lite::ipld::IPLDNode & node,
std::string link_name ="",
LinkInfoSet visited ={}
) const override
Reimplements: sgns::crdt::DAGSyncer::TraverseCIDsLinks
function markResolved¶
Reimplements: sgns::crdt::DAGSyncer::markResolved
function isResolved¶
Reimplements: sgns::crdt::DAGSyncer::isResolved
function GetId¶
function GetPeerInfo¶
function AddToBlackList¶
function IsOnBlackList¶
function InitCIDBlock¶
Reimplements: sgns::crdt::DAGSyncer::InitCIDBlock
function IsCIDInCache¶
Reimplements: sgns::crdt::DAGSyncer::IsCIDInCache
function DeleteCIDBlock¶
Reimplements: sgns::crdt::DAGSyncer::DeleteCIDBlock
function Stop¶
Reimplements: sgns::crdt::DAGSyncer::Stop
Updated on 2026-03-04 at 13:10:43 -0800