// RemoveChild implements the `Directory` interface. Used in the case where we wrap
// a HAMTDirectory that might need to be downgraded to a BasicDirectory. The
// upgrade path is in AddChild.
RemoveChild implements the `Directory` interface. Used in the case where we wrap
a HAMTDirectory that might need to be downgraded to a BasicDirectory. The
upgrade path is in AddChild.
// RemoveChild implements the ` Directory ` interface . Used in the case where we wrap // a HAMTDirectory that might need to be downgraded to a BasicDirectory . The // upgrade path is in AddChild .
func (d *DynamicDirectory) RemoveChild(ctx context.Context, name string) error {
	hamtDir, ok := d.Directory.(*HAMTDirectory)
	if !ok {
		return d.Directory.RemoveChild(ctx, name)
	}
	switchToBasic, err := hamtDir.needsToSwitchToBasicDir(ctx, name, nil)
	if err != nil {
		return err
	}
	if !switchToBasic {
		return hamtDir.RemoveChild(ctx, name)
	}
	basicDir, err := hamtDir.switchToBasic(ctx)
	if err != nil {
		return err
	}
	basicDir.RemoveChild(ctx, name)
	if err != nil {
		return err
	}
	d.Directory = basicDir
	return nil
}
func ( d * DynamicDirectory ) RemoveChild ( ctx context . Context , name string ) error { hamtDir , ok := d . Directory . ( * HAMTDirectory ) if ! ok { return d . Directory . RemoveChild ( ctx , name ) } switchToBasic , err := hamtDir . needsToSwitchToBasicDir ( ctx , name , nil ) if err != nil { return err } if ! switchToBasic { return hamtDir . RemoveChild ( ctx , name ) } basicDir , err := hamtDir . switchToBasic ( ctx ) if err != nil { return err } basicDir . RemoveChild ( ctx , name ) if err != nil { return err } d . Directory = basicDir return nil }
RemoveChild implements the `Directory` interface.
RemoveChild implements the ` Directory ` interface .