// 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 add(n *core.IpfsNode, reader io.Reader, useTrickle bool) (*dag.Node, error) { var node *dag.Node var err error if useTrickle { node, err = importer.BuildTrickleDagFromReader( reader, n.DAG, chunk.DefaultSplitter, importer.PinIndirectCB(n.Pinning.GetManual()), ) } else { node, err = importer.BuildDagFromReader( reader, n.DAG, chunk.DefaultSplitter, importer.PinIndirectCB(n.Pinning.GetManual()), ) } if err != nil { return nil, err } return node, nil }
func add(n *core.IpfsNode, reader io.Reader) (*merkledag.Node, error) { mp := n.Pinning.GetManual() return importer.BuildDagFromReader( n.DAG, chunk.DefaultSplitter(reader), importer.PinIndirectCB(mp), ) }
func add(n *core.IpfsNode, reader io.Reader) (*merkledag.Node, error) { mp := n.Pinning.GetManual() node, err := importer.BuildDagFromReader( reader, n.DAG, chunk.DefaultSplitter, importer.PinIndirectCB(mp), ) if err != nil { return nil, err } return node, nil }