topovalidator

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package topovalidator contains a workflow that validates the topology data. It is meant to detect and propose fixes for topology problems. Ideally, the topology should always be consistent. However, with tasks dying or network problems, there is a risk some bad data is left in the topology. Most data problems should be self-healing, so it is important to only add new validations steps only for corner cases that would be too costly or time-consuming to address in the first place.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register()

Register needs to be called to register the topovalidator factory.

func RegisterKeyspaceValidator

func RegisterKeyspaceValidator()

RegisterKeyspaceValidator registers the Keyspace Validator.

func RegisterShardValidator

func RegisterShardValidator()

RegisterShardValidator registers the Shard Validator.

func RegisterUITestValidator

func RegisterUITestValidator()

RegisterUITestValidator registers the UITest Validator.

func RegisterValidator

func RegisterValidator(name string, v Validator)

RegisterValidator adds a Validator to our list. Typically called at init() time.

Types

type Fixer

type Fixer interface {
	Action(ctx context.Context, name string) error
}

Fixer is the interface to implement to register a job capable of fixing something in the topology. It is given the action that the user chose.

type KeyspaceFixer

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

KeyspaceFixer implements Fixer.

func (*KeyspaceFixer) Action

func (kf *KeyspaceFixer) Action(ctx context.Context, name string) error

Action is part of the Fixer interface.

type KeyspaceValidator

type KeyspaceValidator struct{}

KeyspaceValidator implements Validator.

func (*KeyspaceValidator) Audit

func (kv *KeyspaceValidator) Audit(ctx context.Context, ts *topo.Server, w *Workflow) error

Audit is part of the Validator interface.

type ShardFixer

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

ShardFixer implements Fixer.

func (*ShardFixer) Action

func (sf *ShardFixer) Action(ctx context.Context, name string) error

Action is part of the Fixer interface.

type ShardValidator

type ShardValidator struct{}

ShardValidator implements Validator.

func (*ShardValidator) Audit

func (kv *ShardValidator) Audit(ctx context.Context, ts *topo.Server, w *Workflow) error

Audit is part of the Validator interface.

type UITestFixer

type UITestFixer struct{}

UITestFixer implements Fixer.

func (*UITestFixer) Action

func (kf *UITestFixer) Action(ctx context.Context, name string) error

Action is part of the Fixer interface.

type UITestValidator

type UITestValidator struct{}

UITestValidator implements Validator.

func (*UITestValidator) Audit

func (kv *UITestValidator) Audit(ctx context.Context, ts *topo.Server, w *Workflow) error

Audit is part of the Validator interface.

type Validator

type Validator interface {
	// Audit is called by the Workflow. It can add Fixer objects to the Workflow.
	Audit(ctx context.Context, ts *topo.Server, w *Workflow) error
}

Validator is an individual process that validates an aspect of the topology. Typically, it looks for something wrong, and if it finds anything, it registers a Fixer in the workflow.

type Workflow

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

Workflow is the workflow that runs the validation. It implements workflow.Workflow.

func (*Workflow) AddFixer

func (w *Workflow) AddFixer(name, message string, fixer Fixer, actions []string)

AddFixer adds a Fixer to the Workflow. It will end up displaying a sub-task for the user to act on. When the user presses one action, the Fixer.Action() callback will be called.

func (*Workflow) Run

func (w *Workflow) Run(ctx context.Context, manager *workflow.Manager, wi *topo.WorkflowInfo) error

Run is part of the workflow.Workflow interface.

type WorkflowFactory

type WorkflowFactory struct{}

WorkflowFactory is the factory to register the topo validator workflow.

func (*WorkflowFactory) Init

Init is part of the workflow.Factory interface.

func (*WorkflowFactory) Instantiate

func (f *WorkflowFactory) Instantiate(_ *workflow.Manager, w *workflowpb.Workflow, rootNode *workflow.Node) (workflow.Workflow, error)

Instantiate is part of the workflow.Factory interface.

Jump to

Keyboard shortcuts

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