func (c *MemStore) RemoveController(name string) error {
	c.mu.Lock()
	defer c.mu.Unlock()

	if err := ValidateControllerName(name); err != nil {
		return err
	}
	names := set.NewStrings(name)
	if namedControllerDetails, ok := c.Controllers[name]; ok {
		for name, details := range c.Controllers {
			if details.ControllerUUID == namedControllerDetails.ControllerUUID {
				names.Add(name)
				if name == c.CurrentControllerName {
					c.CurrentControllerName = ""
				}
			}
		}
	}
	for _, name := range names.Values() {
		delete(c.Models, name)
		delete(c.Accounts, name)
		delete(c.BootstrapConfig, name)
		delete(c.Controllers, name)
		delete(c.CookieJars, name)
	}
	return nil
}
// RemoveController implements ControllerRemover.RemoveController
RemoveController implements ControllerRemover.RemoveController
// RemoveController implements ControllerRemover . RemoveController
func (c *MemStore) RemoveController(name string) error {
	c.mu.Lock()
	defer c.mu.Unlock()
	if err := ValidateControllerName(name); err != nil {
		return err
	}
	names := set.NewStrings(name)
	if namedControllerDetails, ok := c.Controllers[name]; ok {
		for name, details := range c.Controllers {
			if details.ControllerUUID == namedControllerDetails.ControllerUUID {
				names.Add(name)
				if name == c.CurrentControllerName {
					c.CurrentControllerName = ""
				}
			}
		}
	}
	for _, name := range names.Values() {
		delete(c.Models, name)
		delete(c.Accounts, name)
		delete(c.BootstrapConfig, name)
		delete(c.Controllers, name)
		delete(c.CookieJars, name)
	}
	return nil
}
func ( c * MemStore ) RemoveController ( name string ) error { c . mu . Lock ( ) defer c . mu . Unlock ( ) if err := ValidateControllerName ( name ) ; err != nil { return err } names := set . NewStrings ( name ) if namedControllerDetails , ok := c . Controllers [ name ] ; ok { for name , details := range c . Controllers { if details . ControllerUUID == namedControllerDetails . ControllerUUID { names . Add ( name ) if name == c . CurrentControllerName { c . CurrentControllerName = " " } } } } for _ , name := range names . Values ( ) { delete ( c . Models , name ) delete ( c . Accounts , name ) delete ( c . BootstrapConfig , name ) delete ( c . Controllers , name ) delete ( c . CookieJars , name ) } return nil }
RemoveController implements ControllerRemover.RemoveController
RemoveController implements ControllerRemover . RemoveController