// AddChild implements the `Directory` interface.
AddChild implements the `Directory` interface.
// AddChild implements the ` Directory ` interface .
func (d *HAMTDirectory) AddChild(ctx context.Context, name string, nd ipld.Node) error {
	oldChild, err := d.shard.Swap(ctx, name, nd)
	if err != nil {
		return err
	}
	if oldChild != nil {
		d.removeFromSizeChange(oldChild.Name, oldChild.Cid)
	}
	d.addToSizeChange(name, nd.Cid())
	return nil
}
func ( d * HAMTDirectory ) AddChild ( ctx context . Context , name string , nd ipld . Node ) error { oldChild , err := d . shard . Swap ( ctx , name , nd ) if err != nil { return err } if oldChild != nil { d . removeFromSizeChange ( oldChild . Name , oldChild . Cid ) } d . addToSizeChange ( name , nd . Cid ( ) ) return nil }
AddChild implements the `Directory` interface.
AddChild implements the ` Directory ` interface .