ranklist

package
v0.0.0-...-e139d7d Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: BSD-2-Clause-Patent Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RanksToUint32

func RanksToUint32(in []Rank) []uint32

RanksToUint32 is a convenience method to convert a slice of system ranks to a slice of uint32s.

Types

type Rank

type Rank uint32

Rank is used to uniquely identify a server within a cluster.

const (
	// MaxRank is the largest valid Rank value.
	MaxRank Rank = math.MaxUint32 - 1
	// NilRank is an undefined Rank (0 is a valid Rank).
	NilRank Rank = math.MaxUint32
)

func CheckRankMembership

func CheckRankMembership(members, toTest []Rank) (missing []Rank)

CheckRankMembership compares two Rank slices and returns a Rank slice with any ranks found in the second slice that do not exist in the first slice.

func NewRankPtr

func NewRankPtr(in uint32) *Rank

NewRankPtr creates a Rank representation of the given uint32 and returns a pointer to it.

func ParseRanks

func ParseRanks(stringRanks string) ([]Rank, error)

ParseRanks takes a string representation of a list of ranks e.g. 1-4,6 and returns a slice of Rank type or error.

func RanksFromUint32

func RanksFromUint32(in []uint32) []Rank

RanksFromUint32 is a convenience method to convert a slice of uint32s to a slice of system ranks.

func (*Rank) Equals

func (r *Rank) Equals(other Rank) bool

Equals compares this rank to the given rank.

func (*Rank) InList

func (r *Rank) InList(ranks []Rank) bool

InList checks rank is present in provided rank list.

func (*Rank) RemoveFromList

func (r *Rank) RemoveFromList(ranks []Rank) []Rank

RemoveFromList removes given rank from provided list and returns modified list.

Ignores miss in list.

func (*Rank) String

func (r *Rank) String() string

func (*Rank) Uint32

func (r *Rank) Uint32() uint32

Uint32 returns a uint32 representation of the Rank.

func (*Rank) UnmarshalYAML

func (r *Rank) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML converts YAML representation into a system Rank.

type RankList

type RankList []Rank

RankList provides convenience methods for working with Rank slices.

func (RankList) String

func (rl RankList) String() string

type RankSet

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

RankSet implements a set of unique ranks in a condensed format.

func CreateRankSet

func CreateRankSet(stringRanks string) (*RankSet, error)

CreateRankSet creates a new HostList with ranks rather than hostnames from the supplied string representation.

func MustCreateRankSet

func MustCreateRankSet(stringRanks string) *RankSet

MustCreateRankSet is like CreateRankSet but will panic on error.

func NewRankSet

func NewRankSet() *RankSet

NewRankSet returns an initialized RankSet.

func RankSetFromRanks

func RankSetFromRanks(ranks RankList) *RankSet

RankSetFromRanks returns a RankSet created from the supplied Rank slice.

func (*RankSet) Add

func (rs *RankSet) Add(rank Rank)

Add adds rank to an existing RankSet.

func (*RankSet) Count

func (rs *RankSet) Count() int

Count returns the number of ranks in the set.

func (*RankSet) Delete

func (rs *RankSet) Delete(rank Rank)

Delete removes the specified rank from the RankSet.

func (*RankSet) Merge

func (rs *RankSet) Merge(other *RankSet)

Merge merge the supplied RankSet into the receiver.

func (*RankSet) RangedString

func (rs *RankSet) RangedString() string

RangedString returns a ranged string representation of the RankSet.

func (*RankSet) Ranks

func (rs *RankSet) Ranks() (out []Rank)

Ranks returns a slice of Rank from a RankSet.

func (*RankSet) Replace

func (rs *RankSet) Replace(other *RankSet)

Replace replaces the contents of the receiver with the supplied RankSet.

func (*RankSet) String

func (rs *RankSet) String() string

Jump to

Keyboard shortcuts

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