plan

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPlan

func CheckPlan(plan *Plan, curStep int, running map[string]model.PaxosNodeStatus) bool

CheckPlan checks if current running nodes sticks to the plan.

Types

type Plan

type Plan struct {
	// Nodes observed when the plan is built.
	Nodes []model.PaxosNode `json:"nodes,omitempty"`

	// Steps of the plan.
	Steps []Step `json:"steps,omitempty"`
}

Plan is a sequence of steps that are going to be executed one by one.

func NewPlan

func NewPlan(runningNodes map[string]model.PaxosNodeStatus) Plan

func (*Plan) AppendStep

func (p *Plan) AppendStep(s Step)

func (*Plan) Finish

func (p *Plan) Finish()

type Step

type Step struct {
	// Type of the step.
	Type StepType `json:"type,omitempty"`
	// Original generation of the target.
	// Valid for StepTypeBumpGen, StepTypeUpdate, StepTypeReplace and StepTypeDelete.
	OriginGeneration int64 `json:"origin_generation,omitempty"`
	// Original host of the target.
	// Valid for StepTypeBumpGen, StepTypeUpdate, StepTypeReplace and StepTypeDelete.
	OriginHost string `json:"origin_host,omitempty"`
	// Target generation of the target. Valid for all StepTypeBumpGen, StepTypeUpdate, StepTypeReplace and StepTypeCreate.
	TargetGeneration int64 `json:"target_generation,omitempty"`
	// Target host of the target. If it is empty, it means the host is not specified.
	// Valid for all StepTypeBumpGen, StepTypeUpdate, StepTypeReplace and StepTypeCreate.
	TargetHost string `json:"target_host,omitempty"`
	// Target pod of the step.
	Target string `json:"target,omitempty"`
	// Target role.
	TargetRole string `json:"role,omitempty"`
	// Node set.
	NodeSet string `json:"node_set,omitempty"`
	// Index in node set.
	Index int `json:"index,omitempty"`
	// Volumes that is going to use in the step.
	Volumes []string `json:"volumes,omitempty"`
}

Step is the basic unit of a plan.

func (*Step) Description

func (step *Step) Description() string

func (*Step) Priority

func (step *Step) Priority() int

func (*Step) String

func (step *Step) String() string

type StepType

type StepType string
const (
	StepTypeSnapshot StepType = "Snapshot"
	StepTypeBumpGen  StepType = "BumpGen"
	StepTypeUpdate   StepType = "Update"
	StepTypeReplace  StepType = "Replace"
	StepTypeCreate   StepType = "Create"
	StepTypeDelete   StepType = "Delete"
)

Valid plan node types. The order of the raw values is the order of the node types.

func (StepType) String

func (t StepType) String() string

Implementation of Stringer.

Jump to

Keyboard shortcuts

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