本文整理汇总了Golang中github.com/deis/deis/deisctl/backend.Backend类的典型用法代码示例。如果您正苦于以下问题:Golang Backend类的具体用法?Golang Backend怎么用?Golang Backend使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Backend类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: ListUnits
// ListUnits prints a list of installed units.
func ListUnits(argv []string, b backend.Backend) error {
usage := `Prints a list of installed units.
Usage:
deisctl list [options]
`
// parse command-line arguments
if _, err := docopt.Parse(usage, argv, true, "", false); err != nil {
return err
}
return b.ListUnits()
}
开发者ID:pombredanne,项目名称:deo,代码行数:13,代码来源:cmd.go
示例17: uninstallMesosServices
func uninstallMesosServices(b backend.Backend, wg *sync.WaitGroup, out, err io.Writer) error {
fmt.Fprintln(out, "Mesos/Marathon data plane...")
b.Destroy([]string{"mesos-slave"}, wg, out, err)
wg.Wait()
fmt.Fprintln(out, "Mesos/Marathon control plane...")
b.Destroy([]string{"mesos-marathon", "mesos-master", "zookeeper"}, wg, out, err)
wg.Wait()
return nil
}
开发者ID:ngpestelos,项目名称:deis,代码行数:12,代码来源:mesos.go
示例18: UnInstallSwarm
//UnInstallSwarm uninstall Swarm
func UnInstallSwarm(b backend.Backend) error {
var wg sync.WaitGroup
io.WriteString(Stdout, prettyprint.DeisIfy("Uninstalling Swarm..."))
fmt.Fprintln(Stdout, "Swarm data plane...")
b.Destroy([]string{"swarm-node"}, &wg, Stdout, Stderr)
wg.Wait()
fmt.Fprintln(Stdout, "Swarm control plane...")
b.Destroy([]string{"swarm-manager"}, &wg, Stdout, Stderr)
wg.Wait()
fmt.Fprintln(Stdout, "Done.\n ")
return nil
}
开发者ID:ngpestelos,项目名称:deis,代码行数:13,代码来源:swarm.go
示例19: StartSwarm
//StartSwarm starts Swarm Schduler
func StartSwarm(b backend.Backend) error {
var wg sync.WaitGroup
io.WriteString(Stdout, prettyprint.DeisIfy("Starting Swarm..."))
fmt.Fprintln(Stdout, "Swarm control plane...")
b.Start([]string{"swarm-manager"}, &wg, Stdout, Stderr)
wg.Wait()
fmt.Fprintln(Stdout, "Swarm data plane...")
b.Start([]string{"swarm-node"}, &wg, Stdout, Stderr)
wg.Wait()
fmt.Fprintln(Stdout, "Done.\n ")
fmt.Fprintln(Stdout, "Please run `deisctl config controller set schedulerModule=swarm` to use the swarm scheduler.")
return nil
}
开发者ID:ngpestelos,项目名称:deis,代码行数:14,代码来源:swarm.go
示例20: UnInstallSwarm
//UnInstallSwarm uninstall Swarm
func UnInstallSwarm(b backend.Backend) error {
outchan := make(chan string)
errchan := make(chan error)
defer close(outchan)
defer close(errchan)
var wg sync.WaitGroup
go printState(outchan, errchan, 500*time.Millisecond)
outchan <- utils.DeisIfy("Destroying Swarm...")
outchan <- fmt.Sprintf("swarm nodes and swarm manager...")
b.Destroy([]string{"swarm-node", "swarm-manager"}, &wg, outchan, errchan)
wg.Wait()
fmt.Println("Done.")
fmt.Println()
return nil
}
开发者ID:gpxl,项目名称:deis,代码行数:16,代码来源:swarm.go
注:本文中的github.com/deis/deis/deisctl/backend.Backend类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论