当前位置: 首页>>代码示例>>Golang>>正文


Golang backend.Backend类代码示例

本文整理汇总了Golang中github.com/deis/deis/deisctl/backend.Backend的典型用法代码示例。如果您正苦于以下问题:Golang Backend类的具体用法?Golang Backend怎么用?Golang Backend使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Backend类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Install

// Install loads the definitions of components from local unit files.
// After Install, the components will be available to Start.
func Install(targets []string, b backend.Backend, cb config.Backend, checkKeys func(config.Backend) error) error {

	// if target is platform, install all services
	if len(targets) == 1 {
		switch targets[0] {
		case PlatformCommand:
			return InstallPlatform(b, cb, checkKeys, false)
		case StatelessPlatformCommand:
			return InstallPlatform(b, cb, checkKeys, true)
		case mesos:
			return InstallMesos(b)
		case swarm:
			return InstallSwarm(b)
		case k8s:
			return InstallK8s(b)
		}
	}
	var wg sync.WaitGroup

	// otherwise create the specific targets
	b.Create(targets, &wg, Stdout, Stderr)
	wg.Wait()

	return nil
}
开发者ID:uniite,项目名称:deis,代码行数:27,代码来源:cmd.go

示例2: Start

// Start activates the specified components.
func Start(argv []string, b backend.Backend) error {
	usage := `Activates the specified components.

Usage:
  deisctl start [<target>...] [options]
`
	// parse command-line arguments
	args, err := docopt.Parse(usage, argv, true, "", false)
	if err != nil {
		return err
	}

	// if target is platform, install all services
	targets := args["<target>"].([]string)

	if len(targets) == 1 && targets[0] == PlatformCommand {
		return StartPlatform(b)
	}

	outchan := make(chan string)
	errchan := make(chan error)
	var wg sync.WaitGroup

	go printState(outchan, errchan, 500*time.Millisecond)

	b.Start(targets, &wg, outchan, errchan)
	wg.Wait()
	close(outchan)

	return nil
}
开发者ID:pombredanne,项目名称:deo,代码行数:32,代码来源:cmd.go

示例3: SSH

// SSH opens an interactive shell on a machine in the cluster
func SSH(target string, b backend.Backend) error {
	if err := b.SSH(target); err != nil {
		return err
	}

	return nil
}
开发者ID:bladealslayer,项目名称:deis,代码行数:8,代码来源:cmd.go

示例4: Stop

// Stop deactivates the specified components.
func Stop(targets []string, b backend.Backend) error {

	// if target is platform, stop all services
	if len(targets) == 1 {
		switch targets[0] {
		case PlatformCommand:
			return StopPlatform(b, false)
		case StatelessPlatformCommand:
			return StopPlatform(b, true)
		case mesos:
			return StopMesos(b)
		case swarm:
			return StopSwarm(b)
		case k8s:
			return StopK8s(b)
		}
	}

	var wg sync.WaitGroup

	b.Stop(targets, &wg, Stdout, Stderr)
	wg.Wait()

	return nil
}
开发者ID:uniite,项目名称:deis,代码行数:26,代码来源:cmd.go

示例5: Uninstall

// Uninstall unloads the definitions of the specified components.
// After Uninstall, the components will be unavailable until Install is called.
func Uninstall(argv []string, b backend.Backend) error {
	usage := `Unloads the definitions of the specified components.

After uninstall, the components will be unavailable until install is called.

Usage:
  deisctl uninstall [<target>...] [options]
`
	// parse command-line arguments
	args, err := docopt.Parse(usage, argv, true, "", false)
	if err != nil {
		return err
	}

	// if target is platform, uninstall all services
	targets := args["<target>"].([]string)
	if len(targets) == 1 && targets[0] == PlatformCommand {
		return UninstallPlatform(b)
	}

	outchan := make(chan string)
	errchan := make(chan error)
	var wg sync.WaitGroup

	go printState(outchan, errchan, 500*time.Millisecond)

	// uninstall the specific target
	b.Destroy(targets, &wg, outchan, errchan)
	wg.Wait()
	close(outchan)

	return nil
}
开发者ID:pombredanne,项目名称:deo,代码行数:35,代码来源:cmd.go

示例6: Start

// Start activates the specified components.
func Start(targets []string, b backend.Backend) error {

	// if target is platform, install all services
	if len(targets) == 1 {
		if targets[0] == PlatformCommand {
			return StartPlatform(b, false)
		} else if targets[0] == StatelessPlatformCommand {
			return StartPlatform(b, true)
		} else if targets[0] == swarm {
			return StartSwarm(b)
		}
	}
	outchan := make(chan string)
	errchan := make(chan error)
	var wg sync.WaitGroup

	go printState(outchan, errchan, 500*time.Millisecond)

	b.Start(targets, &wg, outchan, errchan)
	wg.Wait()
	close(outchan)
	close(errchan)

	return nil
}
开发者ID:bladealslayer,项目名称:deis,代码行数:26,代码来源:cmd.go

示例7: Uninstall

// Uninstall unloads the definitions of the specified components.
// After Uninstall, the components will be unavailable until Install is called.
func Uninstall(targets []string, b backend.Backend) error {
	if len(targets) == 1 {
		if targets[0] == PlatformCommand {
			return UninstallPlatform(b, false)
		} else if targets[0] == StatelessPlatformCommand {
			return UninstallPlatform(b, true)
		} else if targets[0] == swarm {
			return UnInstallSwarm(b)
		}
	}

	outchan := make(chan string)
	errchan := make(chan error)
	var wg sync.WaitGroup

	go printState(outchan, errchan, 500*time.Millisecond)

	// uninstall the specific target
	b.Destroy(targets, &wg, outchan, errchan)
	wg.Wait()
	close(outchan)
	close(errchan)

	return nil
}
开发者ID:bladealslayer,项目名称:deis,代码行数:27,代码来源:cmd.go

示例8: Install

// Install loads the definitions of components from local unit files.
// After Install, the components will be available to Start.
func Install(targets []string, b backend.Backend, checkKeys func() error) error {

	// if target is platform, install all services
	if len(targets) == 1 {
		if targets[0] == PlatformCommand {
			return InstallPlatform(b, checkKeys, false)
		} else if targets[0] == StatelessPlatformCommand {
			return InstallPlatform(b, checkKeys, true)
		} else if targets[0] == swarm {
			return InstallSwarm(b)
		}
	}
	outchan := make(chan string)
	errchan := make(chan error)
	var wg sync.WaitGroup

	go printState(outchan, errchan, 500*time.Millisecond)

	// otherwise create the specific targets
	b.Create(targets, &wg, outchan, errchan)
	wg.Wait()

	close(outchan)
	close(errchan)
	return nil
}
开发者ID:bladealslayer,项目名称:deis,代码行数:28,代码来源:cmd.go

示例9: doUpgradeTakeOver

func doUpgradeTakeOver(stateless bool, b backend.Backend, cb config.Backend) error {
	var wg sync.WaitGroup

	nodes, err := listPublishedServices(cb)
	if err != nil {
		return err
	}

	b.Stop([]string{"publisher"}, &wg, Stdout, Stderr)
	wg.Wait()
	b.Destroy([]string{"publisher"}, &wg, Stdout, Stderr)
	wg.Wait()

	if err := republishServices(1800, nodes, cb); err != nil {
		return err
	}

	b.RollingRestart("router", &wg, Stdout, Stderr)
	wg.Wait()
	b.Create([]string{"publisher"}, &wg, Stdout, Stderr)
	wg.Wait()
	b.Start([]string{"publisher"}, &wg, Stdout, Stderr)
	wg.Wait()

	installUpgradeServices(b, stateless, &wg, Stdout, Stderr)
	wg.Wait()

	startUpgradeServices(b, stateless, &wg, Stdout, Stderr)
	wg.Wait()
	return nil
}
开发者ID:CodeJuan,项目名称:deis,代码行数:31,代码来源:upgrade.go

示例10: SSH

// SSH opens an interactive shell on a machine in the cluster
func SSH(target string, cmd []string, b backend.Backend) error {

	if len(cmd) > 0 {
		return b.SSHExec(target, strings.Join(cmd, " "))
	}

	return b.SSH(target)
}
开发者ID:uniite,项目名称:deis,代码行数:9,代码来源:cmd.go

示例11: RollingRestart

// RollingRestart restart instance unit in a rolling manner
func RollingRestart(target string, b backend.Backend) error {
	var wg sync.WaitGroup

	b.RollingRestart(target, &wg, Stdout, Stderr)
	wg.Wait()

	return nil
}
开发者ID:uniite,项目名称:deis,代码行数:9,代码来源:cmd.go

示例12: UnInstallSwarm

//UnInstallSwarm uninstall Swarm
func UnInstallSwarm(b backend.Backend) error {
	var wg sync.WaitGroup
	io.WriteString(Stdout, prettyprint.DeisIfy("Destroying Swarm..."))
	fmt.Fprintln(Stdout, "swarm nodes and swarm manager...")
	b.Destroy([]string{"swarm-node", "swarm-manager"}, &wg, Stdout, Stderr)
	wg.Wait()
	fmt.Fprintln(Stdout, "Done.\n ")
	return nil
}
开发者ID:Kazanz,项目名称:deis,代码行数:10,代码来源:swarm.go

示例13: Journal

// Journal prints log output for the specified components.
func Journal(targets []string, b backend.Backend) error {

	for _, target := range targets {
		if err := b.Journal(target); err != nil {
			return err
		}
	}
	return nil
}
开发者ID:uniite,项目名称:deis,代码行数:10,代码来源:cmd.go

示例14: InstallSwarm

//InstallSwarm Installs swarm
func InstallSwarm(b backend.Backend) error {
	var wg sync.WaitGroup
	io.WriteString(Stdout, prettyprint.DeisIfy("Installing Swarm..."))
	fmt.Fprintln(Stdout, "Swarm node and Swarm Manager...")
	b.Create([]string{"swarm-node", "swarm-manager"}, &wg, Stdout, Stderr)
	wg.Wait()
	fmt.Fprintln(Stdout, "Done.\n ")
	fmt.Fprintln(Stdout, "Please run `deisctl start swarm` to start swarm.")
	return nil
}
开发者ID:Kazanz,项目名称:deis,代码行数:11,代码来源:swarm.go

示例15: Dock

// Dock connects to the appropriate host and runs 'docker exec -it'.
func Dock(target string, cmd []string, b backend.Backend) error {

	c := "sh"
	if len(cmd) > 0 {
		c = strings.Join(cmd, " ")
	}

	execit := fmt.Sprintf("docker exec -it %s %s", target, c)

	return b.SSHExec(target, execit)
}
开发者ID:uniite,项目名称:deis,代码行数:12,代码来源:cmd.go


注:本文中的github.com/deis/deis/deisctl/backend.Backend类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。