func placeContainers(view db.Database) { constraints := view.SelectFromPlacement(nil) containers := view.SelectFromContainer(nil) minions := view.SelectFromMinion(nil) ctx := makeContext(minions, constraints, containers) cleanupPlacements(ctx) placeUnassigned(ctx) for _, change := range ctx.changed { view.Commit(*change) } }