func (c *MemStore) UpdateController(name string, one ControllerDetails) error {
	c.mu.Lock()
	defer c.mu.Unlock()

	if err := ValidateControllerName(name); err != nil {
		return err
	}
	if err := ValidateControllerDetails(one); err != nil {
		return err
	}

	if len(c.Controllers) == 0 {
		return errors.NotFoundf("controllers")
	}

	for k, v := range c.Controllers {
		if v.ControllerUUID == one.ControllerUUID && k != name {
			return errors.AlreadyExistsf("controller %s with UUID %s",
				k, v.ControllerUUID)
		}
	}

	if _, ok := c.Controllers[name]; !ok {
		return errors.NotFoundf("controller %s", name)
	}

	c.Controllers[name] = one
	return nil
}
// UpdateController implements ControllerUpdater.UpdateController
UpdateController implements ControllerUpdater.UpdateController
// UpdateController implements ControllerUpdater . UpdateController
func (c *MemStore) UpdateController(name string, one ControllerDetails) error {
	c.mu.Lock()
	defer c.mu.Unlock()
	if err := ValidateControllerName(name); err != nil {
		return err
	}
	if err := ValidateControllerDetails(one); err != nil {
		return err
	}
	if len(c.Controllers) == 0 {
		return errors.NotFoundf("controllers")
	}
	for k, v := range c.Controllers {
		if v.ControllerUUID == one.ControllerUUID && k != name {
			return errors.AlreadyExistsf("controller %s with UUID %s",
				k, v.ControllerUUID)
		}
	}
	if _, ok := c.Controllers[name]; !ok {
		return errors.NotFoundf("controller %s", name)
	}
	c.Controllers[name] = one
	return nil
}
func ( c * MemStore ) UpdateController ( name string , one ControllerDetails ) error { c . mu . Lock ( ) defer c . mu . Unlock ( ) if err := ValidateControllerName ( name ) ; err != nil { return err } if err := ValidateControllerDetails ( one ) ; err != nil { return err } if len ( c . Controllers ) == 0 { return errors . NotFoundf ( " " ) } for k , v := range c . Controllers { if v . ControllerUUID == one . ControllerUUID && k != name { return errors . AlreadyExistsf ( " " , k , v . ControllerUUID ) } } if _ , ok := c . Controllers [ name ] ; ! ok { return errors . NotFoundf ( " " , name ) } c . Controllers [ name ] = one return nil }
UpdateController implements ControllerUpdater.UpdateController
UpdateController implements ControllerUpdater . UpdateController