func Start(b backend.Backend, targets []string) error { // if target is platform, start all services if len(targets) == 1 && targets[0] == PlatformInstallCommand { return StartPlatform(b) } return b.Start(targets) }
func startDataContainers(b backend.Backend) error { fmt.Println("Launching data containers...") if err := b.Start(DefaultDataContainers); err != nil { return err } fmt.Println("Data containers launched.") return nil }
func Uninstall(b backend.Backend, targets []string) error { // if target is platform, uninstall all services if len(targets) == 1 && targets[0] == PlatformInstallCommand { return uninstallAllServices(b) } // uninstall the specific target return b.Destroy(targets) }
func installDataContainers(b backend.Backend) error { fmt.Println("Scheduling data containers...") if err := b.Create(DefaultDataContainers); err != nil { return err } fmt.Println("Data containers scheduled.") return nil }
func Journal(b backend.Backend, targets []string) error { for _, target := range targets { if err := b.Journal(target); err != nil { return err } } return nil }
func Status(b backend.Backend, targets []string) error { for _, target := range targets { if err := b.Status(target); err != nil { return err } } return nil }
func Install(b backend.Backend, targets []string) error { // if target is platform, install all services if len(targets) == 1 && targets[0] == PlatformInstallCommand { return InstallPlatform(b) } // otherwise create the specific targets for i, target := range targets { // if we're installing a component without a number attached, // consider the user doesn't know better if !strings.Contains(target, "@") { targets[i] += "@1" } } return b.Create(targets) }
func Scale(b backend.Backend, targets []string) error { for _, target := range targets { component, num, err := splitScaleTarget(target) if err != nil { return err } // the router is the only component that can scale past 1 at the moment if num > 1 && !strings.Contains(component, "router") { return fmt.Errorf("cannot scale %s past 1", component) } if err := b.Scale(component, num); err != nil { return err } } return nil }
func ListUnitFiles(b backend.Backend) error { err := b.ListUnitFiles() return err }
func Restart(b backend.Backend, targets []string) error { if err := b.Stop(targets); err != nil { return err } return b.Start(targets) }