Versions in this module Expand all Collapse all v0 v0.0.3 Aug 29, 2021 v0.0.2 Aug 21, 2021 Changes in this version + var EndOfDag = errors.New("end of DAG") + var ErrClosed = errors.New("error: batch closed") + var ErrDownNoChild = errors.New("can't go down, the child does not exist") + var ErrNextNoChild = errors.New("can't go to the next child, no more child nodes in this parent") + var ErrNilVisitor = errors.New("no Visitor function specified") + var ErrNotCommited = errors.New("error: batch not commited") + var ErrNotFound = fmt.Errorf("merkledag: not found") + func Copy(ctx context.Context, from, to DAGService, root cid.Cid) error + func Register(codec uint64, decoder DecodeBlockFunc) + type Batch struct + func NewBatch(ctx context.Context, na NodeAdder, opts ...BatchOption) *Batch + func (t *Batch) Add(ctx context.Context, nd Node) error + func (t *Batch) AddMany(ctx context.Context, nodes []Node) error + func (t *Batch) Commit() error + type BatchOption func(o *batchOptions) + func MaxNodesBatchOption(num int) BatchOption + func MaxSizeBatchOption(size int) BatchOption + type BlockDecoder interface + Decode func(blocks.Block) (Node, error) + Register func(codec uint64, decoder DecodeBlockFunc) + var DefaultBlockDecoder BlockDecoder = &safeBlockDecoder{ ... } + type BufferedDAG struct + func NewBufferedDAG(ctx context.Context, ds DAGService, opts ...BatchOption) *BufferedDAG + func (bd *BufferedDAG) Add(ctx context.Context, n Node) error + func (bd *BufferedDAG) AddMany(ctx context.Context, nds []Node) error + func (bd *BufferedDAG) Commit() error + func (bd *BufferedDAG) Get(ctx context.Context, c cid.Cid) (Node, error) + func (bd *BufferedDAG) GetMany(ctx context.Context, cs []cid.Cid) <-chan *NodeOption + func (bd *BufferedDAG) Remove(ctx context.Context, c cid.Cid) error + func (bd *BufferedDAG) RemoveMany(ctx context.Context, cs []cid.Cid) error + type DAGService interface + Remove func(context.Context, cid.Cid) error + RemoveMany func(context.Context, []cid.Cid) error + type DecodeBlockFunc func(block blocks.Block) (Node, error) + type Link struct + Cid cid.Cid + Name string + Size uint64 + func GetLinks(ctx context.Context, ng NodeGetter, c cid.Cid) ([]*Link, error) + func MakeLink(n Node) (*Link, error) + func (l *Link) GetNode(ctx context.Context, serv NodeGetter) (Node, error) + type LinkGetter interface + GetLinks func(ctx context.Context, nd cid.Cid) ([]*Link, error) + type NavigableLDNode struct + func NewNavigableLDNode(node Node, nodeGetter NodeGetter) *NavigableLDNode + func (nn *NavigableLDNode) ChildTotal() uint + func (nn *NavigableLDNode) FetchChild(ctx context.Context, childIndex uint) (NavigableNode, error) + func (nn *NavigableLDNode) GetLDNode() Node + type NavigableNode interface + ChildTotal func() uint + FetchChild func(ctx context.Context, childIndex uint) (NavigableNode, error) + GetLDNode func() Node + type Node interface + Copy func() Node + Links func() []*Link + ResolveLink func(path []string) (*Link, []string, error) + Size func() (uint64, error) + Stat func() (*NodeStat, error) + func Decode(block blocks.Block) (Node, error) + func ExtractLDNode(node NavigableNode) Node + type NodeAdder interface + Add func(context.Context, Node) error + AddMany func(context.Context, []Node) error + type NodeGetter interface + Get func(context.Context, cid.Cid) (Node, error) + GetMany func(context.Context, []cid.Cid) <-chan *NodeOption + type NodeOption struct + Err error + Node Node + type NodePromise struct + func GetDAG(ctx context.Context, ds NodeGetter, root Node) []*NodePromise + func GetNodes(ctx context.Context, ds NodeGetter, keys []cid.Cid) []*NodePromise + func NewNodePromise(ctx context.Context) *NodePromise + func (np *NodePromise) Fail(err error) + func (np *NodePromise) Get(ctx context.Context) (Node, error) + func (np *NodePromise) Send(nd Node) + type NodeStat struct + BlockSize int + CumulativeSize int + DataSize int + Hash string + LinksSize int + NumLinks int + func (ns NodeStat) String() string + type Resolver interface + Resolve func(path []string) (interface{}, []string, error) + Tree func(path string, depth int) []string + type Visitor func(node NavigableNode) error + type Walker struct + func NewWalker(ctx context.Context, root NavigableNode) *Walker + func (w *Walker) ActiveChildIndex() uint + func (w *Walker) ActiveNode() NavigableNode + func (w *Walker) Iterate(visitor Visitor) error + func (w *Walker) NextChild() error + func (w *Walker) Pause() + func (w *Walker) Seek(visitor Visitor) error + func (w *Walker) SetContext(ctx context.Context)