package
0.0.0-20190407150747-8b9b72514244
Repository: https://github.com/ipsn/go-ipfs.git
Documentation: pkg.go.dev
# README
go-merkledag
go-merkledag implements the 'DAGService' interface and adds two ipld node types, Protobuf and Raw
Table of Contents
TODO
- Pull out dag-pb stuff into go-ipld-pb
- Pull 'raw nodes' out into go-ipld-raw (maybe main one instead)
- Move most other logic to go-ipld
- Make dagservice constructor take a 'blockstore' to avoid the blockservice offline nonsense
- deprecate this package
Contribute
PRs are welcome!
Small note: If editing the Readme, please conform to the standard-readme specification.
License
MIT © Juan Batiz-Benet
# Functions
DecodeProtobuf decodes raw data and returns a new Node instance.
DecodeProtobufBlock is a block decoder for protobuf IPLD nodes conforming to node.DecodeBlockFunc.
DecodeRawBlock is a block decoder for raw IPLD nodes conforming to `node.DecodeBlockFunc`.
EnumerateChildren will walk the dag below the given root node and add all unseen children to the passed in set.
EnumerateChildrenAsync is equivalent to EnumerateChildren *except* that it fetches children in parallel.
EnumerateChildrenAsyncDepth is equivalent to EnumerateChildrenDepth *except* that it fetches children in parallel (down to a maximum depth in the graph).
EnumerateChildrenDepth walks the dag below the given root and passes the current depth to a given visit function.
FetchGraph fetches all nodes that are children of the given node.
FetchGraphWithDepthLimit fetches all nodes that are children to the given node down to the given depth.
GetLinksDirect creates a function to get the links for a node, from the node, bypassing the LinkService.
GetLinksWithDAG returns a GetLinks function that tries to use the given NodeGetter as a LinkGetter to get the children of a given IPLD node.
NewDAGService constructs a new DAGService (using the default implementation).
NewRawNode creates a RawNode using the default sha2-256 hash function.
NewRawNodeWPrefix creates a RawNode using the provided cid builder.
NewReadOnlyDagService takes a NodeGetter, and returns a full DAGService implementation that returns ErrReadOnly when its 'write' methods are invoked.
NewSession returns a session backed NodeGetter if the given NodeGetter implements SessionMaker.
NodeWithData builds a new Protonode with the given data.
PrefixForCidVersion returns the Protobuf prefix for a given CID version.
V0CidPrefix returns a prefix for CIDv0.
V1CidPrefix returns a prefix for CIDv1 with the default settings.
# Variables
Common errors.
Common errors.
ErrReadOnly is used when a read-only datastructure is written to.
FetchGraphConcurrency is total number of concurrent fetches that 'fetchNodes' will start at a time.
# Structs
ComboService implements ipld.DAGService, using 'Read' for all fetch methods, and 'Write' for all methods that add new objects.
ErrorService implements ipld.DAGService, returning 'Err' for every call.
ProgressTracker is used to show progress when fetching nodes.
ProtoNode represents a node in the IPFS Merkle DAG.
RawNode represents a node which only contains data.
# Interfaces
SessionMaker is an object that can generate a new fetching session.