check

package
v1.16.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatResults

func FormatResults(results TopicCheckResults) string

FormatResults generates a pretty table from topic check results.

Types

type CheckConfig

type CheckConfig struct {
	AdminClient   admin.Client
	ClusterConfig config.ClusterConfig
	CheckLeaders  bool
	NumRacks      int
	TopicConfig   config.TopicConfig
	ValidateOnly  bool
}

CheckConfig contains all of the context necessary to check a single topic config.

type CheckName

type CheckName string

CheckName is a string name for a topic check.

const (
	// All possible CheckName values.
	CheckNameConfigsConsistent        CheckName = "configs consistent"
	CheckNameConfigCorrect            CheckName = "config correct"
	CheckNameConfigSettingsCorrect    CheckName = "config settings correct"
	CheckNameLeadersCorrect           CheckName = "leaders correct"
	CheckNamePartitionCountCorrect    CheckName = "partition count correct"
	CheckNameReplicasInSync           CheckName = "replicas in-sync"
	CheckNameReplicationFactorCorrect CheckName = "replication factor correct"
	CheckNameThrottlesClear           CheckName = "throttles clear"
	CheckNameTopicExists              CheckName = "topic exists"
)

type TopicCheckResult

type TopicCheckResult struct {
	Name        CheckName
	OK          bool
	Description string
}

TopicCheckResult contains the name and status of a single check.

type TopicCheckResults

type TopicCheckResults struct {
	Results []TopicCheckResult
}

TopicCheckResults stores the result of checking a single topic.

func CheckTopic

func CheckTopic(ctx context.Context, config CheckConfig) (TopicCheckResults, error)

CheckTopic runs the topic check and returns a result. If there's a non-topic-specific error (e.g., cluster zk isn't reachable), then an error is returned.

func (*TopicCheckResults) AllOK

func (r *TopicCheckResults) AllOK() bool

AllOK returns true if all subresults are OK, otherwise it returns false.

func (*TopicCheckResults) AppendResult

func (r *TopicCheckResults) AppendResult(result TopicCheckResult)

AppendResult adds a new check result to the results.

func (*TopicCheckResults) UpdateLastResult

func (r *TopicCheckResults) UpdateLastResult(ok bool, description string)

UpdateLastResult updates the details of the most recently added result.

Jump to

Keyboard shortcuts

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