// Perform the actual add & pin locally, outputting results to reader func add(n *core.IpfsNode, reader io.Reader, useTrickle bool, chunker string) (*dag.Node, error) { chnk, err := chunk.FromString(reader, chunker) if err != nil { return nil, err } var node *dag.Node if useTrickle { node, err = importer.BuildTrickleDagFromReader( n.DAG, chnk, importer.PinIndirectCB(n.Pinning.GetManual()), ) } else { node, err = importer.BuildDagFromReader( n.DAG, chnk, importer.PinIndirectCB(n.Pinning.GetManual()), ) } if err != nil { return nil, err } return node, nil }
// Perform the actual add & pin locally, outputting results to reader func (adder Adder) add(reader io.Reader) (node.Node, error) { chnk, err := chunk.FromString(reader, adder.Chunker) if err != nil { return nil, err } params := ihelper.DagBuilderParams{ Dagserv: adder.dagService, RawLeaves: adder.RawLeaves, Maxlinks: ihelper.DefaultLinksPerBlock, } if adder.Trickle { return trickle.TrickleLayout(params.New(chnk)) } return balanced.BalancedLayout(params.New(chnk)) }
// Perform the actual add & pin locally, outputting results to reader func (adder Adder) add(reader io.Reader) (*dag.Node, error) { chnk, err := chunk.FromString(reader, adder.Chunker) if err != nil { return nil, err } if adder.Trickle { return importer.BuildTrickleDagFromReader( adder.node.DAG, chnk, ) } return importer.BuildDagFromReader( adder.node.DAG, chnk, ) }