// switchToBasic returns a BasicDirectory implementation of this directory.
switchToBasic returns a BasicDirectory implementation of this directory.
// switchToBasic returns a BasicDirectory implementation of this directory .
func (d *HAMTDirectory) switchToBasic(ctx context.Context) (*BasicDirectory, error) {
	basicDir := newEmptyBasicDirectory(d.dserv)
	basicDir.SetCidBuilder(d.GetCidBuilder())
	err := d.ForEachLink(ctx, func(lnk *ipld.Link) error {
		err := basicDir.addLinkChild(ctx, lnk.Name, lnk)
		if err != nil {
			return err
		}
		return nil
	})
	if err != nil {
		return nil, err
	}
	return basicDir, nil
}
func ( d * HAMTDirectory ) switchToBasic ( ctx context . Context ) ( * BasicDirectory , error ) { basicDir := newEmptyBasicDirectory ( d . dserv ) basicDir . SetCidBuilder ( d . GetCidBuilder ( ) ) err := d . ForEachLink ( ctx , func ( lnk * ipld . Link ) error { err := basicDir . addLinkChild ( ctx , lnk . Name , lnk ) if err != nil { return err } return nil } ) if err != nil { return nil , err } return basicDir , nil }
switchToBasic returns a BasicDirectory implementation of this directory.
switchToBasic returns a BasicDirectory implementation of this directory .
// This function enumerates all the links in the Directory requiring all // shards to be accessible but it is only called *after* sizeBelowThreshold // returns true, which means we have already enumerated and fetched *all* // shards in the first place (that's the only way we can be really sure // we are actually below the threshold).