@@ -65,10 +65,12 @@ func (n *UnixfsNode) SetPrefix(prefix *cid.Prefix) {
65
65
n .node .SetPrefix (prefix )
66
66
}
67
67
68
+ // NumChildren returns the number of children referenced by this UnixfsNode.
68
69
func (n * UnixfsNode ) NumChildren () int {
69
70
return n .ufmt .NumChildren ()
70
71
}
71
72
73
+ // Set replaces this UnixfsNode with another UnixfsNode
72
74
func (n * UnixfsNode ) Set (other * UnixfsNode ) {
73
75
n .node = other .node
74
76
n .raw = other .raw
@@ -78,6 +80,7 @@ func (n *UnixfsNode) Set(other *UnixfsNode) {
78
80
}
79
81
}
80
82
83
+ // GetChild gets the ith child of this node from the given DAGService.
81
84
func (n * UnixfsNode ) GetChild (ctx context.Context , i int , ds node.DAGService ) (* UnixfsNode , error ) {
82
85
nd , err := n .node .Links ()[i ].GetNode (ctx , ds )
83
86
if err != nil {
@@ -92,8 +95,8 @@ func (n *UnixfsNode) GetChild(ctx context.Context, i int, ds node.DAGService) (*
92
95
return NewUnixfsNodeFromDag (pbn )
93
96
}
94
97
95
- // addChild will add the given UnixfsNode as a child of the receiver.
96
- // the passed in DagBuilderHelper is used to store the child node an
98
+ // AddChild adds the given UnixfsNode as a child of the receiver.
99
+ // The passed in DagBuilderHelper is used to store the child node an
97
100
// pin it locally so it doesnt get lost
98
101
func (n * UnixfsNode ) AddChild (child * UnixfsNode , db * DagBuilderHelper ) error {
99
102
n .ufmt .AddBlockSize (child .FileSize ())
@@ -115,7 +118,7 @@ func (n *UnixfsNode) AddChild(child *UnixfsNode, db *DagBuilderHelper) error {
115
118
return err
116
119
}
117
120
118
- // Removes the child node at the given index
121
+ // RemoveChild removes the child node at the given index
119
122
func (n * UnixfsNode ) RemoveChild (index int , dbh * DagBuilderHelper ) {
120
123
n .ufmt .RemoveBlockSize (index )
121
124
n .node .SetLinks (append (n .node .Links ()[:index ], n .node .Links ()[index + 1 :]... ))
@@ -140,7 +143,7 @@ func (n *UnixfsNode) SetPosInfo(offset uint64, fullPath string, stat os.FileInfo
140
143
}
141
144
}
142
145
143
- // getDagNode fills out the proper formatting for the unixfs node
146
+ // GetDagNode fills out the proper formatting for the unixfs node
144
147
// inside of a DAG node and returns the dag node
145
148
func (n * UnixfsNode ) GetDagNode () (node.Node , error ) {
146
149
nd , err := n .getBaseDagNode ()
0 commit comments