// addLinkChild adds the link as an entry to this directory under the given
// name. Plumbing function for the AddChild API.
addLinkChild adds the link as an entry to this directory under the given
name. Plumbing function for the AddChild API.
// addLinkChild adds the link as an entry to this directory under the given // name . Plumbing function for the AddChild API .
func (d *BasicDirectory) addLinkChild(ctx context.Context, name string, link *ipld.Link) error {
	err := d.RemoveChild(ctx, name)
	if err != nil && err != os.ErrNotExist {
		return err
	}
	err = d.node.AddRawLink(name, link)
	if err != nil {
		return err
	}
	d.addToEstimatedSize(name, link.Cid)
	return nil
}
func ( d * BasicDirectory ) addLinkChild ( ctx context . Context , name string , link * ipld . Link ) error { err := d . RemoveChild ( ctx , name ) if err != nil && err != os . ErrNotExist { return err } err = d . node . AddRawLink ( name , link ) if err != nil { return err } d . addToEstimatedSize ( name , link . Cid ) return nil }
addLinkChild adds the link as an entry to this directory under the given
name.
addLinkChild adds the link as an entry to this directory under the given name .
// Remove old link and account for size change (if it existed; ignore // `ErrNotExist` otherwise).