extenders

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BalancedExtender

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

BalancedExtender adds extra partition assignments in a "balanced" way. The current algorithm is:

for each new partition:

set the leader rack to the next rack in the cycle
choose the leader using the picker
for each follower:
  set the rack to either the same one as the leader (if inRack true) or the next one in the
    cycle (if inRack false)
  pick the follower using the picker

func NewBalancedExtender

func NewBalancedExtender(
	brokers []admin.BrokerInfo,
	inRack bool,
	picker pickers.Picker,
) *BalancedExtender

NewBalancedExtender returns a new BalancedExtender instance.

func (*BalancedExtender) Extend

func (b *BalancedExtender) Extend(
	topic string,
	curr []admin.PartitionAssignment,
	extraPartitions int,
) ([]admin.PartitionAssignment, error)

Extend returns partition assignments for the extension of the argument topic.

type Extender

type Extender interface {
	Extend(
		topic string,
		currAssignments []admin.PartitionAssignment,
		newPartitions int,
	) ([]admin.PartitionAssignment, error)
}

Extender is an interface for structs that determine how to add new partitions to an existing topic.

type StaticExtender

type StaticExtender struct {
	Assignments []admin.PartitionAssignment
}

StaticExtender is an Extender that ignores the current state and assigns based on the value of the Assignments field. Generally intended for testing purposes.

func (*StaticExtender) Extend

func (s *StaticExtender) Extend(
	topic string,
	curr []admin.PartitionAssignment,
	newPartitions int,
) ([]admin.PartitionAssignment, error)

Extend returns partition assignments for the extension of the argument topic.

Jump to

Keyboard shortcuts

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