clistep

package
v0.0.0-...-9ba49b0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const RunExecute = `To proceed with the upgrade, run "gpupgrade execute".
To return the cluster to its original state, run "gpupgrade revert".`
View Source
const RunFinalize = `To proceed with the upgrade, run "gpupgrade finalize".`
View Source
const RunInitialize = `To begin the upgrade, run "gpupgrade initialize".`
View Source
const RunRevert = `Revert is in progress. Please continue by running "gpupgrade revert".`
View Source
const StepsFileName = "steps.json"

Variables

View Source
var StepErr = errors.New(`gpupgrade commands must be issued in correct order

  1. initialize   runs pre-upgrade checks and prepares the cluster for upgrade
  2. execute      upgrades the master and primary segments to the target
                  Greenplum version
  3. finalize     upgrades the standby master and mirror segments to the target
                  Greenplum version. Revert cannot be run after finalize has started.

Use "gpupgrade --help" for more information`)

Functions

func Prompt

func Prompt(reader *bufio.Reader, prompt string) error

Types

type Step

type Step struct {
	// contains filtered or unexported fields
}

func Begin

func Begin(currentStep idl.Step, verbose bool, nonInteractive bool, confirmationText string) (*Step, error)

func NewStep

func NewStep(currentStep idl.Step, stepName string, stepStore StepStore, substepStore step.SubstepStore, streams step.OutStreams, verbose bool) (*Step, error)

func (*Step) AlwaysRun

func (s *Step) AlwaysRun(substep idl.Substep, f func(streams step.OutStreams) error)

func (*Step) Complete

func (s *Step) Complete(completedText string) error

func (*Step) DisableStore

func (s *Step) DisableStore()

func (*Step) Err

func (s *Step) Err() error

func (*Step) Run

func (s *Step) Run(substep idl.Substep, f func(streams step.OutStreams) error)

func (*Step) RunConditionally

func (s *Step) RunConditionally(substep idl.Substep, shouldRun bool, f func(streams step.OutStreams) error)

func (*Step) RunHubSubstep

func (s *Step) RunHubSubstep(f func(streams step.OutStreams) error)

type StepStore

type StepStore interface {
	Read(idl.Step) (idl.Status, error)
	Write(idl.Step, idl.Status) error
	HasStepStarted(idl.Step) (bool, error)
	HasStepNotStarted(idl.Step) (bool, error)
	HasStepCompleted(idl.Step) (bool, error)
	HasStatus(idl.Step, func(status idl.Status) bool) (bool, error)
}

StepStore tracks the overall step status such as running, failed, or completed for initialize, execute, finalize, and revert. To reduce the code change required and for convenience StepStore uses the same data structure and file store as substeps.json. An internal substep enum STEP_STATUS is used to track the overall step status and should not be used as a normal substep.

type StepStoreFileStore

type StepStoreFileStore struct {
	// contains filtered or unexported fields
}

func NewStepFileStore

func NewStepFileStore() (*StepStoreFileStore, error)

func (*StepStoreFileStore) HasStatus

func (s *StepStoreFileStore) HasStatus(step idl.Step, check func(status idl.Status) bool) (bool, error)

func (*StepStoreFileStore) HasStepCompleted

func (s *StepStoreFileStore) HasStepCompleted(step idl.Step) (bool, error)

func (*StepStoreFileStore) HasStepNotStarted

func (s *StepStoreFileStore) HasStepNotStarted(step idl.Step) (bool, error)

func (*StepStoreFileStore) HasStepStarted

func (s *StepStoreFileStore) HasStepStarted(step idl.Step) (bool, error)

func (*StepStoreFileStore) Read

func (s *StepStoreFileStore) Read(stepName idl.Step) (idl.Status, error)

func (*StepStoreFileStore) ValidateStep

func (s *StepStoreFileStore) ValidateStep(currentStep idl.Step) (err error)

func (*StepStoreFileStore) Write

func (s *StepStoreFileStore) Write(stepName idl.Step, status idl.Status) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL