Versions in this module Expand all Collapse all v4 v4.2.1 Feb 9, 2023 v4.2.0 Aug 12, 2022 v4.1.0 Aug 3, 2022 Changes in this version type BrokerMeta + InterBrokerProtocolVersion string + LogMessageFormat string type BrokerMetaMap + func BrokerMetaMapFromStates(states kafkaadmin.BrokerStates) (BrokerMetaMap, error) type PartitionMap + func PartitionMapFromTopicStates(ts kafkaadmin.TopicStates) (*PartitionMap, error) v4.0.0 May 17, 2022 Changes in this version + const StubBrokerID + var ErrInvalidSelectionMethod = errors.New("Invalid selection method") + var ErrNoBrokers = errors.New("No additional brokers that meet Constraints") + var NotReplacedBrokersFn = func(b *Broker) bool + var ReplacedBrokersFn = func(b *Broker) bool + func WriteMap(pm *PartitionMap, path string) error + type Broker struct + ID int + Locality string + Missing bool + New bool + Replace bool + StorageFree float64 + Used int + func (b Broker) Copy() Broker + type BrokerFilterFn func(*Broker) bool + var AllBrokersFn BrokerFilterFn = func(b *Broker) bool { ... } + func AboveMeanFn(d float64, f func() float64) BrokerFilterFn + func BelowMeanFn(d float64, f func() float64) BrokerFilterFn + type BrokerList []*Broker + func (b BrokerList) BestCandidate(c *Constraints, by string, p int64) (*Broker, error) + func (b BrokerList) Filter(f BrokerFilterFn) BrokerList + func (b BrokerList) SortByCount() + func (b BrokerList) SortByID() + func (b BrokerList) SortByIDDesc() + func (b BrokerList) SortByStorage() + func (b BrokerList) SortPseudoShuffle(seed int64) + type BrokerMap map[int]*Broker + func BrokerMapFromPartitionMap(pm *PartitionMap, bm BrokerMetaMap, force bool) BrokerMap + func NewBrokerMap() BrokerMap + func (b BrokerMap) AboveMean(d float64, f func() float64) []int + func (b BrokerMap) BelowMean(d float64, f func() float64) []int + func (b BrokerMap) Copy() BrokerMap + func (b BrokerMap) Filter(f BrokerFilterFn) BrokerMap + func (b BrokerMap) HMean() float64 + func (b BrokerMap) List() BrokerList + func (b BrokerMap) Mean() float64 + func (b BrokerMap) MinMax() (float64, float64) + func (b BrokerMap) StorageDiff(b2 BrokerMap) map[int][2]float64 + func (b BrokerMap) StorageRange() float64 + func (b BrokerMap) StorageRangeSpread() float64 + func (b BrokerMap) StorageStdDev() float64 + func (b BrokerMap) SubStorage(pm *PartitionMap, pmm PartitionMetaMap, f BrokerFilterFn) error + func (b BrokerMap) SubstitutionAffinities(pm *PartitionMap) (SubstitutionAffinities, error) + func (b BrokerMap) Update(bl []int, bm BrokerMetaMap) (*BrokerStatus, <-chan string) + type BrokerMeta struct + Endpoints []string + Host string + JMXPort int + ListenerSecurityProtocolMap map[string]string + MetricsIncomplete bool + Port int + Rack string + StorageFree float64 + Timestamp string + Version int + func (bm BrokerMeta) Copy() BrokerMeta + type BrokerMetaMap map[int]*BrokerMeta + func (bmm BrokerMetaMap) Copy() BrokerMetaMap + type BrokerMetrics struct + StorageFree float64 + type BrokerMetricsMap map[int]*BrokerMetrics + type BrokerStatus struct + Missing int + New int + OldMissing int + RackMissing int + Replace int + func (bs BrokerStatus) Changes() bool + type BrokerUseStats struct + Follower int + ID int + Leader int + type BrokerUseStatsList []*BrokerUseStats + func (b BrokerUseStatsList) Len() int + func (b BrokerUseStatsList) Less(i, j int) bool + func (b BrokerUseStatsList) Swap(i, j int) + type BrokerUseStatsMap map[int]*BrokerUseStats + func (b BrokerUseStatsMap) List() BrokerUseStatsList + type Constraints struct + func MergeConstraints(bl BrokerList) *Constraints + func NewConstraints() *Constraints + func (c *Constraints) Add(b *Broker) + func (c *Constraints) MergeConstraints(bl BrokerList) + func (c *Constraints) SelectBroker(b BrokerList, p ConstraintsParams) (*Broker, error) + type ConstraintsParams struct + MinUniqueRackIDs int + RequestSize float64 + SeedVal int64 + SelectorMethod string + type DegreeDistribution struct + Relationships map[int]map[int]struct{} + func NewDegreeDistribution() DegreeDistribution + func (dd DegreeDistribution) Add(nodes []int) + func (dd DegreeDistribution) Count(n int) int + func (dd DegreeDistribution) Stats() DegreeDistributionStats + type DegreeDistributionStats struct + Avg float64 + Max float64 + Min float64 + type Mappings map[int]map[string]PartitionList + func NewMappings() Mappings + func (m Mappings) LargestPartitions(id int, k int, pm PartitionMetaMap) (PartitionList, error) + func (m Mappings) Remove(id int, p Partition) error + type NoMappingForBroker struct + func (e NoMappingForBroker) Error() string + type NoMappingForTopic struct + func (e NoMappingForTopic) Error() string + type Partition struct + Partition int + Replicas []int + Topic string + func (p Partition) Equal(p2 Partition) bool + type PartitionList []Partition + func (p PartitionList) Len() int + func (p PartitionList) Less(i, j int) bool + func (p PartitionList) SortBySize(m PartitionMetaMap) + func (p PartitionList) Swap(i, j int) + type PartitionMap struct + Partitions PartitionList + Version int + func NewPartitionMap(opts ...PartitionMapOpt) *PartitionMap + func PartitionMapFromString(s string) (*PartitionMap, error) + func (pm *PartitionMap) Copy() *PartitionMap + func (pm *PartitionMap) DegreeDistribution() DegreeDistribution + func (pm *PartitionMap) Equal(pm2 *PartitionMap) (bool, error) + func (pm *PartitionMap) LocalitiesAvailable(bm BrokerMap, b *Broker) []string + func (pm *PartitionMap) Mappings() Mappings + func (pm *PartitionMap) OptimizeLeaderFollower() + func (pm *PartitionMap) Rebuild(params RebuildParams) (*PartitionMap, []error) + func (pm *PartitionMap) ReplicaSets(t string) ReplicaSets + func (pm *PartitionMap) SetReplication(r int) + func (pm *PartitionMap) Strip() *PartitionMap + func (pm *PartitionMap) Topics() []string + func (pm *PartitionMap) UseStats() BrokerUseStatsMap + func (pm PartitionMap) BrokersIn() BrokerFilterFn + type PartitionMapOpt func(*PartitionMap) + func Populate(s string, n, r int) PartitionMapOpt + type PartitionMeta struct + Size float64 + type PartitionMetaMap map[string]map[int]*PartitionMeta + func NewPartitionMetaMap() PartitionMetaMap + func (pmm PartitionMetaMap) Size(p Partition) (float64, error) + type RebuildParams struct + Affinities SubstitutionAffinities + BM BrokerMap + MinUniqueRackIDs int + Optimization string + PMM PartitionMetaMap + PartnSzFactor float64 + Strategy string + func NewRebuildParams() RebuildParams + type ReplicaSets map[int][]int + type Stub struct + func NewZooKeeperStub() *Stub + func (zk *Stub) GetAllBrokerMeta(withMetrics bool) (BrokerMetaMap, []error) + func (zk *Stub) GetAllPartitionMeta() (PartitionMetaMap, error) + func (zk *Stub) GetBrokerMetrics() (BrokerMetricsMap, error) + func (zk *Stub) GetPartitionMap(t string) (*PartitionMap, error) + func (zk *Stub) GetTopicState(t string) (*TopicState, error) + type StubZnode struct + type SubstitutionAffinities map[int]*Broker + func (sa SubstitutionAffinities) Get(id int) *Broker + type TopicState struct + Partitions map[string][]int + func (ts *TopicState) Brokers() []int