func BuildDagFromReader(ds dag.DAGService, spl chunk.Splitter) (node.Node, error) { dbp := h.DagBuilderParams{ Dagserv: ds, Maxlinks: h.DefaultLinksPerBlock, } return bal.BalancedLayout(dbp.New(spl)) }
func BuildTrickleDagFromReader(ds dag.DAGService, spl chunk.Splitter) (*dag.Node, error) { dbp := h.DagBuilderParams{ Dagserv: ds, Maxlinks: h.DefaultLinksPerBlock, } return trickle.TrickleLayout(dbp.New(spl)) }
func buildTestDag(ds dag.DAGService, spl chunk.Splitter) (*dag.Node, error) { dbp := h.DagBuilderParams{ Dagserv: ds, Maxlinks: h.DefaultLinksPerBlock, } return BalancedLayout(dbp.New(spl)) }
func buildTestDag(ds dag.DAGService, spl chunk.Splitter) (*dag.Node, error) { // Start the splitter blkch, errs := chunk.Chan(spl) dbp := h.DagBuilderParams{ Dagserv: ds, Maxlinks: h.DefaultLinksPerBlock, } return BalancedLayout(dbp.New(blkch, errs)) }
func buildTestDag(r io.Reader, ds merkledag.DAGService, spl chunk.BlockSplitter) (*merkledag.Node, error) { // Start the splitter blkch := spl.Split(r) dbp := h.DagBuilderParams{ Dagserv: ds, Maxlinks: h.DefaultLinksPerBlock, } return BalancedLayout(dbp.New(blkch)) }
func BuildTrickleDagFromReader(ds dag.DAGService, spl chunk.Splitter, ncb h.NodeCB) (*dag.Node, error) { // Start the splitter blkch, errch := chunk.Chan(spl) dbp := h.DagBuilderParams{ Dagserv: ds, Maxlinks: h.DefaultLinksPerBlock, NodeCB: ncb, } return trickle.TrickleLayout(dbp.New(blkch, errch)) }
func BuildDagFromReader(r io.Reader, ds dag.DAGService, spl chunk.BlockSplitter, ncb h.NodeCB) (*dag.Node, error) { // Start the splitter blkch := spl.Split(r) dbp := h.DagBuilderParams{ Dagserv: ds, Maxlinks: h.DefaultLinksPerBlock, NodeCB: ncb, } return bal.BalancedLayout(dbp.New(blkch)) }
func buildTestDag(ds merkledag.DAGService, spl chunk.Splitter) (*merkledag.Node, error) { dbp := h.DagBuilderParams{ Dagserv: ds, Maxlinks: h.DefaultLinksPerBlock, } nd, err := TrickleLayout(dbp.New(spl)) if err != nil { return nil, err } return nd, VerifyTrickleDagStructure(nd, ds, dbp.Maxlinks, layerRepeat) }
func buildTestDag(ds dag.DAGService, spl chunk.Splitter) (*dag.ProtoNode, error) { dbp := h.DagBuilderParams{ Dagserv: ds, Maxlinks: h.DefaultLinksPerBlock, } nd, err := BalancedLayout(dbp.New(spl)) if err != nil { return nil, err } return nd.(*dag.ProtoNode), nil }
func buildTestDag(r io.Reader, ds merkledag.DAGService, spl chunk.BlockSplitter) (*merkledag.Node, error) { // Start the splitter blkch := spl.Split(r) dbp := h.DagBuilderParams{ Dagserv: ds, Maxlinks: h.DefaultLinksPerBlock, } nd, err := TrickleLayout(dbp.New(blkch)) if err != nil { return nil, err } return nd, VerifyTrickleDagStructure(nd, ds, dbp.Maxlinks, layerRepeat) }
// 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)) }