@@ -51,16 +51,16 @@ const removeFromDirectory = async (context, options) => {
51
51
const format = mc [ options . format . toUpperCase ( ) . replace ( / - / g, '_' ) ]
52
52
const hashAlg = mh . names [ options . hashAlg ]
53
53
54
- const newParentNode = await DAGNode . rmLink ( options . parent , options . name )
55
- const cid = await context . ipld . put ( newParentNode , format , {
54
+ options . parent . rmLink ( options . name )
55
+ const cid = await context . ipld . put ( options . parent , format , {
56
56
cidVersion : options . cidVersion ,
57
57
hashAlg
58
58
} )
59
59
60
60
log ( `Updated regular directory ${ cid } ` )
61
61
62
62
return {
63
- node : newParentNode ,
63
+ node : options . parent ,
64
64
cid
65
65
}
66
66
}
@@ -104,11 +104,11 @@ const updateShard = async (context, positions, child, options) => {
104
104
if ( link . Name === `${ prefix } ${ child . name } ` ) {
105
105
log ( `Removing existing link ${ link . Name } ` )
106
106
107
- const newNode = await DAGNode . rmLink ( node , link . Name )
107
+ node . rmLink ( link . Name )
108
108
109
109
await bucket . del ( child . name )
110
110
111
- return updateHamtDirectory ( context , newNode . Links , bucket , options )
111
+ return updateHamtDirectory ( context , node . Links , bucket , options )
112
112
}
113
113
114
114
log ( `Descending into sub-shard ${ link . Name } for ${ prefix } ${ child . name } ` )
@@ -135,8 +135,8 @@ const updateShard = async (context, positions, child, options) => {
135
135
}
136
136
137
137
const updateShardParent = async ( context , bucket , parent , oldName , newName , size , cid , options ) => {
138
- parent = await DAGNode . rmLink ( parent , oldName )
139
- parent = await DAGNode . addLink ( parent , new DAGLink ( newName , size , cid ) )
138
+ parent . rmLink ( oldName )
139
+ parent . addLink ( new DAGLink ( newName , size , cid ) )
140
140
141
141
return updateHamtDirectory ( context , parent . Links , bucket , options )
142
142
}
0 commit comments