internal

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReplicaRoleName = map[int32]string{
	0: "LEADER",
	1: "FOLLOWER",
	2: "UNKNOWN",
}
View Source
var ReplicaRoleValue = map[string]int32{
	"LEADER":   0,
	"FOLLOWER": 1,
	"UNKNOWN":  2,
}

Functions

This section is empty.

Types

type ReplicaRole

type ReplicaRole int32
const (
	ReplicaRole_LEADER   ReplicaRole = 0
	ReplicaRole_FOLLOWER ReplicaRole = 1
	ReplicaRole_UNKNOWN  ReplicaRole = 2
)

type ReplicaSet

type ReplicaSet []*ReplicaWithRole

func ClusterStatusToReplicaSet

func ClusterStatusToReplicaSet(clusterStatus *types.GetClusterStatusResponse, tlsEnabled bool) (ReplicaSet, error)

ClusterStatusToReplicaSet creates a sorted array of ReplicaWithRole objects, leader first.

func (ReplicaSet) SortByRole

func (r ReplicaSet) SortByRole()

SortByRole sort the replicas such that the leader is first, then followers, then unknown.

func (ReplicaSet) ToConfigReplicaSet

func (r ReplicaSet) ToConfigReplicaSet() []*config.Replica

ToConfigReplicaSet returns an array of config.Replica objects that corresponds the ReplicaSet.

func (ReplicaSet) ToReplicaMap

func (r ReplicaSet) ToReplicaMap() map[string]*url.URL

ToReplicaMap returns map of ID->URL that corresponds the ReplicaSet.

type ReplicaWithRole

type ReplicaWithRole struct {
	Id   string
	URL  *url.URL
	Role ReplicaRole
}

func (*ReplicaWithRole) String

func (r *ReplicaWithRole) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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