Documentation ¶
Overview ¶
Copyright © 2020 Marvin
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- type BackupComponent
- type Builder
- func (b *Builder) BackupComponent(component, action, fromVer string, host, deployDir string) *Builder
- func (b *Builder) Build() Task
- func (b *Builder) BuildAsStep(prefix string) *StepDisplay
- func (b *Builder) ClusterSSH(topo *cluster.Topology, deployUser string, sshTimeout, exeTimeout uint64, ...) *Builder
- func (b *Builder) CopyComponent(component, os, arch string, version string, srcPath, dstHost, dstDir string) *Builder
- func (b *Builder) EnvInit(os, host, deployUser string, userGroup string, skipCreateUser bool, sudo bool) *Builder
- func (b *Builder) Func(name string, fn func(ctx context.Context) error) *Builder
- func (b *Builder) InitConfig(clusterName string, inst cluster.Instance, deployUser string, cacheDir string) *Builder
- func (b *Builder) InstallPackage(srcPath, dstHost, dstDir string) *Builder
- func (b *Builder) Mkdir(user, host string, sudo bool, dirs ...string) *Builder
- func (b *Builder) Parallel(ignoreError bool, tasks ...Task) *Builder
- func (b *Builder) ParallelStep(prefix string, ignoreError bool, tasks ...*StepDisplay) *Builder
- func (b *Builder) RootSSH(host string, port int, user, password, keyFile, passphrase string, ...) *Builder
- func (b *Builder) SSHKeyGen(keypath string) *Builder
- func (b *Builder) SSHKeySet(privKeyPath, pubKeyPath string) *Builder
- func (b *Builder) ScaleConfig(clusterName string, topo *cluster.Topology, inst cluster.Instance, ...) *Builder
- func (b *Builder) Serial(tasks ...Task) *Builder
- func (b *Builder) Shell(host, command, cmdID string, sudo bool) *Builder
- func (b *Builder) Step(prefix string, inner Task, logger *printer.Logger) *Builder
- func (b *Builder) UpdateMetadata(clusterName, basePath string, metadata cluster.IMetadata, ...) *Builder
- func (b *Builder) UserSSH(host string, port int, deployUser string, sshTimeout, exeTimeout uint64, ...) *Builder
- type CopyComponent
- type EnvInit
- type Func
- type InitConfig
- type InstallPackage
- type Mkdir
- type Parallel
- type ParallelStepDisplay
- type RootSSH
- type SSHKeyGen
- type SSHKeySet
- type ScaleConfig
- type Serial
- type Shell
- type StepDisplay
- type Task
- type UpdateMetadata
- type UserSSH
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnsupportedRollback indicated that the task does not support rollback ErrUnsupportedRollback = errors.New("unsupported rollback") // ErrNoExecutor indicated that the task does not get ssh executor ErrNoExecutor = errors.New("no executor") // ErrNoOutput indicated that the task does not get outputs ErrNoOutput = errors.New("no outputs available") )
var (
// ErrEnvInitFailed is ErrEnvInitFailed
ErrEnvInitFailed = errNSEnvInit.NewType("failed")
)
Functions ¶
This section is empty.
Types ¶
type BackupComponent ¶
type BackupComponent struct {
// contains filtered or unexported fields
}
BackupComponent is used to copy all files related the specific version a component to the target directory of path
func (*BackupComponent) Execute ¶
func (c *BackupComponent) Execute(ctx context.Context) error
Execute implements the Task interface
func (*BackupComponent) Rollback ¶
func (c *BackupComponent) Rollback(ctx context.Context) error
Rollback implements the Task interface
func (*BackupComponent) String ¶
func (c *BackupComponent) String() string
String implements the fmt.Stringer interface
type Builder ¶
func NewBuilder ¶
func NewSimpleUerSSH ¶
func NewSimpleUerSSH(logger *printer.Logger, host string, port int, user string, gOpt *operator.Options, p *operator.SSHConnectionProps, sshType executor.SSHType) *Builder
NewSimpleUerSSH append a UserSSH task to the current task collection with operator.Options and SSHConnectionProps
func (*Builder) BackupComponent ¶
func (b *Builder) BackupComponent(component, action, fromVer string, host, deployDir string) *Builder
BackupComponent appends a BackupComponent task to the current task collection
func (*Builder) BuildAsStep ¶
func (b *Builder) BuildAsStep(prefix string) *StepDisplay
BuildAsStep returns a task that is wrapped by a StepDisplay. The task will print single line progress.
func (*Builder) ClusterSSH ¶
func (b *Builder) ClusterSSH( topo *cluster.Topology, deployUser string, sshTimeout, exeTimeout uint64, proxyHost string, proxyPort int, proxyUser, proxyPassword, proxyKeyFile, proxyPassphrase string, proxySSHTimeout uint64, sshType, defaultSSHType executor.SSHType, ) *Builder
ClusterSSH init all UserSSH need for the cluster.
func (*Builder) CopyComponent ¶
func (b *Builder) CopyComponent(component, os, arch string, version string, srcPath, dstHost, dstDir string, ) *Builder
CopyComponent appends a CopyComponent task to the current task collection
func (*Builder) EnvInit ¶
func (b *Builder) EnvInit(os, host, deployUser string, userGroup string, skipCreateUser bool, sudo bool) *Builder
EnvInit appends a EnvInit task to the current task collection
func (*Builder) InitConfig ¶
func (b *Builder) InitConfig(clusterName string, inst cluster.Instance, deployUser string, cacheDir string) *Builder
InitConfig appends a CopyComponent task to the current task collection
func (*Builder) InstallPackage ¶
InstallPackage appends a InstallPackage task to the current task collection
func (*Builder) ParallelStep ¶
func (b *Builder) ParallelStep(prefix string, ignoreError bool, tasks ...*StepDisplay) *Builder
ParallelStep appends a new ParallelStepDisplay task, which will print multi line progress in parallel for inner tasks. Inner tasks must be a StepDisplay task.
func (*Builder) RootSSH ¶
func (b *Builder) RootSSH( host string, port int, user, password, keyFile, passphrase string, sshTimeout, exeTimeout uint64, proxyHost string, proxyPort int, proxyUser, proxyPassword, proxyKeyFile, proxyPassphrase string, proxySSHTimeout uint64, globalSshType, defaultSSHType executor.SSHType, sudo bool, ) *Builder
RootSSH appends a RootSSH task to the current task collection
func (*Builder) ScaleConfig ¶
func (b *Builder) ScaleConfig(clusterName string, topo *cluster.Topology, inst cluster.Instance, deployUser string, cacheDir string) *Builder
ScaleConfig generate temporary config on scaling
func (*Builder) Step ¶
Step appends a new StepDisplay task, which will print single line progress for inner tasks.
func (*Builder) UpdateMetadata ¶
func (b *Builder) UpdateMetadata(clusterName, basePath string, metadata cluster.IMetadata, deletedNodesID []string) *Builder
UpdateMetadata appends a UpdateMetadata task to the current task collection
func (*Builder) UserSSH ¶
func (b *Builder) UserSSH( host string, port int, deployUser string, sshTimeout, exeTimeout uint64, proxyHost string, proxyPort int, proxyUser, proxyPassword, proxyKeyFile, proxyPassphrase string, proxySSHTimeout uint64, sshType, defaultSSHType executor.SSHType, ) *Builder
UserSSH append a UserSSH task to the current task collection
type CopyComponent ¶
type CopyComponent struct {
// contains filtered or unexported fields
}
CopyComponent is used to copy all files related the specific version a component to the target directory of path
func (*CopyComponent) Execute ¶
func (c *CopyComponent) Execute(ctx context.Context) error
Execute implements the Task interface
func (*CopyComponent) Rollback ¶
func (c *CopyComponent) Rollback(ctx context.Context) error
Rollback implements the Task interface
func (*CopyComponent) String ¶
func (c *CopyComponent) String() string
String implements the fmt.Stringer interface
type EnvInit ¶
type EnvInit struct {
// contains filtered or unexported fields
}
EnvInit is used to initialize the remote environment, e.g: 1. Generate SSH key 2. ssh-copy-id
type Func ¶
type Func struct {
// contains filtered or unexported fields
}
Func wrap a closure.
type InitConfig ¶
type InitConfig struct {
// contains filtered or unexported fields
}
InitConfig is used to copy all configurations to the target directory of path
func (*InitConfig) Execute ¶
func (c *InitConfig) Execute(ctx context.Context) error
Execute implements the Task interface
func (*InitConfig) Rollback ¶
func (c *InitConfig) Rollback(ctx context.Context) error
Rollback implements the Task interface
func (*InitConfig) String ¶
func (c *InitConfig) String() string
String implements the fmt.Stringer interface
type InstallPackage ¶
type InstallPackage struct {
// contains filtered or unexported fields
}
InstallPackage is used to copy all files related the specific version a component to the target directory of path
func (*InstallPackage) Execute ¶
func (c *InstallPackage) Execute(ctx context.Context) error
Execute implements the Task interface
func (*InstallPackage) Rollback ¶
func (c *InstallPackage) Rollback(ctx context.Context) error
Rollback implements the Task interface
func (*InstallPackage) String ¶
func (c *InstallPackage) String() string
String implements the fmt.Stringer interface
type Mkdir ¶
type Mkdir struct {
// contains filtered or unexported fields
}
Mkdir is used to create directory on the target host
type Parallel ¶
type Parallel struct {
// contains filtered or unexported fields
}
Parallel A set of tasks will be executed in parallel
type ParallelStepDisplay ¶
type ParallelStepDisplay struct { Logger *printer.Logger // contains filtered or unexported fields }
ParallelStepDisplay is a task that will display multiple progress bars in parallel for inner tasks. Inner tasks will be executed in parallel.
func (*ParallelStepDisplay) Execute ¶
func (ps *ParallelStepDisplay) Execute(ctx context.Context) error
Execute implements the Task interface
func (*ParallelStepDisplay) Rollback ¶
func (ps *ParallelStepDisplay) Rollback(ctx context.Context) error
Rollback implements the Task interface
func (*ParallelStepDisplay) SetLogger ¶
func (ps *ParallelStepDisplay) SetLogger(logger *printer.Logger) *ParallelStepDisplay
SetLogger set the logger of step
func (*ParallelStepDisplay) String ¶
func (ps *ParallelStepDisplay) String() string
String implements the fmt.Stringer interface
type RootSSH ¶
type RootSSH struct {
// contains filtered or unexported fields
}
RootSSH is used to establish a SSH connection to the target host with specific key
type SSHKeyGen ¶
type SSHKeyGen struct {
// contains filtered or unexported fields
}
SSHKeyGen is used to generate SSH key
type SSHKeySet ¶
type SSHKeySet struct {
// contains filtered or unexported fields
}
SSHKeySet is used to set the Context private/public key path
type ScaleConfig ¶
type ScaleConfig struct {
// contains filtered or unexported fields
}
ScaleConfig is used to copy all configurations to the target directory of path
func (*ScaleConfig) Execute ¶
func (c *ScaleConfig) Execute(ctx context.Context) error
Execute implements the Task interface
func (*ScaleConfig) Rollback ¶
func (c *ScaleConfig) Rollback(ctx context.Context) error
Rollback implements the Task interface
func (*ScaleConfig) String ¶
func (c *ScaleConfig) String() string
String implements the fmt.Stringer interface
type Serial ¶
type Serial struct {
// contains filtered or unexported fields
}
Serial A set of tasks will be executed in a serialized manner
type Shell ¶
type Shell struct {
// contains filtered or unexported fields
}
Shell is used to create directory on the target host
type StepDisplay ¶
StepDisplay is a task that will display a progress bar for inner task.
func (*StepDisplay) Execute ¶
func (s *StepDisplay) Execute(ctx context.Context) error
Execute implements the Task interface
func (*StepDisplay) Rollback ¶
func (s *StepDisplay) Rollback(ctx context.Context) error
Rollback implements the Task interface
func (*StepDisplay) SetHidden ¶
func (s *StepDisplay) SetHidden(h bool) *StepDisplay
SetHidden set step hidden or not.
func (*StepDisplay) SetLogger ¶
func (s *StepDisplay) SetLogger(logger *printer.Logger) *StepDisplay
SetLogger set the logger of step
func (*StepDisplay) String ¶
func (s *StepDisplay) String() string
String implements the fmt.Stringer interface
type UpdateMetadata ¶
type UpdateMetadata struct {
// contains filtered or unexported fields
}
UpdateMetadata is used to maintain the DBMS meta information
func NewUpdateMetadata ¶
func NewUpdateMetadata(cluster string, basePath string, metadata cluster.IMetadata, deletedNodesID []string) *UpdateMetadata
NewUpdateMetadata create i update dbms meta task.
func (*UpdateMetadata) Execute ¶
func (u *UpdateMetadata) Execute(ctx context.Context) error
Execute implements the Task interface the metadata especially the topology is in wide use, the other callers point to this field by a pointer, so we should update the original topology directly, and don't make a copy
func (*UpdateMetadata) Path ¶
func (u *UpdateMetadata) Path(subpath ...string) string
func (*UpdateMetadata) Rollback ¶
func (u *UpdateMetadata) Rollback(ctx context.Context) error
Rollback implements the Task interface
func (*UpdateMetadata) String ¶
func (u *UpdateMetadata) String() string
String implements the fmt.Stringer interface