Skip to content

Add: recursion fix #158

@jbenet

Description

@jbenet

Currently subblocks are not added with addNode directly, but as part of their file dags. Currently, dir-file recursion happens via calls to addNode, and subblock recursion happens when addNode (on a file) calls DAG.AddRecursive(nd).

The fact that addNode calls DAG.AddRecursive(nd) means it will try to add nodes again and again as addNode is called with parent dirs. The two alternatives are to either do everything with recursive backtracking, or generate the whole dag first, and then call DAG.AddRecursively(root). The former approach is less memory intensive (as the whole DAG does not need to be in memory) and parallelizes better, as can work on siblings simultaneously (without relying on the parallelism being inside DAG.AddRecursively).

Two related changes needed:

  1. The file-sublock recursion should be the same as dir-file recursion (i.e. calling addNode on the subblock).
  2. addNode should call DAG.Add(nd)

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedSeeking public contribution on this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions