Пример #1
0
func (p SimplePlacement) Assign(added InstanceRefs, containers Containers) error {
	locators := cmd.Locators(p)
	pos := 0
	for i := range added {
		instance := added[i]
		if len(locators) > 0 {
			host, _ := cmd.NewHostLocator(locators[pos%len(locators)].HostIdentity())
			instance.On = host
			pos++
		} else {
			instance.MarkRemoved()
		}
	}
	return nil
}
Пример #2
0
func (p SimplePlacement) RemoveFromLocation(on cmd.Locator) bool {
	return !cmd.Locators(p).Has(on)
}